aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
Diffstat (limited to 'runners')
-rw-r--r--runners/ant/src/main/kotlin/ant/dokka.kt17
-rw-r--r--runners/gradle-plugin/src/main/kotlin/main.kt23
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt49
3 files changed, 69 insertions, 20 deletions
diff --git a/runners/ant/src/main/kotlin/ant/dokka.kt b/runners/ant/src/main/kotlin/ant/dokka.kt
index 54694880..f645aea4 100644
--- a/runners/ant/src/main/kotlin/ant/dokka.kt
+++ b/runners/ant/src/main/kotlin/ant/dokka.kt
@@ -23,16 +23,11 @@ class AntSourceRoot(var path: String? = null, var platforms: String? = null) {
}
}
-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 AntPackageOptions(
+ override var prefix: String = "",
+ override var includeNonPublic: Boolean = false,
+ override var reportUndocumented: Boolean = true,
+ override var skipDeprecated: Boolean = false) : DokkaConfiguration.PackageOptions
class DokkaAntTask: Task() {
@@ -119,7 +114,7 @@ class DokkaAntTask: Task() {
sourceLinks = sourceLinks,
jdkVersion = jdkVersion,
impliedPlatforms = impliedPlatforms.split(','),
- perPackageOptions = antPackageOptions.map { it.toPackageOptions() })
+ perPackageOptions = antPackageOptions)
)
generator.generate()
}
diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt
index 7aa871ad..60311fff 100644
--- a/runners/gradle-plugin/src/main/kotlin/main.kt
+++ b/runners/gradle-plugin/src/main/kotlin/main.kt
@@ -82,6 +82,8 @@ open class DokkaTask : DefaultTask() {
@Input var skipDeprecated = false
@Input var skipEmptyPackages = true
@Input var reportNotDocumented = true
+ @Input var perPackageOptions: MutableList<PackageOptions> = arrayListOf()
+ @Input var impliedPlatforms: MutableList<String> = arrayListOf()
protected open val sdkProvider: SdkProvider? = null
@@ -108,6 +110,13 @@ open class DokkaTask : DefaultTask() {
sourceRoots.add(sourceRoot)
}
+ fun packageOptions(closure: Closure<Any?>) {
+ val packageOptions = PackageOptions()
+ closure.delegate = packageOptions
+ closure.call()
+ perPackageOptions.add(packageOptions)
+ }
+
fun tryResolveFatJar(project: Project): File {
return try {
val dependency = project.buildscript.dependencies.create(dokkaFatJar)
@@ -172,9 +181,11 @@ open class DokkaTask : DefaultTask() {
reportNotDocumented,
skipEmptyPackages,
skipDeprecated,
- 6,
+ jdkVersion,
true,
- linkMappings)
+ linkMappings,
+ impliedPlatforms,
+ perPackageOptions)
bootstrapProxy.configure(
@@ -238,7 +249,7 @@ class SourceRoot : DokkaConfiguration.SourceRoot {
field = File(value).absolutePath
}
- override var defaultPlatforms: List<String> = arrayListOf()
+ override var platforms: List<String> = arrayListOf()
}
open class LinkMapping : Serializable, DokkaConfiguration.SourceLinkDefinition {
@@ -286,6 +297,12 @@ open class LinkMapping : Serializable, DokkaConfiguration.SourceLinkDefinition {
}
}
+class PackageOptions : DokkaConfiguration.PackageOptions {
+ override var prefix: String = ""
+ override var includeNonPublic: Boolean = false
+ override var reportUndocumented: Boolean = true
+ override var skipDeprecated: Boolean = false
+}
/**
* A provider for SDKs that can be used if a project uses classes that live outside the JDK or uses a
* different method to determine the source directories.
diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
index dcccdb1f..dbae2362 100644
--- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
+++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
@@ -9,10 +9,7 @@ import org.apache.maven.project.MavenProject
import org.apache.maven.project.MavenProjectHelper
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.SourceLinkDefinitionImpl
-import org.jetbrains.dokka.SourceRootImpl
+import org.jetbrains.dokka.*
import java.io.File
class SourceLinkMapItem {
@@ -27,10 +24,32 @@ class SourceLinkMapItem {
}
abstract class AbstractDokkaMojo : AbstractMojo() {
+ class SourceRoot : DokkaConfiguration.SourceRoot {
+ @Parameter(required = true)
+ override var path: String = ""
+
+ @Parameter
+ override var platforms: List<String> = emptyList()
+ }
+
+ class PackageOptions : DokkaConfiguration.PackageOptions {
+ @Parameter
+ override var prefix: String = ""
+ @Parameter
+ override var includeNonPublic: Boolean = false
+ @Parameter
+ override var reportUndocumented: Boolean = true
+ @Parameter
+ override var skipDeprecated: Boolean = false
+ }
+
@Parameter(required = true, defaultValue = "\${project.compileSourceRoots}")
var sourceDirectories: List<String> = emptyList()
@Parameter
+ var sourceRoots: List<SourceRoot> = emptyList()
+
+ @Parameter
var samplesDirs: List<String> = emptyList()
@Parameter
@@ -55,6 +74,19 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
@Parameter(required = false, defaultValue = "6")
var jdkVersion: Int = 6
+ @Parameter
+ var skipDeprecated = false
+ @Parameter
+ var skipEmptyPackages = true
+ @Parameter
+ var reportNotDocumented = true
+
+ @Parameter
+ var impliedPlatforms: List<String> = emptyList()
+
+ @Parameter
+ var perPackageOptions: List<PackageOptions> = emptyList()
+
protected abstract fun getOutDir(): String
protected abstract fun getOutFormat(): String
@@ -67,13 +99,18 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
val gen = DokkaGenerator(
MavenDokkaLogger(log),
classpath,
- sourceDirectories.map { SourceRootImpl(it) },
+ sourceDirectories.map { SourceRootImpl(it) } + sourceRoots,
samplesDirs,
includeDirs + includes,
moduleName,
DocumentationOptions(getOutDir(), getOutFormat(),
sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.dir, it.url, it.urlSuffix) },
- jdkVersion = jdkVersion
+ jdkVersion = jdkVersion,
+ skipDeprecated = skipDeprecated,
+ skipEmptyPackages = skipEmptyPackages,
+ reportUndocumented = reportNotDocumented,
+ impliedPlatforms = impliedPlatforms,
+ perPackageOptions = perPackageOptions
)
)