diff options
author | KrystianUjma <kujma@virtuslab.com> | 2019-05-07 12:36:26 +0200 |
---|---|---|
committer | KrystianUjma <kujma@virtuslab.com> | 2019-05-07 12:38:56 +0200 |
commit | d2777df57ac81a69ab78e982adda2cedcb2d5e8d (patch) | |
tree | fae74dba95cbb016a724b1c33495a286cb97cc66 /runners | |
parent | 34b6959e68d356a66330441398febaebc5e6c7bc (diff) | |
parent | fef60431fdbc9a59a537bdb83f180383b8fd9678 (diff) | |
download | dokka-d2777df57ac81a69ab78e982adda2cedcb2d5e8d.tar.gz dokka-d2777df57ac81a69ab78e982adda2cedcb2d5e8d.tar.bz2 dokka-d2777df57ac81a69ab78e982adda2cedcb2d5e8d.zip |
Merge branch 'multiplatform-support' of github.com:KrystianUjma/dokka into multiplatform-support
Diffstat (limited to 'runners')
7 files changed, 43 insertions, 14 deletions
diff --git a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt index 367b9257..2d79013e 100644 --- a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt +++ b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt @@ -7,6 +7,9 @@ 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> { override fun apply(project: Project) { DokkaVersion.loadFrom(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties")) @@ -15,6 +18,11 @@ open class DokkaAndroidPlugin : Plugin<Project> { moduleName = project.name outputDirectory = File(project.buildDir, "dokka").absolutePath } + project.tasks.withType(DokkaTask::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, "") + } } } diff --git a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle index 0f27d365..82215a44 100644 --- a/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle +++ b/runners/gradle-integration-tests/testData/androidLibDependsOnJavaLib/lib/build.gradle @@ -30,10 +30,11 @@ dependencies { } dokka { - dokkaFatJar = new File(dokka_fatjar) - - externalDocumentationLink { - url = new URL("https://example.com") - packageListUrl = file("$rootDir/package-list").toURI().toURL() + dokkaFatJar = files(dokka_fatjar) + configuration { + externalDocumentationLink { + url = new URL("https://example.com") + packageListUrl = file("$rootDir/package-list").toURI().toURL() + } } }
\ 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 a3116751..85e86748 100644 --- a/runners/gradle-integration-tests/testData/basic/build.gradle +++ b/runners/gradle-integration-tests/testData/basic/build.gradle @@ -35,6 +35,6 @@ dependencies { dokka { - dokkaFatJar = new File(dokka_fatjar) + dokkaFatJar = files(dokka_fatjar) classpath += files("$projectDir/classDir") }
\ 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 4627e8ef..f436afb4 100644 --- a/runners/gradle-integration-tests/testData/sourcesChange/build.gradle +++ b/runners/gradle-integration-tests/testData/sourcesChange/build.gradle @@ -35,5 +35,5 @@ dependencies { dokka { - dokkaFatJar = new File(dokka_fatjar) + dokkaFatJar = files(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 b7e859e1..d4eee4b2 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 @@ -14,6 +14,7 @@ import org.gradle.api.tasks.compile.AbstractCompile import org.jetbrains.dokka.DokkaBootstrap import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.DokkaConfiguration.SourceRoot +import org.jetbrains.dokka.Platform import org.jetbrains.dokka.ReflectDsl import org.jetbrains.dokka.ReflectDsl.isNotInstance import java.io.File @@ -49,7 +50,6 @@ open class DokkaTask : DefaultTask() { @Input var outputFormat: String = "html" - @OutputDirectory var outputDirectory: String = "" var dokkaRuntime: Configuration? = null @@ -61,7 +61,7 @@ open class DokkaTask : DefaultTask() { var sourceDirs: Iterable<File> = emptyList() @Input - var sourceRoots: MutableList<DokkaConfiguration.SourceRoot> = arrayListOf() + var sourceRoots: MutableList<SourceRoot> = arrayListOf() @Input var dokkaFatJar: Any = "org.jetbrains.dokka:dokka-fatjar:${DokkaVersion.version}" @@ -241,11 +241,14 @@ open class DokkaTask : DefaultTask() { passConfig.collectInheritedExtensionsFromLibraries = collectInheritedExtensionsFromLibraries passConfig.suppressedFiles = collectSuppressedFiles(passConfig.sourceRoots) passConfig.externalDocumentationLinks.addAll(externalDocumentationLinks) + if(passConfig.platform.isNotEmpty()){ + passConfig.analysisPlatform = Platform.fromString(passConfig.platform) + } return passConfig } - private fun collectSourceRoots(): List<DokkaConfiguration.SourceRoot> { + private fun collectSourceRoots(): List<SourceRoot> { val sourceDirs = when { sourceDirs.any() -> { logger.info("Dokka: Taking source directories provided by the user") @@ -262,6 +265,22 @@ open class DokkaTask : DefaultTask() { return sourceRoots + (sourceDirs?.toSourceRoots() ?: emptyList()) } + /** + * Needed for Gradle incremental build + */ + @OutputDirectory + fun getOutputDirectoryAsFile(): File = project.file(outputDirectory) + + /** + * Needed for Gradle incremental build + */ + @InputFiles + fun getInputFiles(): FileCollection { + val (_, tasksSourceRoots) = extractClasspathAndSourceRootsFromKotlinTasks() + return project.files(tasksSourceRoots.map { project.fileTree(it) }) + + project.files(collectSourceRoots().map { project.fileTree(File(it.path)) }) + } + companion object { const val COLORS_ENABLED_PROPERTY = "kotlin.colors.enabled" const val ABSTRACT_KOTLIN_COMPILE = "org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile" diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt index 50412734..fd889d78 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt @@ -41,6 +41,7 @@ open class GradlePassConfigurationImpl(@Transient val name: String = ""): PassCo override var suppressedFiles: List<String> = emptyList() override var collectInheritedExtensionsFromLibraries: Boolean = false override var analysisPlatform: Platform = Platform.DEFAULT + var platform: String = "" override var targets: List<String> = emptyList() override var sinceKotlin: String = "1.0" @@ -96,8 +97,8 @@ class GradleSourceLinkDefinitionImpl : SourceLinkDefinition { } class GradleExternalDocumentationLinkImpl : ExternalDocumentationLink { - override var url: URL = URL("") - override var packageListUrl: URL = URL("") + override var url: URL = URL("http://") + override var packageListUrl: URL = URL("http://") } class GradleDokkaConfigurationImpl: DokkaConfiguration { diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index cc661193..ca3a65fd 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -152,7 +152,7 @@ abstract class AbstractDokkaMojo : AbstractMojo() { @Parameter(required = true, defaultValue = "\${project.compileClasspathElements}") var classpath: List<String> = emptyList() - //todo remove + //TODO remove @Parameter(required = true, defaultValue = "\${project.compileSourceRoots}") var sourceDirectories: List<String> = emptyList() @Parameter(required = false, defaultValue = "6") @@ -207,7 +207,7 @@ abstract class AbstractDokkaMojo : AbstractMojo() { if(passConfig.platform.isNotEmpty()){ passConfig.analysisPlatform = Platform.fromString(passConfig.platform) } - // todo fix + // TODO fix passConfig.sourceRoots = sourceDirectories.map { val sourceRoot = SourceRoot() sourceRoot.path = it |