From e90a0e5fcc78d9e9f075b4fe0a59c5b51f7ff371 Mon Sep 17 00:00:00 2001 From: Goooler Date: Wed, 4 Dec 2024 00:28:13 +0800 Subject: [PATCH] Revert "Add a new source set to share test kits (#1081)" This reverts commit 6c1920568d4c9c98ed5bb86ebf106a92ff63ef01. --- build.gradle.kts | 10 +--------- .../transformers/PropertiesFileTransformerSpec.groovy | 1 - .../shadow/transformers/TransformerSpecSupport.groovy | 3 +++ .../ApacheNoticeResourceTransformerTest.kt | 2 +- .../shadow/transformers/AppendingTransformerTest.kt | 2 +- .../transformers/ManifestAppenderTransformerTest.kt | 2 +- .../transformers/PropertiesFileTransformerTest.kt | 2 +- .../shadow/transformers/XmlAppendingTransformerTest.kt | 2 +- .../jengelman/gradle/plugins/shadow}/util/Utils.kt | 4 +--- 9 files changed, 10 insertions(+), 18 deletions(-) rename src/{testKit/kotlin/com/github/jengelman/gradle/plugins/shadow/testkit => test/kotlin/com/github/jengelman/gradle/plugins/shadow}/util/Utils.kt (65%) diff --git a/build.gradle.kts b/build.gradle.kts index bf84d0158..aa4265751 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -43,9 +43,6 @@ spotless { } } -val testKit: SourceSet by sourceSets.creating -val testKitImplementation: Configuration by configurations.getting - val intiTest: SourceSet by sourceSets.creating val intiTestImplementation: Configuration by configurations.getting { extendsFrom(configurations.testImplementation.get()) @@ -77,11 +74,6 @@ dependencies { implementation(libs.plexus.utils) implementation(libs.plexus.xml) - val mainOutput = sourceSets.main.map { it.output } - testKitImplementation(mainOutput) - testKitImplementation(gradleTestKit()) - - testImplementation(testKit.output) testImplementation(platform(libs.junit.bom)) testImplementation(libs.junit.jupiter) testImplementation(libs.assertk) @@ -93,7 +85,7 @@ dependencies { exclude(group = "org.codehaus.groovy") exclude(group = "org.hamcrest") } - funcTestImplementation(mainOutput) + funcTestImplementation(sourceSets.main.get().output) lintChecks(libs.androidx.gradlePluginLints) lintChecks(libs.assertk.lint) diff --git a/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/transformers/PropertiesFileTransformerSpec.groovy b/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/transformers/PropertiesFileTransformerSpec.groovy index 6fc067a6b..3bb3af5f6 100644 --- a/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/transformers/PropertiesFileTransformerSpec.groovy +++ b/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/transformers/PropertiesFileTransformerSpec.groovy @@ -22,7 +22,6 @@ package com.github.jengelman.gradle.plugins.shadow.transformers import com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer.MergeStrategy import spock.lang.Unroll -import static com.github.jengelman.gradle.plugins.shadow.testkit.util.Utils.testObjectFactory import static groovy.lang.Closure.IDENTITY @Unroll diff --git a/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/transformers/TransformerSpecSupport.groovy b/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/transformers/TransformerSpecSupport.groovy index 86978937c..f7f999eb0 100644 --- a/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/transformers/TransformerSpecSupport.groovy +++ b/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/transformers/TransformerSpecSupport.groovy @@ -4,11 +4,14 @@ import com.github.jengelman.gradle.plugins.shadow.ShadowStats import org.gradle.api.file.FileTreeElement import org.gradle.api.file.RelativePath import org.gradle.api.internal.file.DefaultFileTreeElement +import org.gradle.testfixtures.ProjectBuilder import spock.lang.Shared import spock.lang.Specification class TransformerSpecSupport extends Specification { + protected static final def testObjectFactory = ProjectBuilder.builder().build().objects + @Shared ShadowStats stats diff --git a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ApacheNoticeResourceTransformerTest.kt b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ApacheNoticeResourceTransformerTest.kt index f8cf651ff..05d013dbf 100644 --- a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ApacheNoticeResourceTransformerTest.kt +++ b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ApacheNoticeResourceTransformerTest.kt @@ -4,7 +4,7 @@ import assertk.assertThat import assertk.assertions.isFalse import assertk.assertions.isTrue import assertk.fail -import com.github.jengelman.gradle.plugins.shadow.testkit.util.testObjectFactory +import com.github.jengelman.gradle.plugins.shadow.util.testObjectFactory import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test diff --git a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/AppendingTransformerTest.kt b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/AppendingTransformerTest.kt index 681000705..b5eee7d89 100644 --- a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/AppendingTransformerTest.kt +++ b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/AppendingTransformerTest.kt @@ -3,7 +3,7 @@ package com.github.jengelman.gradle.plugins.shadow.transformers import assertk.assertThat import assertk.assertions.isFalse import assertk.assertions.isTrue -import com.github.jengelman.gradle.plugins.shadow.testkit.util.testObjectFactory +import com.github.jengelman.gradle.plugins.shadow.util.testObjectFactory import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test diff --git a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ManifestAppenderTransformerTest.kt b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ManifestAppenderTransformerTest.kt index 935c98da6..9c1e8c084 100644 --- a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ManifestAppenderTransformerTest.kt +++ b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ManifestAppenderTransformerTest.kt @@ -6,7 +6,7 @@ import assertk.assertions.isFalse import assertk.assertions.isGreaterThan import assertk.assertions.isNotEmpty import assertk.assertions.isTrue -import com.github.jengelman.gradle.plugins.shadow.testkit.util.testObjectFactory +import com.github.jengelman.gradle.plugins.shadow.util.testObjectFactory import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test diff --git a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/PropertiesFileTransformerTest.kt b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/PropertiesFileTransformerTest.kt index 81e084d43..3106cc9ba 100644 --- a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/PropertiesFileTransformerTest.kt +++ b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/PropertiesFileTransformerTest.kt @@ -6,7 +6,7 @@ import assertk.assertions.isEqualTo import assertk.assertions.isFalse import assertk.assertions.isNotEmpty import assertk.assertions.isTrue -import com.github.jengelman.gradle.plugins.shadow.testkit.util.testObjectFactory +import com.github.jengelman.gradle.plugins.shadow.util.testObjectFactory import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test diff --git a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/XmlAppendingTransformerTest.kt b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/XmlAppendingTransformerTest.kt index 32895d9fc..1eaf76436 100644 --- a/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/XmlAppendingTransformerTest.kt +++ b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/XmlAppendingTransformerTest.kt @@ -3,7 +3,7 @@ package com.github.jengelman.gradle.plugins.shadow.transformers import assertk.assertThat import assertk.assertions.isFalse import assertk.assertions.isTrue -import com.github.jengelman.gradle.plugins.shadow.testkit.util.testObjectFactory +import com.github.jengelman.gradle.plugins.shadow.util.testObjectFactory import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test diff --git a/src/testKit/kotlin/com/github/jengelman/gradle/plugins/shadow/testkit/util/Utils.kt b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/util/Utils.kt similarity index 65% rename from src/testKit/kotlin/com/github/jengelman/gradle/plugins/shadow/testkit/util/Utils.kt rename to src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/util/Utils.kt index 0785681b0..a6acfd481 100644 --- a/src/testKit/kotlin/com/github/jengelman/gradle/plugins/shadow/testkit/util/Utils.kt +++ b/src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/util/Utils.kt @@ -1,6 +1,4 @@ -@file:JvmName("Utils") - -package com.github.jengelman.gradle.plugins.shadow.testkit.util +package com.github.jengelman.gradle.plugins.shadow.util import org.gradle.api.model.ObjectFactory import org.gradle.testfixtures.ProjectBuilder