From 907fd7a6447c1b1457e407ecac56669a9a3a4d3f Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Tue, 11 Oct 2022 19:40:25 +0200 Subject: [PATCH 1/3] apply kotlin-dsl plugin, update code to use idiomatic Gradle API (closer matching usage in gradle.kts files) --- runners/gradle-plugin/build.gradle.kts | 1 + .../dokka/gradle/AbstractDokkaLeafTask.kt | 20 ++++++------ .../dokka/gradle/gradleConfigurations.kt | 13 ++++---- .../org/jetbrains/dokka/gradle/utils.kt | 5 +-- .../gradle/AbstractDokkaParentTaskTest.kt | 4 +-- .../ConfigureWithKotlinSourceSetGistTest.kt | 6 ++-- .../dokka/gradle/DokkaCollectorTaskTest.kt | 32 +++++++++++-------- .../gradle/DokkaConfigurationJsonTest.kt | 27 ++++++++-------- .../DokkaConfigurationSerializableTest.kt | 26 +++++++-------- .../dokka/gradle/DokkaMultiModuleTaskTest.kt | 16 +++++----- .../jetbrains/dokka/gradle/DokkaTaskTest.kt | 6 ++-- .../gradle/GradleDokkaSourceSetBuilderTest.kt | 10 +++--- .../KotlinDslDokkaTaskConfigurationTest.kt | 8 ++--- .../dokka/gradle/KotlinSourceSetGistTest.kt | 4 +-- 14 files changed, 91 insertions(+), 87 deletions(-) diff --git a/runners/gradle-plugin/build.gradle.kts b/runners/gradle-plugin/build.gradle.kts index 2a61294fd4..d10f77cd0e 100644 --- a/runners/gradle-plugin/build.gradle.kts +++ b/runners/gradle-plugin/build.gradle.kts @@ -3,6 +3,7 @@ import org.jetbrains.* plugins { `java-gradle-plugin` + `kotlin-dsl` id("com.gradle.plugin-publish") version "0.20.0" } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt index 412695ec74..6e34676ca3 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaLeafTask.kt @@ -4,6 +4,7 @@ import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.internal.plugins.DslObject import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Nested +import org.gradle.kotlin.dsl.container import org.gradle.work.DisableCachingByDefault @DisableCachingByDefault(because = "Abstract super-class, not to be instantiated directly") @@ -11,15 +12,14 @@ abstract class AbstractDokkaLeafTask : AbstractDokkaTask() { @get:Internal val dokkaSourceSets: NamedDomainObjectContainer = - project.container(GradleDokkaSourceSetBuilder::class.java, gradleDokkaSourceSetBuilderFactory()) - .also { container -> - DslObject(this).extensions.add("dokkaSourceSets", container) - project.kotlinOrNull?.sourceSets?.all { kotlinSourceSet -> - container.register(kotlinSourceSet.name) { dokkaSourceSet -> - dokkaSourceSet.configureWithKotlinSourceSet(kotlinSourceSet) - } + project.container(GradleDokkaSourceSetBuilder::class, gradleDokkaSourceSetBuilderFactory()).also { container -> + DslObject(this).extensions.add("dokkaSourceSets", container) + project.kotlinOrNull?.sourceSets?.all sourceSet@{ + container.register(name) { + configureWithKotlinSourceSet(this@sourceSet) } } + } /** * Only contains source sets that are marked with `isDocumented`. @@ -29,7 +29,7 @@ abstract class AbstractDokkaLeafTask : AbstractDokkaTask() { @get:Nested protected val unsuppressedSourceSets: List get() = dokkaSourceSets - .toList() - .also(::checkSourceSetDependencies) - .filterNot { it.suppress.getSafe() } + .toList() + .also(::checkSourceSetDependencies) + .filterNot { it.suppress.getSafe() } } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/gradleConfigurations.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/gradleConfigurations.kt index 7b924b7588..86dd37160f 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/gradleConfigurations.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/gradleConfigurations.kt @@ -4,17 +4,18 @@ import org.gradle.api.Project import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.Dependency import org.gradle.api.attributes.Usage +import org.gradle.kotlin.dsl.named internal fun Project.maybeCreateDokkaDefaultPluginConfiguration(): Configuration { return configurations.maybeCreate("dokkaPlugin") { - attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, "java-runtime")) + attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_RUNTIME)) isCanBeConsumed = false } } internal fun Project.maybeCreateDokkaDefaultRuntimeConfiguration(): Configuration { return configurations.maybeCreate("dokkaRuntime") { - attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, "java-runtime")) + attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_RUNTIME)) isCanBeConsumed = false } } @@ -22,7 +23,7 @@ internal fun Project.maybeCreateDokkaDefaultRuntimeConfiguration(): Configuratio internal fun Project.maybeCreateDokkaPluginConfiguration(dokkaTaskName: String, additionalDependencies: Collection = emptySet()): Configuration { return project.configurations.maybeCreate("${dokkaTaskName}Plugin") { extendsFrom(maybeCreateDokkaDefaultPluginConfiguration()) - attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, "java-runtime")) + attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_RUNTIME)) isCanBeConsumed = false dependencies.add(project.dokkaArtifacts.dokkaAnalysis) // compileOnly in base plugin dependencies.add(project.dokkaArtifacts.dokkaBase) @@ -33,10 +34,10 @@ internal fun Project.maybeCreateDokkaPluginConfiguration(dokkaTaskName: String, internal fun Project.maybeCreateDokkaRuntimeConfiguration(dokkaTaskName: String): Configuration { return project.configurations.maybeCreate("${dokkaTaskName}Runtime") { extendsFrom(maybeCreateDokkaDefaultRuntimeConfiguration()) - attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, "java-runtime")) + attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_RUNTIME)) isCanBeConsumed = false - defaultDependencies { dependencies -> - dependencies.add(project.dokkaArtifacts.dokkaCore) + defaultDependencies { + add(project.dokkaArtifacts.dokkaCore) } } } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt index 1c0c80800b..0f2482dbb6 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt @@ -6,6 +6,7 @@ import org.gradle.api.UnknownDomainObjectException import org.gradle.api.provider.HasMultipleValues import org.gradle.api.provider.Property import org.gradle.api.provider.Provider +import org.gradle.kotlin.dsl.* import org.gradle.util.Path import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType @@ -31,13 +32,13 @@ internal fun parsePath(path: String): Path = Path.path(path) internal val Project.kotlinOrNull: KotlinProjectExtension? get() = try { - project.extensions.findByType(KotlinProjectExtension::class.java) + project.extensions.findByType() } catch (e: NoClassDefFoundError) { null } internal val Project.kotlin: KotlinProjectExtension - get() = project.extensions.getByType(KotlinProjectExtension::class.java) + get() = project.extensions.getByType() internal fun Project.isAndroidProject() = try { project.extensions.getByName("android") diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTaskTest.kt index f0e0563711..c0ab4263dd 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTaskTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaParentTaskTest.kt @@ -18,8 +18,8 @@ class AbstractDokkaParentTaskTest { private val subSubproject0 = ProjectBuilder.builder().withName("subSubproject0").withParent(subproject0).build() init { - rootProject.subprojects { project -> - project.tasks.create("dokkaTask") + rootProject.subprojects { + tasks.create("dokkaTask") } } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt index c06a3992ba..c1e0c85b66 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/ConfigureWithKotlinSourceSetGistTest.kt @@ -95,9 +95,9 @@ class ConfigureWithKotlinSourceSetGistTest { mainSourceSet.kotlin.sourceDirectories.elements.get().map { it.asFile }.forEach { it.mkdirs() } /* Make sure to remove dependencies that cannot be resolved during test */ - project.configurations.configureEach { configuration -> - configuration.withDependencies { dependencies -> - dependencies.removeIf { dependency -> dependency !is FileCollectionDependency } + project.configurations.configureEach { + withDependencies { + removeIf { dependency -> dependency !is FileCollectionDependency } } } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTaskTest.kt index 6e9bef38b6..ec3bb9a418 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTaskTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTaskTest.kt @@ -4,6 +4,10 @@ import org.gradle.kotlin.dsl.create import org.gradle.kotlin.dsl.withType import org.gradle.testfixtures.ProjectBuilder import org.jetbrains.dokka.DokkaConfigurationImpl +import org.jetbrains.dokka.DokkaDefaults.cacheRoot +import org.jetbrains.dokka.DokkaDefaults.failOnWarning +import org.jetbrains.dokka.DokkaDefaults.moduleName +import org.jetbrains.dokka.DokkaDefaults.offlineMode import org.jetbrains.dokka.DokkaException import java.io.File import kotlin.test.Test @@ -19,25 +23,25 @@ class DokkaCollectorTaskTest { val childProject = ProjectBuilder.builder().withParent(rootProject).build() childProject.plugins.apply("org.jetbrains.kotlin.jvm") - rootProject.allprojects { project -> - project.plugins.apply("org.jetbrains.dokka") - project.tasks.withType().configureEach { task -> - task.plugins.withDependencies { dependencies -> dependencies.clear() } + rootProject.allprojects { + plugins.apply("org.jetbrains.dokka") + tasks.withType().configureEach { + plugins.withDependencies { clear() } } - project.tasks.withType().configureEach { task -> - task.dokkaSourceSets.configureEach { sourceSet -> - sourceSet.classpath.setFrom(emptyList()) + tasks.withType().configureEach { + dokkaSourceSets.configureEach { + classpath.setFrom(emptyList()) } } } val collectorTasks = rootProject.tasks.withType() - collectorTasks.configureEach { task -> - task.moduleName by "custom Module Name" - task.outputDirectory by File("customOutputDirectory") - task.cacheRoot by File("customCacheRoot") - task.failOnWarning by true - task.offlineMode by true + collectorTasks.configureEach { + moduleName by "custom Module Name" + outputDirectory by File("customOutputDirectory") + cacheRoot by File("customCacheRoot") + failOnWarning by true + offlineMode by true } assertTrue(collectorTasks.isNotEmpty(), "Expected at least one collector task") @@ -68,7 +72,7 @@ class DokkaCollectorTaskTest { fun `with no child tasks throws DokkaException`() { val project = ProjectBuilder.builder().build() val collectorTask = project.tasks.create("collector") - project.configurations.all { configuration -> configuration.withDependencies { it.clear() } } + project.configurations.all { withDependencies { clear() } } assertFailsWith { collectorTask.generateDocumentation() } } } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt index 877d3b37a7..e7cc35e4cc 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt @@ -5,6 +5,7 @@ package org.jetbrains.dokka.gradle import org.gradle.kotlin.dsl.withType import org.gradle.testfixtures.ProjectBuilder import org.jetbrains.dokka.* +import org.jetbrains.dokka.DokkaDefaults.reportUndocumented import java.io.File import java.net.URL import kotlin.test.Test @@ -17,9 +18,7 @@ class DokkaConfigurationJsonTest { val project = ProjectBuilder.builder().build() project.plugins.apply("org.jetbrains.dokka") val dokkaTask = project.tasks.withType().first() - dokkaTask.plugins.withDependencies { dependencies -> - dependencies.clear() - } + dokkaTask.plugins.withDependencies { clear() } dokkaTask.apply { this.failOnWarning by true this.offlineMode by true @@ -27,19 +26,19 @@ class DokkaConfigurationJsonTest { this.cacheRoot by File("customCacheRoot") this.pluginsConfiguration.add(PluginConfigurationImpl("A", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value1" } """)) this.pluginsConfiguration.add(PluginConfigurationImpl("B", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value2" } """)) - this.dokkaSourceSets.create("main") { sourceSet -> - sourceSet.displayName by "customSourceSetDisplayName" - sourceSet.reportUndocumented by true + this.dokkaSourceSets.create("main") { + displayName by "customSourceSetDisplayName" + reportUndocumented by true - sourceSet.externalDocumentationLink { link -> - link.packageListUrl by URL("http://some.url") - link.url by URL("http://some.other.url") + externalDocumentationLink { + packageListUrl by URL("http://some.url") + url by URL("http://some.other.url") } - sourceSet.perPackageOption { packageOption -> - packageOption.includeNonPublic by true - packageOption.reportUndocumented by true - packageOption.skipDeprecated by true - packageOption.documentedVisibilities by setOf(DokkaConfiguration.Visibility.PRIVATE) + perPackageOption { + includeNonPublic by true + reportUndocumented by true + skipDeprecated by true + documentedVisibilities by setOf(DokkaConfiguration.Visibility.PRIVATE) } } } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt index 811f7736b5..bcd7cd4e86 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt @@ -25,9 +25,7 @@ class DokkaConfigurationSerializableTest { val project = ProjectBuilder.builder().build() project.plugins.apply("org.jetbrains.dokka") val dokkaTask = project.tasks.withType().first() - dokkaTask.plugins.withDependencies { dependencies -> - dependencies.clear() - } + dokkaTask.plugins.withDependencies { clear() } dokkaTask.apply { this.failOnWarning by true this.offlineMode by true @@ -35,20 +33,20 @@ class DokkaConfigurationSerializableTest { this.cacheRoot by File("customCacheRoot") this.pluginsConfiguration.add(PluginConfigurationImpl("A", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value1" } """)) this.pluginsConfiguration.add(PluginConfigurationImpl("B", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value2" } """)) - this.dokkaSourceSets.create("main") { sourceSet -> - sourceSet.displayName by "customSourceSetDisplayName" - sourceSet.reportUndocumented by true + this.dokkaSourceSets.create("main") { + displayName by "customSourceSetDisplayName" + reportUndocumented by true - sourceSet.externalDocumentationLink { link -> - link.packageListUrl by URL("http://some.url") - link.url by URL("http://some.other.url") + externalDocumentationLink { + packageListUrl by URL("http://some.url") + url by URL("http://some.other.url") } - sourceSet.perPackageOption { packageOption -> - packageOption.includeNonPublic by true - packageOption.reportUndocumented by true - packageOption.skipDeprecated by true - packageOption.documentedVisibilities by setOf(DokkaConfiguration.Visibility.PRIVATE) + perPackageOption { + includeNonPublic by true + reportUndocumented by true + skipDeprecated by true + documentedVisibilities by setOf(DokkaConfiguration.Visibility.PRIVATE) } } } diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt index 6e851326e0..c817e6b4b7 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt @@ -26,9 +26,9 @@ class DokkaMultiModuleTaskTest { } init { - rootProject.allprojects { project -> - project.tasks.withType().configureEach { task -> - task.plugins.withDependencies { dependencies -> dependencies.clear() } + rootProject.allprojects { + tasks.withType().configureEach { + plugins.withDependencies { clear() } } } } @@ -56,7 +56,7 @@ class DokkaMultiModuleTaskTest { dokkaSourceSets.create("main") dokkaSourceSets.create("test") dokkaSourceSets.configureEach { - it.includes.from(include1, include2) + includes.from(include1, include2) } } @@ -135,7 +135,7 @@ class DokkaMultiModuleTaskTest { fun `multimodule task with no child tasks throws DokkaException`() { val project = ProjectBuilder.builder().build() val multimodule = project.tasks.create("multimodule") - project.configurations.configureEach { it.withDependencies { it.clear() } } + project.configurations.configureEach { withDependencies { clear() } } assertFailsWith { multimodule.generateDocumentation() } } @@ -147,17 +147,17 @@ class DokkaMultiModuleTaskTest { childDokkaTask.apply { dokkaSourceSets.create("main") { - it.includes.from(childDokkaTaskInclude1, childDokkaTaskInclude2) + includes.from(childDokkaTaskInclude1, childDokkaTaskInclude2) } dokkaSourceSets.create("main2") { - it.includes.from(childDokkaTaskInclude3) + includes.from(childDokkaTaskInclude3) } } val secondChildDokkaTaskInclude = childProject.file("include4") val secondChildDokkaTask = childProject.tasks.create("secondChildDokkaTask") { dokkaSourceSets.create("main") { - it.includes.from(secondChildDokkaTaskInclude) + includes.from(secondChildDokkaTaskInclude) } } multiModuleTask.addChildTask(secondChildDokkaTask) diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaTaskTest.kt index 546a59dbdd..651cbc93ac 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaTaskTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaTaskTest.kt @@ -11,12 +11,12 @@ class DokkaTaskTest { fun `no suppressed source sets are present after in built configuration`() { val project = ProjectBuilder.builder().build() val task = project.tasks.create("dokkaTask") - project.configurations.all { configuration -> configuration.withDependencies { it.clear() } } + project.configurations.all { withDependencies { clear() } } task.dokkaSourceSets.register("main") task.dokkaSourceSets.register("jvm") task.dokkaSourceSets.register("test") { - it.suppress by true + suppress by true } assertEquals( @@ -30,7 +30,7 @@ class DokkaTaskTest { fun `module version is not present if not specified`(){ val project = ProjectBuilder.builder().build() val task = project.tasks.create("dokkaTask") - project.configurations.all { configuration -> configuration.withDependencies { it.clear() } } + project.configurations.all { withDependencies { clear() } } task.dokkaSourceSets.register("main") assertNull(task.buildDokkaConfiguration().moduleVersion) diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt index 9babeefdcd..0247a82f92 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt @@ -226,9 +226,9 @@ class GradleDokkaSourceSetBuilderTest { }) sourceSet.sourceLink { - it.remoteLineSuffix by "ls2" - it.localDirectory by project.file("p2") - it.remoteUrl by URL("https://u2") + remoteLineSuffix by "ls2" + localDirectory by project.file("p2") + remoteUrl by URL("https://u2") } sourceSet.sourceLink(project.closureOf { @@ -270,7 +270,7 @@ class GradleDokkaSourceSetBuilderTest { }) sourceSet.perPackageOption { - it.matchingRegex by "p2.*" + matchingRegex by "p2.*" } sourceSet.perPackageOption(project.closureOf { @@ -312,7 +312,7 @@ class GradleDokkaSourceSetBuilderTest { ) sourceSet.externalDocumentationLink { - it.url by URL("https://u2") + url by URL("https://u2") } sourceSet.externalDocumentationLink(project.closureOf { diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt index 9c788a0169..89d1b6dd4a 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinDslDokkaTaskConfigurationTest.kt @@ -14,7 +14,7 @@ class KotlinDslDokkaTaskConfigurationTest { val project = ProjectBuilder.builder().build() project.plugins.apply("org.jetbrains.dokka") project.tasks.withType().configureEach { - it.outputDirectory by File("test") + outputDirectory by File("test") } project.tasks.withType(DokkaTask::class.java).forEach { dokkaTask -> @@ -31,7 +31,7 @@ class KotlinDslDokkaTaskConfigurationTest { dokkaTask.dokkaSourceSets.run { val commonMain = create("commonMain") val jvmMain = create("jvmMain") { - it.dependsOn("commonMain") + dependsOn("commonMain") } assertEquals( @@ -65,7 +65,7 @@ class KotlinDslDokkaTaskConfigurationTest { dokkaSourceSets.run { val commonMain = create("commonMain") val jvmMain = create("jvmMain") { - it.dependsOn(commonMain) + dependsOn(commonMain) } assertEquals( @@ -86,7 +86,7 @@ class KotlinDslDokkaTaskConfigurationTest { project.tasks.withType(DokkaTask::class.java).first().apply { dokkaSourceSets.run { val special = create("special") { - it.dependsOn(kotlin.sourceSets.getByName("main")) + dependsOn(kotlin.sourceSets.getByName("main")) } assertEquals( diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt index bf3da6efda..dcb537dd5f 100644 --- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt +++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/KotlinSourceSetGistTest.kt @@ -117,8 +117,8 @@ class KotlinSourceSetGistTest { /* Only work with file dependencies */ project.configurations.forEach { configuration -> - configuration.withDependencies { dependencies -> - dependencies.removeIf { dependency -> + configuration.withDependencies { + removeIf { dependency -> dependency !is FileCollectionDependency } } From 0994afb730792f994603f8cdee9067dca95925a8 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Wed, 1 Feb 2023 10:59:35 +0100 Subject: [PATCH 2/3] fix imports --- .../src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt index 8026677491..37ec66c13d 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt @@ -4,6 +4,8 @@ import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.Project import org.gradle.api.UnknownDomainObjectException import org.gradle.util.Path +import org.gradle.kotlin.dsl.findByType +import org.gradle.kotlin.dsl.getByType import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType import org.jetbrains.kotlin.gradle.plugin.KotlinTarget From 73b3ece53bfeb9bd342875b7a5aa268776c52a37 Mon Sep 17 00:00:00 2001 From: aSemy <897017+aSemy@users.noreply.github.com> Date: Tue, 21 Feb 2023 17:49:08 +0100 Subject: [PATCH 3/3] rm java-gradle-plugin (provided by kotlin-dsl) --- runners/gradle-plugin/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/runners/gradle-plugin/build.gradle.kts b/runners/gradle-plugin/build.gradle.kts index d10f77cd0e..2d4f510f40 100644 --- a/runners/gradle-plugin/build.gradle.kts +++ b/runners/gradle-plugin/build.gradle.kts @@ -2,7 +2,6 @@ import org.gradle.configurationcache.extensions.serviceOf import org.jetbrains.* plugins { - `java-gradle-plugin` `kotlin-dsl` id("com.gradle.plugin-publish") version "0.20.0" }