aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
Diffstat (limited to 'runners')
-rw-r--r--runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt38
-rw-r--r--runners/gradle-integration-tests/testData/androidApp/app/build.gradle3
-rw-r--r--runners/gradle-integration-tests/testData/androidAppJavadoc/app/build.gradle3
-rw-r--r--runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle3
-rw-r--r--runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle5
-rw-r--r--runners/gradle-integration-tests/testData/basic/build.gradle7
-rw-r--r--runners/gradle-integration-tests/testData/multiProjectSingleOut/build.gradle6
-rw-r--r--runners/gradle-integration-tests/testData/sourcesChange/build.gradle3
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt21
9 files changed, 59 insertions, 30 deletions
diff --git a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
index 2d79013e..5646a75f 100644
--- a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
+++ b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
@@ -1,27 +1,39 @@
package org.jetbrains.dokka.gradle
-import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.Input
+import org.gradle.util.GradleVersion
import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink.Builder
import org.jetbrains.dokka.DokkaConfiguration.SourceRoot
import java.io.File
-internal const val CONFIGURATION_EXTENSION_NAME = "configuration"
-internal const val MULTIPLATFORM_EXTENSION_NAME = "multiplatform"
-
-open class DokkaAndroidPlugin : Plugin<Project> {
+open class DokkaAndroidPlugin : DokkaPlugin() {
override fun apply(project: Project) {
- DokkaVersion.loadFrom(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties"))
- project.tasks.create("dokka", DokkaAndroidTask::class.java).apply {
- dokkaRuntime = project.configurations.create("dokkaRuntime")
- moduleName = project.name
- outputDirectory = File(project.buildDir, "dokka").absolutePath
+ DokkaVersion.loadFrom(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka.properties"))
+
+ val dokkaRuntimeConfiguration = project.configurations.create("dokkaRuntime")
+ val defaultDokkaRuntimeConfiguration = project.configurations.create("defaultDokkaRuntime")
+
+ defaultDokkaRuntimeConfiguration.defaultDependencies{ dependencies -> dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-fatjar:${DokkaVersion.version}")) }
+
+ if(GradleVersion.current() >= GradleVersion.version("4.10")) {
+ project.tasks.register("dokka", DokkaAndroidTask::class.java).configure {
+ it.moduleName = project.name
+ it.outputDirectory = File(project.buildDir, "dokka").absolutePath
+ }
+ } else {
+ project.tasks.create("dokka", DokkaAndroidTask::class.java).apply {
+ moduleName = project.name
+ outputDirectory = File(project.buildDir, "dokka").absolutePath
+ }
}
- project.tasks.withType(DokkaTask::class.java) { task ->
+
+ project.tasks.withType(DokkaAndroidTask::class.java) { task ->
val passConfiguration = project.container(GradlePassConfigurationImpl::class.java)
- task.extensions.add(MULTIPLATFORM_EXTENSION_NAME, passConfiguration)
- task.extensions.create(CONFIGURATION_EXTENSION_NAME, GradlePassConfigurationImpl::class.java, "")
+ task.multiplatform = passConfiguration
+ task.configuration = GradlePassConfigurationImpl()
+ task.dokkaRuntime = dokkaRuntimeConfiguration
+ task.defaultDokkaRuntime = defaultDokkaRuntimeConfiguration
}
}
}
diff --git a/runners/gradle-integration-tests/testData/androidApp/app/build.gradle b/runners/gradle-integration-tests/testData/androidApp/app/build.gradle
index 1555de9f..20f22f21 100644
--- a/runners/gradle-integration-tests/testData/androidApp/app/build.gradle
+++ b/runners/gradle-integration-tests/testData/androidApp/app/build.gradle
@@ -42,9 +42,10 @@ android {
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$test_kotlin_version"
+ defaultDokkaRuntime files(dokka_fatjar)
}
dokka {
- dokkaFatJar = new File(dokka_fatjar)
+ dokkaFatJar = dokka_fatjar
} \ No newline at end of file
diff --git a/runners/gradle-integration-tests/testData/androidAppJavadoc/app/build.gradle b/runners/gradle-integration-tests/testData/androidAppJavadoc/app/build.gradle
index 6a053a5e..0679ee89 100644
--- a/runners/gradle-integration-tests/testData/androidAppJavadoc/app/build.gradle
+++ b/runners/gradle-integration-tests/testData/androidAppJavadoc/app/build.gradle
@@ -41,10 +41,11 @@ android {
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$test_kotlin_version"
+ defaultDokkaRuntime files(dokka_fatjar)
}
dokka {
outputFormat = "javadoc"
- dokkaFatJar = new File(dokka_fatjar)
+ dokkaFatJar = dokka_fatjar
} \ No newline at end of file
diff --git a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle
index 82215a44..8706a076 100644
--- a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle
+++ b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle
@@ -27,10 +27,11 @@ android {
dependencies {
api(project(":jlib"))
+ defaultDokkaRuntime files(dokka_fatjar)
}
dokka {
- dokkaFatJar = files(dokka_fatjar)
+ dokkaFatJar = dokka_fatjar
configuration {
externalDocumentationLink {
url = new URL("https://example.com")
diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle
index ee68ba6d..a8e4db78 100644
--- a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle
+++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle
@@ -57,19 +57,20 @@ android {
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$test_kotlin_version"
+ defaultDokkaRuntime files(dokka_fatjar)
}
dokka {
outputDirectory = "$buildDir/dokka/all"
- dokkaFatJar = new File(dokka_fatjar)
+ dokkaFatJar = dokka_fatjar
}
task dokkaFullFlavourOnly(type: org.jetbrains.dokka.gradle.DokkaAndroidTask) {
kotlinTasks {
["compileFullReleaseKotlin"]
}
- dokkaFatJar = new File(dokka_fatjar)
+ dokkaFatJar = dokka_fatjar
outputDirectory = "$buildDir/dokka/fullOnly"
moduleName = "full"
} \ No newline at end of file
diff --git a/runners/gradle-integration-tests/testData/basic/build.gradle b/runners/gradle-integration-tests/testData/basic/build.gradle
index 85e86748..b6f85604 100644
--- a/runners/gradle-integration-tests/testData/basic/build.gradle
+++ b/runners/gradle-integration-tests/testData/basic/build.gradle
@@ -29,12 +29,15 @@ repositories {
}
dependencies {
+ defaultDokkaRuntime files(dokka_fatjar)
compile group: 'org.jetbrains.kotlin', name: 'kotlin-runtime', version: test_kotlin_version
compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: test_kotlin_version
}
dokka {
- dokkaFatJar = files(dokka_fatjar)
- classpath += files("$projectDir/classDir")
+ dokkaFatJar = dokka_fatjar
+ configuration {
+ classpath += "$projectDir/classDir"
+ }
} \ No newline at end of file
diff --git a/runners/gradle-integration-tests/testData/multiProjectSingleOut/build.gradle b/runners/gradle-integration-tests/testData/multiProjectSingleOut/build.gradle
index 4f561472..3ab2b220 100644
--- a/runners/gradle-integration-tests/testData/multiProjectSingleOut/build.gradle
+++ b/runners/gradle-integration-tests/testData/multiProjectSingleOut/build.gradle
@@ -22,11 +22,15 @@ subprojects {
}
}
+dependencies {
+ defaultDokkaRuntime files(dokka_fatjar)
+}
+
apply plugin: 'org.jetbrains.dokka'
dokka {
kotlinTasks {
[":subA:compileKotlin", ":subB:compileKotlin"]
}
- dokkaFatJar = new File(dokka_fatjar)
+ dokkaFatJar = dokka_fatjar
} \ No newline at end of file
diff --git a/runners/gradle-integration-tests/testData/sourcesChange/build.gradle b/runners/gradle-integration-tests/testData/sourcesChange/build.gradle
index f436afb4..880de5e5 100644
--- a/runners/gradle-integration-tests/testData/sourcesChange/build.gradle
+++ b/runners/gradle-integration-tests/testData/sourcesChange/build.gradle
@@ -29,11 +29,12 @@ repositories {
}
dependencies {
+ defaultDokkaRuntime files(dokka_fatjar)
compile group: 'org.jetbrains.kotlin', name: 'kotlin-runtime', version: test_kotlin_version
compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: test_kotlin_version
}
dokka {
- dokkaFatJar = files(dokka_fatjar)
+ dokkaFatJar = dokka_fatjar
} \ No newline at end of file
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
index 62a37249..fa2e690e 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
@@ -253,6 +253,7 @@ open class DokkaTask : DefaultTask() {
if (config.moduleName == "") {
config.moduleName = moduleName
}
+ config.classpath = (config.classpath as List<Any>).map { it.toString() } // Workaround for Groovy's GStringImpl
config.samples = config.samples.map { project.file(it).absolutePath }
config.includes = config.includes.map { project.file(it).absolutePath }
config.suppressedFiles += collectSuppressedFiles(config.sourceRoots)
@@ -263,18 +264,22 @@ open class DokkaTask : DefaultTask() {
return config
}
- /**
- * Needed for Gradle incremental build
- */
+ // Needed for Gradle incremental build
@OutputDirectory
fun getOutputDirectoryAsFile(): File = project.file(outputDirectory)
- /**
- * Needed for Gradle incremental build
- */
+ // Needed for Gradle incremental build
@InputFiles
- fun getInputFiles(): FileCollection =
- project.files(collectConfigurations().flatMap { it.sourceRoots }.map { project.fileTree(File(it.path)) })
+ fun getInputFiles(): FileCollection {
+ val config = collectConfigurations()
+ return project.files(config.flatMap { it.sourceRoots }.map { project.fileTree(File(it.path)) }) +
+ project.files(config.flatMap { it.includes }) +
+ project.files(config.flatMap { it.samples }.map { project.fileTree(File(it)) })
+ }
+
+ @Classpath
+ fun getInputClasspath(): FileCollection =
+ project.files((collectConfigurations().flatMap { it.classpath } as List<Any>).map { project.fileTree(File(it.toString())) })
companion object {
const val COLORS_ENABLED_PROPERTY = "kotlin.colors.enabled"