aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/build.gradle2
-rw-r--r--core/src/main/kotlin/DokkaBootstrapImpl.kt76
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt13
-rw-r--r--settings.gradle12
4 files changed, 96 insertions, 7 deletions
diff --git a/core/build.gradle b/core/build.gradle
index ea1ab325..20ff8760 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -21,7 +21,7 @@ allprojects {
}
dependencies {
-// compile project(":integration")
+ compile project(":integration")
compile project(path: ":coreDependencies", configuration: "shadow")
compile "org.jetbrains.kotlin:kotlin-stdlib:$bundled_kotlin_compiler_version"
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt
new file mode 100644
index 00000000..b48b62d4
--- /dev/null
+++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt
@@ -0,0 +1,76 @@
+package org.jetbrains.dokka
+
+import com.google.gson.Gson
+import org.jetbrains.dokka.DokkaConfiguration.PackageOptions
+
+import java.util.function.BiConsumer
+
+
+fun parsePerPackageOptions(arg: String): List<PackageOptions> {
+ if (arg.isBlank()) return emptyList()
+
+ return arg.split(";").map { it.split(",") }.map {
+ val prefix = it.first()
+ if (prefix == "")
+ throw IllegalArgumentException("Please do not register packageOptions with all match pattern, use global settings instead")
+ val args = it.subList(1, it.size)
+ val deprecated = args.find { it.endsWith("deprecated") }?.startsWith("+") ?: true
+ val reportUndocumented = args.find { it.endsWith("warnUndocumented") }?.startsWith("+") ?: true
+ val privateApi = args.find { it.endsWith("privateApi") }?.startsWith("+") ?: false
+ val suppress = args.find { it.endsWith("suppress") }?.startsWith("+") ?: false
+ PackageOptionsImpl(prefix, includeNonPublic = privateApi, reportUndocumented = reportUndocumented, skipDeprecated = !deprecated, suppress = suppress)
+ }
+}
+
+class DokkaBootstrapImpl : DokkaBootstrap {
+
+ private class DokkaProxyLogger(val consumer: BiConsumer<String, String>) : DokkaLogger {
+ override fun info(message: String) {
+ consumer.accept("info", message)
+ }
+
+ override fun warn(message: String) {
+ consumer.accept("warn", message)
+ }
+
+ override fun error(message: String) {
+ consumer.accept("error", message)
+ }
+ }
+
+ lateinit var generator: DokkaGenerator
+ val gson = Gson()
+
+ fun configure(logger: DokkaLogger, configuration: DokkaConfigurationImpl) = with(configuration) {
+
+ fun defaultLinks(config: PassConfigurationImpl): List<ExternalDocumentationLinkImpl> {
+ val links = mutableListOf<ExternalDocumentationLinkImpl>()
+ if (!config.noJdkLink)
+ links += DokkaConfiguration.ExternalDocumentationLink
+ .Builder("https://docs.oracle.com/javase/${config.jdkVersion}/docs/api/")
+ .build() as ExternalDocumentationLinkImpl
+
+ if (!config.noStdlibLink)
+ links += DokkaConfiguration.ExternalDocumentationLink
+ .Builder("https://kotlinlang.org/api/latest/jvm/stdlib/")
+ .build() as ExternalDocumentationLinkImpl
+ return links
+ }
+
+ val configurationWithLinks =
+ configuration.copy(passesConfigurations =
+ passesConfigurations
+ .map {
+ val links: List<ExternalDocumentationLinkImpl> = it.externalDocumentationLinks + defaultLinks(it)
+ it.copy(externalDocumentationLinks = links)
+ }
+ )
+
+ generator = DokkaGenerator(configurationWithLinks, logger)
+ }
+
+ override fun configure(logger: BiConsumer<String, String>, serializedConfigurationJSON: String)
+ = configure(DokkaProxyLogger(logger), gson.fromJson(serializedConfigurationJSON, DokkaConfigurationImpl::class.java))
+
+ override fun generate() = generator.generate()
+}
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt
new file mode 100644
index 00000000..abb6f069
--- /dev/null
+++ b/core/src/main/kotlin/DokkaGenerator.kt
@@ -0,0 +1,13 @@
+package org.jetbrains.dokka
+
+class DokkaGenerator(
+ private val configurationWithLinks: DokkaConfiguration,
+ private val logger: DokkaLogger
+) {
+ fun generate() {
+ println("RUNNED")
+ logger.error("runned")
+ throw AssertionError()
+ }
+
+}
diff --git a/settings.gradle b/settings.gradle
index ff416c98..c793bd79 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -2,12 +2,12 @@ rootProject.name = "dokka"
include 'core',
// 'core:testApi',
- 'coreDependencies'//,
-// 'integration',
+ 'coreDependencies',
+ 'integration',
// 'integration-tests:gradle-integration-tests',
-// 'runners:fatjar',
-// 'runners:ant',
-// 'runners:cli',
+ 'runners:fatjar',
+ 'runners:ant',
+ 'runners:cli',
// 'runners:maven-plugin',
-// 'runners:gradle-plugin',
+ 'runners:gradle-plugin'
// 'plugins:javadoc8'