aboutsummaryrefslogtreecommitdiff
path: root/runners/ant/src
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-03-23 22:59:08 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-03-29 18:37:38 +0300
commit57e38932b414e7496678b3cc1f171cbf7c4d8fbb (patch)
tree4658b36056734ceda19be3ce78c62791712aef32 /runners/ant/src
parent921192e64c7f1df02692c1ec7f24f4a8bc9b7231 (diff)
downloaddokka-57e38932b414e7496678b3cc1f171cbf7c4d8fbb.tar.gz
dokka-57e38932b414e7496678b3cc1f171cbf7c4d8fbb.tar.bz2
dokka-57e38932b414e7496678b3cc1f171cbf7c4d8fbb.zip
Per package options
Diffstat (limited to 'runners/ant/src')
-rw-r--r--runners/ant/src/main/kotlin/ant/dokka.kt25
-rw-r--r--runners/ant/src/main/resources/dokka-antlib.xml3
2 files changed, 24 insertions, 4 deletions
diff --git a/runners/ant/src/main/kotlin/ant/dokka.kt b/runners/ant/src/main/kotlin/ant/dokka.kt
index e9cb35a2..c05cf1cb 100644
--- a/runners/ant/src/main/kotlin/ant/dokka.kt
+++ b/runners/ant/src/main/kotlin/ant/dokka.kt
@@ -16,12 +16,25 @@ class AntLogger(val task: Task): DokkaLogger {
class AntSourceLinkDefinition(var path: String? = null, var url: String? = null, var lineSuffix: String? = null)
-class AntSourceRoot(var path: String? = null, var platforms: String? = null)
+class AntSourceRoot(var path: String? = null, var platforms: String? = null) {
+ fun toSourceRoot(): SourceRoot? = path?.let {
+ path ->
+ SourceRoot(path, platforms?.split(',').orEmpty())
+ }
+}
-fun AntSourceRoot.toSourceRoot(): SourceRoot? = path?.let {
- path -> SourceRoot(path, platforms?.split(',').orEmpty())
+class AntPackageOptions(var prefix: String = "",
+ var includeNonPublic: Boolean = false,
+ var reportUndocumented: Boolean = true,
+ var skipDeprecated: Boolean = false) {
+ fun toPackageOptions(): PackageOptions {
+ if(prefix == "")
+ throw IllegalArgumentException("Please do not register packageOptions with all match pattern, use global settings instead")
+ return PackageOptions(prefix, includeNonPublic, reportUndocumented, skipDeprecated)
+ }
}
+
class DokkaAntTask: Task() {
var moduleName: String? = null
var outputDir: String? = null
@@ -38,6 +51,7 @@ class DokkaAntTask: Task() {
val antSourceLinks: MutableList<AntSourceLinkDefinition> = arrayListOf()
val antSourceRoots: MutableList<AntSourceRoot> = arrayListOf()
+ val antPackageOptions: MutableList<AntPackageOptions> = arrayListOf()
fun setClasspath(classpath: Path) {
compileClasspath.append(classpath)
@@ -75,6 +89,8 @@ class DokkaAntTask: Task() {
fun createSourceRoot(): AntSourceRoot = AntSourceRoot().apply { antSourceRoots.add(this) }
+ fun createPackageOptions(): AntPackageOptions = AntPackageOptions().apply { antPackageOptions.add(this) }
+
override fun execute() {
if (sourcePath.list().isEmpty() && antSourceRoots.isEmpty()) {
throw BuildException("At least one source path needs to be specified")
@@ -102,7 +118,8 @@ class DokkaAntTask: Task() {
skipDeprecated = skipDeprecated,
sourceLinks = sourceLinks,
jdkVersion = jdkVersion,
- impliedPlatforms = impliedPlatforms.split(','))
+ impliedPlatforms = impliedPlatforms.split(','),
+ perPackageOptions = antPackageOptions.map { it.toPackageOptions() })
)
generator.generate()
}
diff --git a/runners/ant/src/main/resources/dokka-antlib.xml b/runners/ant/src/main/resources/dokka-antlib.xml
new file mode 100644
index 00000000..9c3373d5
--- /dev/null
+++ b/runners/ant/src/main/resources/dokka-antlib.xml
@@ -0,0 +1,3 @@
+<antlib>
+ <taskdef name="dokka" classname="org.jetbrains.dokka.ant.DokkaAntTask"/>
+</antlib>