diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2017-02-24 13:20:34 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2017-02-24 13:20:34 +0100 |
commit | 82912c082b729d7dba7e6f6bd9b3656222ffcc00 (patch) | |
tree | 685981692f96a49b39efd62a3ce487b3bf949a8a /runners | |
parent | a3c7641398de9a3cd594a273538bb9e916139830 (diff) | |
download | dokka-82912c082b729d7dba7e6f6bd9b3656222ffcc00.tar.gz dokka-82912c082b729d7dba7e6f6bd9b3656222ffcc00.tar.bz2 dokka-82912c082b729d7dba7e6f6bd9b3656222ffcc00.zip |
Allow to specify platform for source roots in Ant scripts
Diffstat (limited to 'runners')
-rw-r--r-- | runners/ant/src/main/kotlin/ant/dokka.kt | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/runners/ant/src/main/kotlin/ant/dokka.kt b/runners/ant/src/main/kotlin/ant/dokka.kt index 98c44d11..65cc0b51 100644 --- a/runners/ant/src/main/kotlin/ant/dokka.kt +++ b/runners/ant/src/main/kotlin/ant/dokka.kt @@ -16,7 +16,13 @@ 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" @@ -30,6 +36,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) @@ -65,8 +72,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) { @@ -84,7 +93,7 @@ class DokkaAntTask(): Task() { val generator = DokkaGenerator( AntLogger(this), compileClasspath.list().toList(), - sourcePath.list().map { SourceRoot(it) }, + sourcePath.list().map { SourceRoot(it) } + antSourceRoots.mapNotNull { it.toSourceRoot() }, samplesPath.list().toList(), includesPath.list().toList(), moduleName!!, |