diff options
Diffstat (limited to 'runners')
-rw-r--r-- | runners/ant/src/main/kotlin/ant/dokka.kt | 25 | ||||
-rw-r--r-- | runners/ant/src/main/resources/dokka-antlib.xml | 3 | ||||
-rw-r--r-- | runners/cli/src/main/kotlin/cli/main.kt | 6 |
3 files changed, 29 insertions, 5 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> diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt index 58bca522..20897c32 100644 --- a/runners/cli/src/main/kotlin/cli/main.kt +++ b/runners/cli/src/main/kotlin/cli/main.kt @@ -47,6 +47,9 @@ class DokkaArguments { @set:Argument(value = "impliedPlatforms", description = "List of implied platforms (comma-separated)") var impliedPlatforms: String = "" + + @set:Argument(value = "packageOptions", description = "List of package options in format \"prefix,-deprecated,-privateApi,+warnUndocumented;...\" ") + var packageOptions: String = "" } @@ -76,7 +79,8 @@ object MainKt { arguments.outputFormat, skipDeprecated = arguments.nodeprecated, sourceLinks = sourceLinks, - impliedPlatforms = arguments.impliedPlatforms.split(',') + impliedPlatforms = arguments.impliedPlatforms.split(','), + perPackageOptions = parsePerPackageOptions(arguments.packageOptions) ) val generator = DokkaGenerator( |