diff options
Diffstat (limited to 'runners')
-rw-r--r-- | runners/ant/src/main/kotlin/ant/dokka.kt | 24 | ||||
-rw-r--r-- | runners/cli/src/main/kotlin/cli/main.kt | 8 | ||||
-rw-r--r-- | runners/gradle-plugin/src/main/kotlin/main.kt | 1 | ||||
-rw-r--r-- | runners/maven-plugin/src/main/kotlin/DokkaMojo.kt | 9 |
4 files changed, 28 insertions, 14 deletions
diff --git a/runners/ant/src/main/kotlin/ant/dokka.kt b/runners/ant/src/main/kotlin/ant/dokka.kt index 38dc543b..e9cb35a2 100644 --- a/runners/ant/src/main/kotlin/ant/dokka.kt +++ b/runners/ant/src/main/kotlin/ant/dokka.kt @@ -5,10 +5,7 @@ import org.apache.tools.ant.Project import org.apache.tools.ant.Task import org.apache.tools.ant.types.Path import org.apache.tools.ant.types.Reference -import org.jetbrains.dokka.DocumentationOptions -import org.jetbrains.dokka.DokkaGenerator -import org.jetbrains.dokka.DokkaLogger -import org.jetbrains.dokka.SourceLinkDefinition +import org.jetbrains.dokka.* import java.io.File class AntLogger(val task: Task): DokkaLogger { @@ -19,10 +16,17 @@ class AntLogger(val task: Task): DokkaLogger { class AntSourceLinkDefinition(var path: String? = null, var url: String? = null, var lineSuffix: String? = null) -class DokkaAntTask(): Task() { +class AntSourceRoot(var path: String? = null, var platforms: String? = null) + +fun AntSourceRoot.toSourceRoot(): SourceRoot? = path?.let { + path -> SourceRoot(path, platforms?.split(',').orEmpty()) +} + +class DokkaAntTask: Task() { var moduleName: String? = null var outputDir: String? = null var outputFormat: String = "html" + var impliedPlatforms: String = "" var jdkVersion: Int = 6 var skipDeprecated: Boolean = false @@ -33,6 +37,7 @@ class DokkaAntTask(): Task() { val includesPath: Path by lazy { Path(getProject()) } val antSourceLinks: MutableList<AntSourceLinkDefinition> = arrayListOf() + val antSourceRoots: MutableList<AntSourceRoot> = arrayListOf() fun setClasspath(classpath: Path) { compileClasspath.append(classpath) @@ -68,8 +73,10 @@ class DokkaAntTask(): Task() { return def } + fun createSourceRoot(): AntSourceRoot = AntSourceRoot().apply { antSourceRoots.add(this) } + override fun execute() { - if (sourcePath.list().size == 0) { + if (sourcePath.list().isEmpty() && antSourceRoots.isEmpty()) { throw BuildException("At least one source path needs to be specified") } if (moduleName == null) { @@ -87,14 +94,15 @@ class DokkaAntTask(): Task() { val generator = DokkaGenerator( AntLogger(this), compileClasspath.list().toList(), - sourcePath.list().toList(), + sourcePath.list().map { SourceRoot(it) } + antSourceRoots.mapNotNull { it.toSourceRoot() }, samplesPath.list().toList(), includesPath.list().toList(), moduleName!!, DocumentationOptions(outputDir!!, outputFormat, skipDeprecated = skipDeprecated, sourceLinks = sourceLinks, - jdkVersion = jdkVersion) + jdkVersion = jdkVersion, + impliedPlatforms = impliedPlatforms.split(',')) ) generator.generate() } diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt index afc67e45..58bca522 100644 --- a/runners/cli/src/main/kotlin/cli/main.kt +++ b/runners/cli/src/main/kotlin/cli/main.kt @@ -44,6 +44,9 @@ class DokkaArguments { @set:Argument(value = "jdkVersion", description = "Version of JDK to use for linking to JDK JavaDoc") var jdkVersion: Int = 6 + + @set:Argument(value = "impliedPlatforms", description = "List of implied platforms (comma-separated)") + var impliedPlatforms: String = "" } @@ -72,13 +75,14 @@ object MainKt { arguments.outputDir.let { if (it.endsWith('/')) it else it + '/' }, arguments.outputFormat, skipDeprecated = arguments.nodeprecated, - sourceLinks = sourceLinks + sourceLinks = sourceLinks, + impliedPlatforms = arguments.impliedPlatforms.split(',') ) val generator = DokkaGenerator( DokkaConsoleLogger, classPath, - sources, + sources.map(::parseSourceRoot), samples, includes, arguments.moduleName, diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt index 7ed83473..3a78080c 100644 --- a/runners/gradle-plugin/src/main/kotlin/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/main.kt @@ -159,6 +159,7 @@ open class DokkaTask : DefaultTask() { outputDirectory, outputFormat, false, + false, reportNotDocumented, skipEmptyPackages, skipDeprecated, diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index 899d2dde..c3cf7509 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -7,11 +7,12 @@ import org.apache.maven.plugin.AbstractMojo import org.apache.maven.plugins.annotations.* import org.apache.maven.project.MavenProject import org.apache.maven.project.MavenProjectHelper -import org.jetbrains.dokka.DokkaGenerator -import org.jetbrains.dokka.SourceLinkDefinition -import org.jetbrains.dokka.DocumentationOptions import org.codehaus.plexus.archiver.Archiver import org.codehaus.plexus.archiver.jar.JarArchiver +import org.jetbrains.dokka.DocumentationOptions +import org.jetbrains.dokka.DokkaGenerator +import org.jetbrains.dokka.SourceLinkDefinition +import org.jetbrains.dokka.SourceRoot import java.io.File class SourceLinkMapItem { @@ -66,7 +67,7 @@ abstract class AbstractDokkaMojo : AbstractMojo() { val gen = DokkaGenerator( MavenDokkaLogger(log), classpath, - sourceDirectories, + sourceDirectories.map { SourceRoot(it) }, samplesDirs, includeDirs + includes, moduleName, |