aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
authorEugene Petrenko <eugene.petrenko@gmail.com>2018-09-11 14:03:29 +0300
committerEugene Petrenko <eugene.petrenko@gmail.com>2018-09-11 14:03:29 +0300
commita54070f5db04d05b48c369b211efe044fbc02a8d (patch)
treeaac5889906f49f68c39e1416ea39d4d19bad008e /runners
parente29f1c966056b0f7ee31dd9bd7d55f9e526fa7fe (diff)
parent0df19264ccae3d294946caf634ee15eea0c4fe4a (diff)
downloaddokka-a54070f5db04d05b48c369b211efe044fbc02a8d.tar.gz
dokka-a54070f5db04d05b48c369b211efe044fbc02a8d.tar.bz2
dokka-a54070f5db04d05b48c369b211efe044fbc02a8d.zip
Merge remote-tracking branch 'zub/dev-multiplatf' into kotlin-website-jonnyzzz
Diffstat (limited to 'runners')
-rw-r--r--runners/android-gradle-plugin/build.gradle9
-rw-r--r--runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt8
-rw-r--r--runners/ant/src/main/kotlin/ant/dokka.kt212
-rw-r--r--runners/cli/build.gradle7
-rw-r--r--runners/cli/src/main/kotlin/cli/DokkaArgumentsParser.kt185
-rw-r--r--runners/cli/src/main/kotlin/cli/main.kt294
-rw-r--r--runners/gradle-integration-tests/build.gradle5
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt5
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidLibDependsOnJavaLibTest.kt50
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt4
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/BasicTest.kt3
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/JavadocRSuppressionTest.kt4
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/MultiProjectSingleOutTest.kt3
-rw-r--r--runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/RebuildAfterSourceChangeTest.kt5
-rw-r--r--runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/build.gradle20
-rw-r--r--runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/fileTree.txt14
-rw-r--r--runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/jlib/build.gradle1
-rw-r--r--runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/jlib/src/main/java/example/jlib/LibClz.java5
-rw-r--r--runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle39
-rw-r--r--runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/src/main/AndroidManifest.xml4
-rw-r--r--runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/src/main/kotlin/example/LibClzUse.kt13
-rw-r--r--runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/package-list1
-rw-r--r--runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/settings.gradle5
-rw-r--r--runners/gradle-plugin/build.gradle10
-rw-r--r--runners/gradle-plugin/src/main/kotlin/main.kt90
-rw-r--r--runners/maven-plugin/build.gradle56
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt52
27 files changed, 792 insertions, 312 deletions
diff --git a/runners/android-gradle-plugin/build.gradle b/runners/android-gradle-plugin/build.gradle
index 5050fd87..72d1be9e 100644
--- a/runners/android-gradle-plugin/build.gradle
+++ b/runners/android-gradle-plugin/build.gradle
@@ -1,3 +1,4 @@
+import com.gradle.publish.DependenciesBuilder
import org.jetbrains.CorrectShadowPublishing
apply plugin: 'java'
@@ -13,7 +14,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
languageVersion = "1.2"
- apiVersion = "1.0"
+ apiVersion = "1.1"
jvmTarget = "1.8"
}
}
@@ -87,6 +88,12 @@ pluginBundle {
}
}
+ withDependencies { List<Dependency> list ->
+ list.clear()
+ def builder = new DependenciesBuilder()
+ builder.addUniqueScopedDependencies(list, configurations.shadow, "compile")
+ }
+
mavenCoordinates {
groupId = "org.jetbrains.dokka"
artifactId = "dokka-android-gradle-plugin"
diff --git a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
index f2261120..bd2e88c2 100644
--- a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
+++ b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
@@ -23,8 +23,12 @@ open class DokkaAndroidTask : DokkaTask() {
@Input var noAndroidSdkLink: Boolean = false
override fun collectSuppressedFiles(sourceRoots: List<SourceRoot>): List<String> {
- val generatedSubpath = "${project.buildDir}/generated/source".replace("/", File.separator)
- return sourceRoots.filter { generatedSubpath in it.path }.flatMap { File(it.path).walk().toList() }.map { it.absolutePath }
+ val generatedRoot = project.buildDir.resolve("generated").absoluteFile
+ return sourceRoots
+ .map { File(it.path) }
+ .filter { it.startsWith(generatedRoot) }
+ .flatMap { it.walk().toList() }
+ .map { it.absolutePath }
}
init {
diff --git a/runners/ant/src/main/kotlin/ant/dokka.kt b/runners/ant/src/main/kotlin/ant/dokka.kt
index d1b6bef5..023b4b7f 100644
--- a/runners/ant/src/main/kotlin/ant/dokka.kt
+++ b/runners/ant/src/main/kotlin/ant/dokka.kt
@@ -17,53 +17,101 @@ 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) {
- fun toSourceRoot(): SourceRootImpl? = path?.let {
- path ->
- SourceRootImpl(path, platforms?.split(',').orEmpty())
+class AntSourceRoot(var path: String? = null) {
+ fun toSourceRoot(): SourceRootImpl? = path?.let { path ->
+ SourceRootImpl(path)
}
}
-class AntPackageOptions(
- override var prefix: String = "",
- override var includeNonPublic: Boolean = false,
- override var reportUndocumented: Boolean = true,
- override var skipDeprecated: Boolean = false,
- override var suppress: Boolean = false) : DokkaConfiguration.PackageOptions
-
+class TextProperty(var value: String = "")
+
+class AntPassConfig(task: Task) : DokkaConfiguration.PassConfiguration {
+ override var moduleName: String = ""
+ override val classpath: List<String>
+ get() = buildClassPath.list().toList()
+
+ override val sourceRoots: List<DokkaConfiguration.SourceRoot>
+ get() = sourcePath.list().map { SourceRootImpl(it) } + antSourceRoots.mapNotNull { it.toSourceRoot() }
+
+ override val samples: List<String>
+ get() = samplesPath.list().toList()
+ override val includes: List<String>
+ get() = includesPath.list().toList()
+ override var includeNonPublic: Boolean = false
+ override var includeRootPackage: Boolean = true
+ override var reportUndocumented: Boolean = false
+ override var skipEmptyPackages: Boolean = true
+ override var skipDeprecated: Boolean = false
+ override var jdkVersion: Int = 6
+ override val sourceLinks: List<DokkaConfiguration.SourceLinkDefinition>
+ get() = antSourceLinkDefinition.map {
+ val path = it.path!!
+ val url = it.url!!
+ SourceLinkDefinitionImpl(File(path).canonicalFile.absolutePath, url, it.lineSuffix)
+ }
+ override val perPackageOptions: MutableList<DokkaConfiguration.PackageOptions> = mutableListOf()
+ override val externalDocumentationLinks: List<ExternalDocumentationLink>
+ get() = buildExternalLinksBuilders.map { it.build() } + defaultExternalDocumentationLinks
+
+ override var languageVersion: String? = null
+ override var apiVersion: String? = null
+ override var noStdlibLink: Boolean = false
+ override var noJdkLink: Boolean = false
+ override var suppressedFiles: MutableList<String> = mutableListOf()
+ override var collectInheritedExtensionsFromLibraries: Boolean = false
+ override var analysisPlatform: Platform = Platform.DEFAULT
+ override var targets: List<String> = listOf()
+ get() = buildTargets.filter { it.value != "" }
+ .map { it.value }
+
+ private val samplesPath: Path by lazy { Path(task.project) }
+ private val includesPath: Path by lazy { Path(task.project) }
+ private val buildClassPath: Path by lazy { Path(task.project) }
+ val sourcePath: Path by lazy { Path(task.project) }
+ val antSourceRoots: MutableList<AntSourceRoot> = mutableListOf()
+
+ private val buildTargets: MutableList<TextProperty> = mutableListOf()
+ private val buildExternalLinksBuilders: MutableList<ExternalDocumentationLink.Builder> = mutableListOf()
+ val antSourceLinkDefinition: MutableList<AntSourceLinkDefinition> = mutableListOf()
+
+ private val defaultExternalDocumentationLinks: List<DokkaConfiguration.ExternalDocumentationLink>
+ get() {
+ val links = mutableListOf<DokkaConfiguration.ExternalDocumentationLink>()
+ if (!noJdkLink)
+ links += DokkaConfiguration.ExternalDocumentationLink.Builder("http://docs.oracle.com/javase/$jdkVersion/docs/api/").build()
+
+ if (!noStdlibLink)
+ links += DokkaConfiguration.ExternalDocumentationLink.Builder("https://kotlinlang.org/api/latest/jvm/stdlib/").build()
+ return links
+ }
-class DokkaAntTask: Task() {
- var moduleName: String? = null
- var outputDir: String? = null
- var outputFormat: String = "html"
- var impliedPlatforms: String = ""
- var jdkVersion: Int = 6
- var noStdlibLink: Boolean = false
+ fun setSamples(ref: Path) {
+ samplesPath.append(ref)
+ }
- var skipDeprecated: Boolean = false
+ fun setSamplesRef(ref: Reference) {
+ samplesPath.createPath().refid = ref
+ }
- var cacheRoot: String? = null
+ fun setInclude(ref: Path) {
+ includesPath.append(ref)
+ }
- var languageVersion: String? = null
- var apiVersion: String? = null
+ fun setClasspath(classpath: Path) {
+ buildClassPath.append(classpath)
+ }
- val compileClasspath: Path by lazy { Path(getProject()) }
- val sourcePath: Path by lazy { Path(getProject()) }
- val samplesPath: Path by lazy { Path(getProject()) }
- val includesPath: Path by lazy { Path(getProject()) }
+ fun createPackageOptions(): AntPackageOptions = AntPackageOptions().apply { perPackageOptions.add(this) }
- val antSourceLinks: MutableList<AntSourceLinkDefinition> = arrayListOf()
- val antSourceRoots: MutableList<AntSourceRoot> = arrayListOf()
- val antPackageOptions: MutableList<AntPackageOptions> = arrayListOf()
- val antExternalDocumentationLinks = mutableListOf<ExternalDocumentationLink.Builder>()
+ fun createSourceRoot(): AntSourceRoot = AntSourceRoot().apply { antSourceRoots.add(this) }
- fun setClasspath(classpath: Path) {
- compileClasspath.append(classpath)
+ fun createTarget(): TextProperty = TextProperty().apply {
+ buildTargets.add(this)
}
fun setClasspathRef(ref: Reference) {
- compileClasspath.createPath().refid = ref
+ buildClassPath.createPath().refid = ref
}
fun setSrc(src: Path) {
@@ -74,68 +122,66 @@ class DokkaAntTask: Task() {
sourcePath.createPath().refid = ref
}
- fun setSamples(samples: Path) {
- samplesPath.append(samples)
- }
-
- fun setSamplesRef(ref: Reference) {
- samplesPath.createPath().refid = ref
- }
-
- fun setInclude(include: Path) {
- includesPath.append(include)
- }
-
fun createSourceLink(): AntSourceLinkDefinition {
val def = AntSourceLinkDefinition()
- antSourceLinks.add(def)
+ antSourceLinkDefinition.add(def)
return def
}
- fun createSourceRoot(): AntSourceRoot = AntSourceRoot().apply { antSourceRoots.add(this) }
+ fun createExternalDocumentationLink() =
+ ExternalDocumentationLink.Builder().apply { buildExternalLinksBuilders.add(this) }
- fun createPackageOptions(): AntPackageOptions = AntPackageOptions().apply { antPackageOptions.add(this) }
+}
+
+class AntPackageOptions(
+ override var prefix: String = "",
+ override var includeNonPublic: Boolean = false,
+ override var reportUndocumented: Boolean = true,
+ override var skipDeprecated: Boolean = false,
+ override var suppress: Boolean = false) : DokkaConfiguration.PackageOptions
+
+class DokkaAntTask: Task(), DokkaConfiguration {
+
+ override var format: String = "html"
+ override var generateIndexPages: Boolean = false
+ override var outputDir: String = ""
+ override var impliedPlatforms: List<String> = listOf()
+ get() = buildImpliedPlatforms.map { it.value }.toList()
+ private val buildImpliedPlatforms: MutableList<TextProperty> = mutableListOf()
+
+ override var cacheRoot: String? = null
+ override val passesConfigurations: MutableList<AntPassConfig> = mutableListOf()
+
+ fun createPassConfig() = AntPassConfig(this).apply { passesConfigurations.add(this) }
+ fun createImpliedPlatform(): TextProperty = TextProperty().apply { buildImpliedPlatforms.add(this) }
- fun createExternalDocumentationLink() = ExternalDocumentationLink.Builder().apply { antExternalDocumentationLinks.add(this) }
override fun execute() {
- if (sourcePath.list().isEmpty() && antSourceRoots.isEmpty()) {
- throw BuildException("At least one source path needs to be specified")
- }
- if (moduleName == null) {
- throw BuildException("Module name needs to be specified")
- }
- if (outputDir == null) {
- throw BuildException("Output directory needs to be specified")
+ for (passConfig in passesConfigurations) {
+ if (passConfig.sourcePath.list().isEmpty() && passConfig.antSourceRoots.isEmpty()) {
+ throw BuildException("At least one source path needs to be specified")
+ }
+
+ if (passConfig.moduleName == "") {
+ throw BuildException("Module name needs to be specified and not empty")
+ }
+
+ for (sourceLink in passConfig.antSourceLinkDefinition) {
+ if (sourceLink.path == null) {
+ throw BuildException("'path' attribute of a <sourceLink> element is required")
+ }
+
+ if (sourceLink.url == null) {
+ throw BuildException("'url' attribute of a <sourceLink> element is required")
+ }
+ }
}
- val sourceLinks = antSourceLinks.map {
- val path = it.path ?: throw BuildException("'path' attribute of a <sourceLink> element is required")
- val url = it.url ?: throw BuildException("'url' attribute of a <sourceLink> element is required")
- SourceLinkDefinitionImpl(File(path).canonicalFile.absolutePath, url, it.lineSuffix)
+
+ if (outputDir == "") {
+ throw BuildException("Output directory needs to be specified and not empty")
}
- val generator = DokkaGenerator(
- AntLogger(this),
- compileClasspath.list().toList(),
- sourcePath.list().map { SourceRootImpl(it) } + antSourceRoots.mapNotNull { it.toSourceRoot() },
- samplesPath.list().toList(),
- includesPath.list().toList(),
- moduleName!!,
- DocumentationOptions(
- outputDir!!,
- outputFormat,
- skipDeprecated = skipDeprecated,
- sourceLinks = sourceLinks,
- jdkVersion = jdkVersion,
- impliedPlatforms = impliedPlatforms.split(','),
- perPackageOptions = antPackageOptions,
- externalDocumentationLinks = antExternalDocumentationLinks.map { it.build() },
- noStdlibLink = noStdlibLink,
- cacheRoot = cacheRoot,
- languageVersion = languageVersion,
- apiVersion = apiVersion
- )
- )
+ val generator = DokkaGenerator(this, AntLogger(this))
generator.generate()
}
} \ No newline at end of file
diff --git a/runners/cli/build.gradle b/runners/cli/build.gradle
index 7f733140..54f74b03 100644
--- a/runners/cli/build.gradle
+++ b/runners/cli/build.gradle
@@ -10,7 +10,12 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
}
}
+repositories {
+ mavenLocal()
+}
+
dependencies {
compile project(":core")
- compile "com.github.spullara.cli-parser:cli-parser:1.1.1"
+// compile "com.github.spullara.cli-parser:cli-parser:1.1.1"
+ compile "org.jetbrains:kotlinx.cli:0.1"
}
diff --git a/runners/cli/src/main/kotlin/cli/DokkaArgumentsParser.kt b/runners/cli/src/main/kotlin/cli/DokkaArgumentsParser.kt
new file mode 100644
index 00000000..5d795da7
--- /dev/null
+++ b/runners/cli/src/main/kotlin/cli/DokkaArgumentsParser.kt
@@ -0,0 +1,185 @@
+package org.jetbrains.dokka
+
+import kotlinx.cli.*
+import kotlin.reflect.KProperty
+
+class ParseContext(val cli: CommandLineInterface = CommandLineInterface("dokka")) {
+ private val transformActions = mutableMapOf<KProperty<*>, (String) -> Unit>()
+ private val flagActions = mutableMapOf<KProperty<*>, () -> Unit>()
+
+ fun registerFlagAction(
+ keys: List<String>,
+ help: String,
+ property: KProperty<*>,
+ invoke: () -> Unit
+ ) {
+ if (property !in flagActions.keys) {
+ cli.flagAction(keys, help) {
+ flagActions[property]!!()
+ }
+ }
+ flagActions[property] = invoke
+
+ }
+
+ fun registerSingleOption(
+ keys: List<String>,
+ help: String,
+ property: KProperty<*>,
+ invoke: (String) -> Unit
+ ) {
+ if (property !in transformActions.keys) {
+ cli.singleAction(keys, help) {
+ transformActions[property]!!(it)
+ }
+ }
+ transformActions[property] = invoke
+ }
+
+ fun registerRepeatableOption(
+ keys: List<String>,
+ help: String,
+ property: KProperty<*>,
+ invoke: (String) -> Unit
+ ) {
+ if (property !in transformActions.keys) {
+ cli.repeatingAction(keys, help) {
+ transformActions[property]!!(it)
+ }
+ }
+ transformActions[property] = invoke
+ }
+
+ fun parse(args: Array<String>) {
+ cli.parseArgs(*args)
+ }
+
+}
+
+fun CommandLineInterface.singleAction(
+ keys: List<String>,
+ help: String,
+ invoke: (String) -> Unit
+) = registerAction(
+ object : FlagActionBase(keys, help) {
+ override fun invoke(arguments: ListIterator<String>) {
+ if (arguments.hasNext()) {
+ val msg = arguments.next()
+ invoke(msg)
+ }
+ }
+
+ override fun invoke() {
+ error("should be never called")
+ }
+ }
+)
+
+fun CommandLineInterface.repeatingAction(
+ keys: List<String>,
+ help: String,
+ invoke: (String) -> Unit
+) = registerAction(
+ object : FlagActionBase(keys, help) {
+ override fun invoke(arguments: ListIterator<String>) {
+ while (arguments.hasNext()) {
+ val message = arguments.next()
+
+ if (this@repeatingAction.getFlagAction(message) != null) {
+ arguments.previous()
+ break
+ }
+ invoke(message)
+ }
+ }
+
+ override fun invoke() {
+ error("should be never called")
+ }
+ }
+
+)
+
+
+class DokkaArgumentsParser(val args: Array<String>, val parseContext: ParseContext) {
+ class OptionDelegate<T>(
+ var value: T,
+ private val action: (delegate: OptionDelegate<T>, property: KProperty<*>) -> Unit
+ ) {
+ operator fun getValue(thisRef: Any?, property: KProperty<*>): T = value
+ operator fun provideDelegate(thisRef: Any, property: KProperty<*>): OptionDelegate<T> {
+ action(this, property)
+ return this
+ }
+ }
+
+ fun <T> parseInto(dest: T): T {
+ // TODO: constructor: (DokkaArgumentsParser) -> T
+ parseContext.parse(args)
+ return dest
+ }
+
+ fun <T> repeatableOption(
+ keys: List<String>,
+ help: String,
+ transform: (String) -> T
+ ) = OptionDelegate(mutableListOf<T>()) { delegate, property ->
+ parseContext.registerRepeatableOption(keys, help, property) {
+ delegate.value.add(transform(it))
+ }
+ }
+
+ fun <T : String?> repeatableOption(
+ keys: List<String>,
+ help: String
+ ) = repeatableOption(keys, help) { it as T }
+
+ fun <T> repeatableFlag(
+ keys: List<String>,
+ help: String,
+ initElement: (ParseContext) -> T
+ ) = OptionDelegate(mutableListOf<T>()) { delegate, property ->
+ parseContext.registerFlagAction(keys, help, property) {
+ delegate.value.add(initElement(parseContext))
+ }
+ }
+
+ fun <T> singleFlag(
+ keys: List<String>,
+ help: String,
+ initElement: (ParseContext) -> T,
+ transform: () -> T
+ ) = OptionDelegate(initElement(parseContext)) { delegate, property ->
+ parseContext.registerFlagAction(keys, help, property) {
+ delegate.value = transform()
+ }
+ }
+
+ fun singleFlag(
+ keys: List<String>,
+ help: String
+ ) = singleFlag(keys, help, { false }, { true })
+
+ fun <T : String?> stringOption(
+ keys: List<String>,
+ help: String,
+ defaultValue: T
+ ) = singleOption(keys, help, { it as T }, { defaultValue })
+
+ fun <T> singleOption(
+ keys: List<String>,
+ help: String,
+ transform: (String) -> T,
+ initElement: (ParseContext) -> T
+ ) = OptionDelegate(initElement(parseContext)) { delegate, property ->
+ parseContext.registerSingleOption(keys, help, property) {
+ val toAdd = transform(it)
+ delegate.value = toAdd
+ }
+ }
+}
+
+
+//`(-perPackage fqName [-include-non-public] [...other flags])*` (edited)
+//`(-sourceLink dir url [-urlSuffix value])*`
+//`(-extLink url [packageListUrl])*` \ No newline at end of file
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt
index fe945ed3..655dfde5 100644
--- a/runners/cli/src/main/kotlin/cli/main.kt
+++ b/runners/cli/src/main/kotlin/cli/main.kt
@@ -1,72 +1,151 @@
package org.jetbrains.dokka
-
-import com.sampullara.cli.Args
-import com.sampullara.cli.Argument
+import kotlinx.cli.registerAction
import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink
+import org.jetbrains.kotlin.daemon.common.compareDaemonJVMOptionsMemory
import java.io.File
import java.net.MalformedURLException
import java.net.URL
import java.net.URLClassLoader
-class DokkaArguments {
- @set:Argument(value = "src", description = "Source file or directory (allows many paths separated by the system path separator)")
- var src: String = ""
-
- @set:Argument(value = "srcLink", description = "Mapping between a source directory and a Web site for browsing the code")
- var srcLink: String = ""
-
- @set:Argument(value = "include", description = "Markdown files to load (allows many paths separated by the system path separator)")
- var include: String = ""
-
- @set:Argument(value = "samples", description = "Source root for samples")
- var samples: String = ""
-
- @set:Argument(value = "output", description = "Output directory path")
- var outputDir: String = "out/doc/"
-
- @set:Argument(value = "format", description = "Output format (text, html, markdown, jekyll, kotlin-website)")
- var outputFormat: String = "html"
-
- @set:Argument(value = "module", description = "Name of the documentation module")
- var moduleName: String = ""
-
- @set:Argument(value = "classpath", description = "Classpath for symbol resolution")
- var classpath: String = ""
-
- @set:Argument(value = "nodeprecated", description = "Exclude deprecated members from documentation")
- var nodeprecated: Boolean = false
-
- @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 = ""
-
- @set:Argument(value = "packageOptions", description = "List of package options in format \"prefix,-deprecated,-privateApi,+warnUndocumented,+suppress;...\" ")
- var packageOptions: String = ""
-
- @set:Argument(value = "links", description = "External documentation links in format url^packageListUrl^^url2...")
- var links: String = ""
-
- @set:Argument(value = "noStdlibLink", description = "Disable documentation link to stdlib")
- var noStdlibLink: Boolean = false
-
- @set:Argument(value = "cacheRoot", description = "Path to cache folder, or 'default' to use ~/.cache/dokka, if not provided caching is disabled")
- var cacheRoot: String? = null
-
- @set:Argument(value = "languageVersion", description = "Language Version to pass to Kotlin Analysis")
- var languageVersion: String? = null
-
- @set:Argument(value = "apiVersion", description = "Kotlin Api Version to pass to Kotlin Analysis")
- var apiVersion: String? = null
-
+open class GlobalArguments(parser: DokkaArgumentsParser) : DokkaConfiguration {
+ override val outputDir: String by parser.stringOption(
+ listOf("-output"),
+ "Output directory path",
+ "")
+
+ override val format: String by parser.stringOption(
+ listOf("-format"),
+ "Output format (text, html, markdown, jekyll, kotlin-website)",
+ "")
+
+ override val generateIndexPages: Boolean by parser.singleFlag(
+ listOf("-generateIndexPages"),
+ "Generate index page"
+ )
+
+ override val cacheRoot: String? by parser.stringOption(
+ listOf("-cacheRoot"),
+ "Path to cache folder, or 'default' to use ~/.cache/dokka, if not provided caching is disabled",
+ null)
+
+ override val impliedPlatforms: List<String> by parser.repeatableOption(
+ listOf("-impliedPlatforms"),
+ "List of implied platforms (comma-separated)"
+ )
+
+ override val passesConfigurations: List<Arguments> by parser.repeatableFlag(
+ listOf("-pass"),
+ "Single dokka pass"
+ ) {
+ Arguments(parser)
+ }
}
+class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfiguration {
+ override val moduleName: String by parser.stringOption(
+ listOf("-module"),
+ "Name of the documentation module",
+ "")
+
+ override val classpath: List<String> by parser.repeatableOption(
+ listOf("-classpath"),
+ "Classpath for symbol resolution"
+ )
+
+ override val sourceRoots: List<DokkaConfiguration.SourceRoot> by parser.repeatableOption(
+ listOf("-src"),
+ "Source file or directory (allows many paths separated by the system path separator)"
+ ) { SourceRootImpl.parseSourceRoot(it) }
+
+ override val samples: List<String> by parser.repeatableOption(
+ listOf("-samples"),
+ "Source root for samples"
+ )
+
+ override val includes: List<String> by parser.repeatableOption(
+ listOf("-include"),
+ "Markdown files to load (allows many paths separated by the system path separator)"
+ )
+
+ override val includeNonPublic: Boolean by parser.singleFlag(
+ listOf("-includeNonPublic"),
+ "Include non public")
+
+ override val includeRootPackage: Boolean by parser.singleFlag(
+ listOf("-includeRootPackage"),
+ "Include non public")
+
+ override val reportUndocumented: Boolean by parser.singleFlag(
+ listOf("-reportUndocumented"),
+ "Include non public")
+
+ override val skipEmptyPackages: Boolean by parser.singleFlag(
+ listOf("-skipEmptyPackages"),
+ "Include non public")
+
+ override val skipDeprecated: Boolean by parser.singleFlag(
+ listOf("-skipDeprecated"),
+ "Include non public")
+
+ override val jdkVersion: Int by parser.singleOption(
+ listOf("jdkVersion"),
+ "Version of JDK to use for linking to JDK JavaDoc",
+ { it.toInt() },
+ { 6 }
+ )
+
+ override val languageVersion: String? by parser.stringOption(
+ listOf("-languageVersion"),
+ "Language Version to pass to Kotlin Analysis",
+ null)
+
+ override val apiVersion: String? by parser.stringOption(
+ listOf("-apiVesion"),
+ "Kotlin Api Version to pass to Kotlin Analysis",
+ null
+ )
+
+ override val noStdlibLink: Boolean by parser.singleFlag(
+ listOf("-noStdlibLink"),
+ "Disable documentation link to stdlib")
+
+ override val noJdkLink: Boolean by parser.singleFlag(
+ listOf("-noJdkLink"),
+ "Disable documentation link to stdlib")
+
+ override val suppressedFiles: List<String> by parser.repeatableOption(
+ listOf("-suppresedFiles"),
+ ""
+ )
+
+ override val collectInheritedExtensionsFromLibraries: Boolean by parser.singleFlag(
+ listOf("-collectInheritedExtensionsFromLibraries"),
+ "Search for applicable extensions in libraries")
+
+ override val analysisPlatform: Platform by parser.singleOption(
+ listOf("-analysisPlatform"),
+ "Platform for analysis",
+ { Platform.fromString(it) },
+ { Platform.DEFAULT }
+ )
+
+ override val targets: List<String> by parser.repeatableOption(
+ listOf("-targets"),
+ "Generation targets"
+ )
+
+
+
+ override val sourceLinks: MutableList<DokkaConfiguration.SourceLinkDefinition> = mutableListOf()
+
+ override val perPackageOptions: MutableList<DokkaConfiguration.PackageOptions> = mutableListOf()
+
+ override val externalDocumentationLinks: MutableList<DokkaConfiguration.ExternalDocumentationLink> = mutableListOf()
+}