aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
Diffstat (limited to 'runners')
-rw-r--r--runners/android-gradle-plugin/build.gradle4
-rw-r--r--runners/ant/build.gradle4
-rw-r--r--runners/cli/build.gradle4
-rw-r--r--runners/cli/src/main/kotlin/cli/main.kt33
-rw-r--r--runners/gradle-integration-tests/build.gradle4
-rw-r--r--runners/gradle-plugin/build.gradle4
-rw-r--r--runners/gradle-plugin/src/main/kotlin/main.kt137
-rw-r--r--runners/maven-plugin/build.gradle4
8 files changed, 91 insertions, 103 deletions
diff --git a/runners/android-gradle-plugin/build.gradle b/runners/android-gradle-plugin/build.gradle
index 28b0cbb9..6126510b 100644
--- a/runners/android-gradle-plugin/build.gradle
+++ b/runners/android-gradle-plugin/build.gradle
@@ -13,8 +13,8 @@ sourceCompatibility = 1.8
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
- languageVersion = "1.2"
- apiVersion = "1.1"
+ languageVersion = language_version
+ apiVersion = language_version
jvmTarget = "1.8"
}
}
diff --git a/runners/ant/build.gradle b/runners/ant/build.gradle
index e7dcd441..216420c6 100644
--- a/runners/ant/build.gradle
+++ b/runners/ant/build.gradle
@@ -5,8 +5,8 @@ sourceCompatibility = 1.8
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
- languageVersion = "1.2"
- apiVersion = languageVersion
+ languageVersion = language_version
+ apiVersion = language_version
jvmTarget = "1.8"
}
}
diff --git a/runners/cli/build.gradle b/runners/cli/build.gradle
index 8b1c03a8..24db0b1e 100644
--- a/runners/cli/build.gradle
+++ b/runners/cli/build.gradle
@@ -4,8 +4,8 @@ sourceCompatibility = 1.8
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
- languageVersion = "1.2"
- apiVersion = languageVersion
+ languageVersion = language_version
+ apiVersion = language_version
jvmTarget = "1.8"
}
}
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt
index d67a9875..9e42d01a 100644
--- a/runners/cli/src/main/kotlin/cli/main.kt
+++ b/runners/cli/src/main/kotlin/cli/main.kt
@@ -1,9 +1,6 @@
package org.jetbrains.dokka
-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
@@ -57,7 +54,7 @@ class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfi
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) }
+ ) { SourceRootImpl(it) }
override val samples: List<String> by parser.repeatableOption(
listOf("-samples"),
@@ -121,9 +118,9 @@ class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfi
)
override val sinceKotlin: String by parser.stringOption(
- listOf("-sinceKotlin"),
- "Kotlin Api version to use as base version, if none specified",
- "1.0"
+ listOf("-sinceKotlin"),
+ "Kotlin Api version to use as base version, if none specified",
+ "1.0"
)
override val collectInheritedExtensionsFromLibraries: Boolean by parser.singleFlag(
@@ -154,19 +151,19 @@ class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfi
object MainKt {
fun parseLinks(links: String): List<ExternalDocumentationLink> {
val (parsedLinks, parsedOfflineLinks) = links.split("^^")
- .map { it.split("^").map { it.trim() }.filter { it.isNotBlank() } }
- .filter { it.isNotEmpty() }
- .partition { it.size == 1 }
+ .map { it.split("^").map { it.trim() }.filter { it.isNotBlank() } }
+ .filter { it.isNotEmpty() }
+ .partition { it.size == 1 }
return parsedLinks.map { (root) -> ExternalDocumentationLink.Builder(root).build() } +
parsedOfflineLinks.map { (root, packageList) ->
val rootUrl = URL(root)
val packageListUrl =
- try {
- URL(packageList)
- } catch (ex: MalformedURLException) {
- File(packageList).toURI().toURL()
- }
+ try {
+ URL(packageList)
+ } catch (ex: MalformedURLException) {
+ File(packageList).toURI().toURL()
+ }
ExternalDocumentationLink.Builder(rootUrl, packageListUrl).build()
}
}
@@ -206,8 +203,8 @@ object MainKt {
} catch (e: ClassNotFoundException) {
val classLoader = createClassLoaderWithTools()
classLoader.loadClass("org.jetbrains.dokka.MainKt")
- .methods.find { it.name == "entry" }!!
- .invoke(null, configuration)
+ .methods.find { it.name == "entry" }!!
+ .invoke(null, configuration)
}
}
@@ -220,7 +217,7 @@ object MainKt {
parseContext.cli.singleAction(
- listOf("-pckageOptions"),
+ listOf("-pckageOptions"),
"List of package passConfiguration in format \"prefix,-deprecated,-privateApi,+warnUndocumented,+suppress;...\" "
) {
configuration.passesConfigurations.last().perPackageOptions.addAll(parsePerPackageOptions(it))
diff --git a/runners/gradle-integration-tests/build.gradle b/runners/gradle-integration-tests/build.gradle
index 297a175a..2f08bdb8 100644
--- a/runners/gradle-integration-tests/build.gradle
+++ b/runners/gradle-integration-tests/build.gradle
@@ -7,8 +7,8 @@ sourceCompatibility = 1.8
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
- languageVersion = "1.2"
- apiVersion = "1.0"
+ languageVersion = language_version
+ apiVersion = language_version
jvmTarget = "1.8"
}
}
diff --git a/runners/gradle-plugin/build.gradle b/runners/gradle-plugin/build.gradle
index 8e59a7be..1c307588 100644
--- a/runners/gradle-plugin/build.gradle
+++ b/runners/gradle-plugin/build.gradle
@@ -12,8 +12,8 @@ sourceCompatibility = 1.8
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
- languageVersion = "1.2"
- apiVersion = "1.1"
+ languageVersion = language_version
+ apiVersion = language_version
jvmTarget = "1.8"
}
}
diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt
index f726c6c7..ef7bd41f 100644
--- a/runners/gradle-plugin/src/main/kotlin/main.kt
+++ b/runners/gradle-plugin/src/main/kotlin/main.kt
@@ -1,6 +1,8 @@
package org.jetbrains.dokka.gradle
import groovy.lang.Closure
+import kotlinx.serialization.*
+import kotlinx.serialization.json.Json
import org.gradle.api.Action
import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
@@ -17,8 +19,7 @@ import org.jetbrains.dokka.*
import org.jetbrains.dokka.ReflectDsl.isNotInstance
import org.jetbrains.dokka.gradle.ClassloaderContainer.fatJarClassLoader
import org.jetbrains.dokka.gradle.DokkaVersion.version
-import ru.yole.jkid.JsonExclude
-import ru.yole.jkid.serialization.serialize
+
import java.io.File
import java.io.InputStream
import java.io.Serializable
@@ -55,7 +56,6 @@ object ClassloaderContainer {
var fatJarClassLoader: ClassLoader? = null
}
-const val `deprecationMessage reportNotDocumented` = "Will be removed in 0.9.17, see dokka#243"
open class DokkaTask : DefaultTask() {
@@ -85,9 +85,6 @@ open class DokkaTask : DefaultTask() {
var outputDirectory: String = ""
var dokkaRuntime: Configuration? = null
- @Deprecated("Going to be removed in 0.9.16, use classpath + sourceDirs instead if kotlinTasks is not suitable for you")
- @Input var processConfigurations: List<Any?> = emptyList()
-
@InputFiles var classpath: Iterable<File> = arrayListOf()
@Input
@@ -110,15 +107,6 @@ open class DokkaTask : DefaultTask() {
@Input var includeNonPublic = false
@Input var skipDeprecated = false
@Input var skipEmptyPackages = true
-
- @Deprecated(`deprecationMessage reportNotDocumented`, replaceWith = ReplaceWith("reportUndocumented"))
- var reportNotDocumented
- get() = reportUndocumented
- set(value) {
- logger.warn("Dokka: reportNotDocumented is deprecated and " + `deprecationMessage reportNotDocumented`.decapitalize())
- reportUndocumented = value
- }
-
@Input var reportUndocumented = true
@Input var perPackageOptions: MutableList<PackageOptions> = arrayListOf()
@Input var impliedPlatforms: MutableList<String> = arrayListOf()
@@ -146,6 +134,9 @@ open class DokkaTask : DefaultTask() {
@get:Internal
internal val kotlinCompileBasedClasspathAndSourceRoots: ClasspathAndSourceRoots by lazy { extractClasspathAndSourceRootsFromKotlinTasks() }
+ @Optional @Input
+ var targets: List<String> = listOf()
+
private var kotlinTasksConfigurator: () -> List<Any?>? = { defaultKotlinTasks() }
private val kotlinTasks: List<Task> by lazy { extractKotlinCompileTasks() }
@@ -247,12 +238,12 @@ open class DokkaTask : DefaultTask() {
val tasksByPath = paths.map { taskContainer.findByPath(it as String) ?: throw IllegalArgumentException("Task with path '$it' not found") }
other
- .filter { it !is Task || it isNotInstance getAbstractKotlinCompileFor(it) }
- .forEach { throw IllegalArgumentException("Illegal entry in kotlinTasks, must be subtype of $ABSTRACT_KOTLIN_COMPILE or String, but was $it") }
+ .filter { it !is Task || it isNotInstance getAbstractKotlinCompileFor(it) }
+ .forEach { throw IllegalArgumentException("Illegal entry in kotlinTasks, must be subtype of $ABSTRACT_KOTLIN_COMPILE or String, but was $it") }
tasksByPath
- .filter { it == null || it isNotInstance getAbstractKotlinCompileFor(it) }
- .forEach { throw IllegalArgumentException("Illegal task path in kotlinTasks, must be subtype of $ABSTRACT_KOTLIN_COMPILE, but was $it") }
+ .filter { it == null || it isNotInstance getAbstractKotlinCompileFor(it) }
+ .forEach { throw IllegalArgumentException("Illegal task path in kotlinTasks, must be subtype of $ABSTRACT_KOTLIN_COMPILE, but was $it") }
return (tasksByPath + other) as List<Task>
@@ -275,9 +266,9 @@ open class DokkaTask : DefaultTask() {
val abstractKotlinCompileClz = getAbstractKotlinCompileFor(it)!!
val taskClasspath: Iterable<File> =
- (it["getClasspath", AbstractCompile::class].takeIfIsFunc()?.invoke()
- ?: it["compileClasspath", abstractKotlinCompileClz].takeIfIsProp()?.v()
- ?: it["getClasspath", abstractKotlinCompileClz]())
+ (it["getClasspath", AbstractCompile::class].takeIfIsFunc()?.invoke()
+ ?: it["compileClasspath", abstractKotlinCompileClz].takeIfIsProp()?.v()
+ ?: it["getClasspath", abstractKotlinCompileClz]())
if (taskClasspath is FileCollection) {
allClasspathFileCollection += taskClasspath
@@ -295,12 +286,14 @@ open class DokkaTask : DefaultTask() {
protected open fun collectSuppressedFiles(sourceRoots: List<SourceRoot>): List<String> = emptyList()
+ @ImplicitReflectionSerializer
@TaskAction
fun generate() {
if (dokkaRuntime == null){
dokkaRuntime = project.configurations.getByName("dokkaRuntime")
}
+
dokkaRuntime?.defaultDependencies{ dependencies -> dependencies.add(project.dependencies.create(dokkaFatJar)) }
val kotlinColorsEnabledBefore = System.getProperty(COLORS_ENABLED_PROPERTY) ?: "false"
System.setProperty(COLORS_ENABLED_PROPERTY, "false")
@@ -309,65 +302,73 @@ open class DokkaTask : DefaultTask() {
val (tasksClasspath, tasksSourceRoots) = kotlinCompileBasedClasspathAndSourceRoots
- val project = project
val sourceRoots = collectSourceRoots() + tasksSourceRoots.toSourceRoots()
-
if (sourceRoots.isEmpty()) {
logger.warn("No source directories found: skipping dokka generation")
return
}
- val fullClasspath = collectClasspathFromOldSources() + tasksClasspath + classpath
+ val fullClasspath = tasksClasspath + classpath
val bootstrapClass = fatJarClassLoader!!.loadClass("org.jetbrains.dokka.DokkaBootstrapImpl")
-
val bootstrapInstance = bootstrapClass.constructors.first().newInstance()
-
val bootstrapProxy: DokkaBootstrap = automagicTypedProxy(javaClass.classLoader, bootstrapInstance)
- TODO("Fix Configuration in Gradle")
- /*
- val configuration = SerializeOnlyDokkaConfiguration(
- moduleName,
- fullClasspath.map { it.absolutePath },
- sourceRoots,
- samples.filterNotNull().map { project.file(it).absolutePath },
- includes.filterNotNull().map { project.file(it).absolutePath },
+
+ val configuration = DokkaConfigurationImpl(
outputDirectory,
outputFormat,
- includeNonPublic,
- false,
- reportUndocumented,
- skipEmptyPackages,
- skipDeprecated,
- jdkVersion,
true,
- linkMappings,
+ cacheRoot,
impliedPlatforms,
- perPackageOptions,
- externalDocumentationLinks,
- noStdlibLink,
- noJdkLink,
- cacheRoot,
- collectSuppressedFiles(sourceRoots),
- languageVersion,
- apiVersion,
- collectInheritedExtensionsFromLibraries
+ listOf(PassConfigurationImpl(
+ classpath= fullClasspath.map { it.absolutePath },
+ sourceRoots = sourceRoots.map { SourceRootImpl(it.path) },
+ samples = samples.filterNotNull().map { project.file(it).absolutePath },
+ includes = includes.filterNotNull().map { project.file(it).absolutePath },
+ collectInheritedExtensionsFromLibraries = collectInheritedExtensionsFromLibraries,
+ perPackageOptions = perPackageOptions.map{PackageOptionsImpl(
+ prefix = it.prefix,
+ includeNonPublic = it.includeNonPublic,
+ reportUndocumented = it.reportUndocumented,
+ skipDeprecated = it.skipDeprecated,
+ suppress = it.suppress
+ )},
+ moduleName = moduleName,
+ includeNonPublic = includeNonPublic,
+ includeRootPackage = false,
+ reportUndocumented = reportUndocumented,
+ skipEmptyPackages = skipEmptyPackages,
+ skipDeprecated = skipDeprecated,
+ jdkVersion = jdkVersion,
+ languageVersion = languageVersion,
+ apiVersion = apiVersion,
+ noStdlibLink = noStdlibLink,
+ noJdkLink = noJdkLink,
+ suppressedFiles = collectSuppressedFiles(sourceRoots),
+ sinceKotlin = "1.0",
+ analysisPlatform = Platform.DEFAULT,
+ targets = targets,
+ sourceLinks = mutableListOf(), // TODO: check this line
+ externalDocumentationLinks = externalDocumentationLinks.map {
+ ExternalDocumentationLinkImpl(it.url, it.packageListUrl)
+ }
+ )
+ )
)
-
bootstrapProxy.configure(
- BiConsumer { level, message ->
- when (level) {
- "info" -> logger.info(message)
- "warn" -> logger.warn(message)
- "error" -> logger.error(message)
- }
- },
- serialize(configuration)
+ BiConsumer { level, message ->
+ when (level) {
+ "info" -> logger.info(message)
+ "warn" -> logger.warn(message)
+ "error" -> logger.error(message)
+ }
+ },
+ Json.stringify(configuration)
)
- */
+
bootstrapProxy.generate()
} finally {
@@ -375,15 +376,6 @@ open class DokkaTask : DefaultTask() {
}
}
- private fun collectClasspathFromOldSources(): List<File> {
-
- val allConfigurations = project.configurations
-
- val fromConfigurations =
- processConfigurations.flatMap { allConfigurations.getByName(it.toString()) }
-
- return fromConfigurations
- }
private fun collectSourceRoots(): List<SourceRoot> {
val sourceDirs = if (sourceDirs.any()) {
@@ -406,7 +398,7 @@ open class DokkaTask : DefaultTask() {
@Classpath
fun getInputClasspath(): FileCollection {
val (classpathFileCollection) = extractClasspathAndSourceRootsFromKotlinTasks()
- return project.files(collectClasspathFromOldSources() + classpath) + classpathFileCollection
+ return project.files(classpath) + classpathFileCollection
}
@InputFiles
@@ -431,6 +423,7 @@ open class DokkaTask : DefaultTask() {
null
}
}
+
}
class SourceRoot : DokkaConfiguration.SourceRoot, Serializable {
@@ -443,7 +436,6 @@ class SourceRoot : DokkaConfiguration.SourceRoot, Serializable {
}
open class LinkMapping : Serializable, DokkaConfiguration.SourceLinkDefinition {
- @JsonExclude
var dir: String
get() = path
set(value) {
@@ -455,7 +447,6 @@ open class LinkMapping : Serializable, DokkaConfiguration.SourceLinkDefinition {
override var path: String = ""
override var url: String = ""
- @JsonExclude
var suffix: String?
get() = lineSuffix
set(value) {
diff --git a/runners/maven-plugin/build.gradle b/runners/maven-plugin/build.gradle
index 2e9d0b1b..f8aaeba9 100644
--- a/runners/maven-plugin/build.gradle
+++ b/runners/maven-plugin/build.gradle
@@ -13,8 +13,8 @@ sourceCompatibility = 1.8
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
- languageVersion = "1.2"
- apiVersion = languageVersion
+ languageVersion = language_version
+ apiVersion = language_version
jvmTarget = "1.8"
}
}