mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Source links for dokka.
This commit is contained in:
parent
b94dafe512
commit
72b011070b
2 changed files with 26 additions and 17 deletions
|
@ -12,6 +12,7 @@ import com.beust.kobalt.api.annotation.Task
|
||||||
import com.beust.kobalt.internal.JvmCompilerPlugin
|
import com.beust.kobalt.internal.JvmCompilerPlugin
|
||||||
import com.beust.kobalt.maven.DepFactory
|
import com.beust.kobalt.maven.DepFactory
|
||||||
import com.beust.kobalt.misc.RunCommand
|
import com.beust.kobalt.misc.RunCommand
|
||||||
|
import com.beust.kobalt.misc.error
|
||||||
import com.beust.kobalt.misc.log
|
import com.beust.kobalt.misc.log
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -42,40 +43,47 @@ class DokkaPlugin @Inject constructor(val depFactory: DepFactory) : ConfigPlugin
|
||||||
listOf(buildDir))
|
listOf(buildDir))
|
||||||
.joinToString(File.pathSeparator)
|
.joinToString(File.pathSeparator)
|
||||||
val dokkaJar = JarFinder.byId(DOKKA_ID)
|
val dokkaJar = JarFinder.byId(DOKKA_ID)
|
||||||
|
var success = true
|
||||||
if (config != null) {
|
if (config != null) {
|
||||||
val args : List<String> = listOf(
|
val args : List<String> = listOf(
|
||||||
"-classpath", classpathString,
|
"-classpath", classpathString,
|
||||||
"-jar", dokkaJar.absolutePath,
|
"-jar", dokkaJar.absolutePath,
|
||||||
"src/main/kotlin") +
|
*(project.sourceDirectories.toTypedArray())) +
|
||||||
config.args
|
config.args
|
||||||
RunCommand(javaExecutable.absolutePath).run(args, successCallback = {
|
RunCommand(javaExecutable.absolutePath).run(args, errorCallback = { output: List<String> ->
|
||||||
println("COMMAND SUCCESS")
|
error("Error running dokka:\n " + output.joinToString("\n"))
|
||||||
|
success = false
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
log(2, "No dokka configuration found for project ${project.name}, skipping it")
|
log(2, "No dokka configuration found for project ${project.name}, skipping it")
|
||||||
}
|
}
|
||||||
return TaskResult()
|
return TaskResult(success)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
output - the output directory where the documentation is generated
|
|
||||||
format - the output format:
|
|
||||||
html - HTML (default)
|
|
||||||
markdown - Markdown
|
|
||||||
jekyll - Markdown adapted for Jekyll sites
|
|
||||||
javadoc - Javadoc (showing how the project can be accessed from Java)
|
|
||||||
classpath - list of directories or .jar files to include in the classpath (used for resolving references)
|
|
||||||
samples - list of directories containing sample code (documentation for those directories is not generated but declarations from them can be referenced using the @sample tag)
|
|
||||||
module - the name of the module being documented (used as the root directory of the generated documentation)
|
|
||||||
include - names of files containing the documentation for the module and individual packages
|
|
||||||
nodeprecated
|
|
||||||
*/
|
|
||||||
class DokkaConfig() {
|
class DokkaConfig() {
|
||||||
val args = arrayListOf<String>()
|
val args = arrayListOf<String>()
|
||||||
fun args(vararg options: String) {
|
fun args(vararg options: String) {
|
||||||
args.addAll(options)
|
args.addAll(options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var linkMapping: LinkMappingConfig? = null
|
||||||
|
|
||||||
|
@Directive
|
||||||
|
fun linkMapping(init: LinkMappingConfig.() -> Unit) {
|
||||||
|
let { project ->
|
||||||
|
linkMapping = LinkMappingConfig().let {
|
||||||
|
it.init()
|
||||||
|
it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LinkMappingConfig {
|
||||||
|
var dir: String = ""
|
||||||
|
var url: String = ""
|
||||||
|
var suffix: String? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive
|
@Directive
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<class-name>com.beust.kobalt.plugin.packaging.PackagingPlugin</class-name>
|
<class-name>com.beust.kobalt.plugin.packaging.PackagingPlugin</class-name>
|
||||||
<class-name>com.beust.kobalt.plugin.publish.PublishPlugin</class-name>
|
<class-name>com.beust.kobalt.plugin.publish.PublishPlugin</class-name>
|
||||||
<class-name>com.beust.kobalt.plugin.apt.AptPlugin</class-name>
|
<class-name>com.beust.kobalt.plugin.apt.AptPlugin</class-name>
|
||||||
|
<class-name>com.beust.kobalt.plugin.dokka.DokkaPlugin</class-name>
|
||||||
</plugins>
|
</plugins>
|
||||||
<classpath-contributors>
|
<classpath-contributors>
|
||||||
<class-name>com.beust.kobalt.plugin.android.AndroidPlugin</class-name>
|
<class-name>com.beust.kobalt.plugin.android.AndroidPlugin</class-name>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue