From e01b9898db66721cfcd2b418c518a7784572b80e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Mendelski?= <mendelski.pawel@gmail.com> Date: Mon, 12 Dec 2022 22:39:50 +0100 Subject: [PATCH 1/2] Update gradle --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8fad3f5..f42e62f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 9104a38ce97425e2bdba38f24efa94528e5b9322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Mendelski?= <mendelski.pawel@gmail.com> Date: Tue, 13 Dec 2022 01:12:55 +0100 Subject: [PATCH 2/2] Remove left overs from idea plugin support --- .../integration/IdeaPluginConfiguration.kt | 23 --------- .../integration/IntegrationTestPlugin.kt | 1 - .../IntegrationTestTaskConfiguration.kt | 8 +-- .../integration/IdeaConfigurationTest.kt | 50 ------------------- 4 files changed, 4 insertions(+), 78 deletions(-) delete mode 100644 src/main/kotlin/com/coditory/gradle/integration/IdeaPluginConfiguration.kt delete mode 100644 src/test/kotlin/com/coditory/gradle/integration/IdeaConfigurationTest.kt diff --git a/src/main/kotlin/com/coditory/gradle/integration/IdeaPluginConfiguration.kt b/src/main/kotlin/com/coditory/gradle/integration/IdeaPluginConfiguration.kt deleted file mode 100644 index a4137be..0000000 --- a/src/main/kotlin/com/coditory/gradle/integration/IdeaPluginConfiguration.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.coditory.gradle.integration - -import org.gradle.api.Project -import org.gradle.plugins.ide.idea.IdeaPlugin - -internal object IdeaPluginConfiguration { - fun apply(project: Project) { - applyIdeaPluginIfNeeded(project) - if (!project.plugins.hasPlugin(IdeaPlugin::class.java)) { - return - } - } - - private fun applyIdeaPluginIfNeeded(project: Project) { - if (project.plugins.hasPlugin(IdeaPlugin::class.java)) { - // IdeaPlugin already applied - return - } - if (project.rootProject.file(".idea").isDirectory) { - project.plugins.apply(IdeaPlugin::class.java) - } - } -} diff --git a/src/main/kotlin/com/coditory/gradle/integration/IntegrationTestPlugin.kt b/src/main/kotlin/com/coditory/gradle/integration/IntegrationTestPlugin.kt index 9a85432..2cf9b33 100644 --- a/src/main/kotlin/com/coditory/gradle/integration/IntegrationTestPlugin.kt +++ b/src/main/kotlin/com/coditory/gradle/integration/IntegrationTestPlugin.kt @@ -16,7 +16,6 @@ open class IntegrationTestPlugin : Plugin<Project> { IntegrationTestTaskConfiguration.apply(project) TestTaskConfiguration.apply(project) TestAllTaskConfiguration.apply(project) - IdeaPluginConfiguration.apply(project) } companion object { diff --git a/src/main/kotlin/com/coditory/gradle/integration/IntegrationTestTaskConfiguration.kt b/src/main/kotlin/com/coditory/gradle/integration/IntegrationTestTaskConfiguration.kt index 1abd81d..9ba7aeb 100644 --- a/src/main/kotlin/com/coditory/gradle/integration/IntegrationTestTaskConfiguration.kt +++ b/src/main/kotlin/com/coditory/gradle/integration/IntegrationTestTaskConfiguration.kt @@ -70,10 +70,10 @@ internal object IntegrationTestTaskConfiguration { } private fun configureKotlinCompilation(project: Project) { - val extension = project.extensions.getByType(KotlinJvmProjectExtension::class.java) - extension.target.compilations.getByName(INTEGRATION_CONFIG_PREFIX) { - val main = extension.target.compilations.getByName(SourceSet.TEST_SOURCE_SET_NAME) - it.associateWith(main) + val kotlin = project.extensions.getByType(KotlinJvmProjectExtension::class.java) + kotlin.target.compilations.getByName(INTEGRATION_CONFIG_PREFIX) { + val test = kotlin.target.compilations.getByName(SourceSet.TEST_SOURCE_SET_NAME) + it.associateWith(test) } } } diff --git a/src/test/kotlin/com/coditory/gradle/integration/IdeaConfigurationTest.kt b/src/test/kotlin/com/coditory/gradle/integration/IdeaConfigurationTest.kt deleted file mode 100644 index 599421e..0000000 --- a/src/test/kotlin/com/coditory/gradle/integration/IdeaConfigurationTest.kt +++ /dev/null @@ -1,50 +0,0 @@ -package com.coditory.gradle.integration - -import com.coditory.gradle.integration.base.TestProjectBuilder.Companion.project -import org.assertj.core.api.Assertions.assertThat -import org.gradle.api.Project -import org.gradle.plugins.ide.idea.IdeaPlugin -import org.junit.jupiter.api.Test -import java.io.File - -class IdeaConfigurationTest { - @Test - fun `should automatically apply idea plugin when there is idea folder`() { - // when - val project = project() - .withDirectory(".idea") - .withPlugins(IntegrationTestPlugin::class) - .build() - - // then - assertThat(hasIdeaPlugin(project)).isTrue() - } - - @Test - fun `should not apply idea plugin when there is no idea folder`() { - // when - val project = project() - .withPlugins(IntegrationTestPlugin::class) - .build() - - // then - assertThat(hasIdeaPlugin(project)).isFalse() - } - - private fun hasIdeaPlugin(project: Project): Boolean { - return project.plugins.hasPlugin(IdeaPlugin::class.java) - } - - @Suppress("unused") - private fun getIdeaPlugin(project: Project): IdeaPlugin { - return project.plugins.getPlugin(IdeaPlugin::class.java) - } - - @Suppress("unused") - private fun toIntegrationSrcFiles(project: Project, vararg paths: String): Set<File> { - return paths - .map { "${project.projectDir}/src/integration/$it" } - .map { File(it) } - .toSet() - } -}