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..72a5e40c3 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 @@ -30,7 +29,7 @@ class PropertiesFileTransformerSpec extends TransformerSpecSupport { void "Path #path #transform transformed"() { given: - Transformer transformer = new PropertiesFileTransformer(testObjectFactory) + Transformer transformer = new PropertiesFileTransformer(objectFactory) when: boolean actual = transformer.canTransformResource(getFileElement(path)) @@ -50,7 +49,7 @@ class PropertiesFileTransformerSpec extends TransformerSpecSupport { void exerciseAllTransformConfigurations() { given: def element = getFileElement(path) - Transformer transformer = new PropertiesFileTransformer(testObjectFactory) + Transformer transformer = new PropertiesFileTransformer(objectFactory) transformer.mergeStrategy.set(MergeStrategy.from(mergeStrategy)) transformer.mergeSeparator.set(mergeSeparator) @@ -74,7 +73,7 @@ class PropertiesFileTransformerSpec extends TransformerSpecSupport { void exerciseAllTransformConfigurationsWithPaths() { given: def element = getFileElement(path) - Transformer transformer = new PropertiesFileTransformer(testObjectFactory) + Transformer transformer = new PropertiesFileTransformer(objectFactory) transformer.paths.set(paths) transformer.mergeStrategy.set(MergeStrategy.from('first')) @@ -98,7 +97,7 @@ class PropertiesFileTransformerSpec extends TransformerSpecSupport { void exerciseAllTransformConfigurationsWithMappings() { given: def element = getFileElement(path) - Transformer transformer = new PropertiesFileTransformer(testObjectFactory) + Transformer transformer = new PropertiesFileTransformer(objectFactory) transformer.mappings.set(mappings) transformer.mergeStrategy.set(MergeStrategy.from('latest')) @@ -124,7 +123,7 @@ class PropertiesFileTransformerSpec extends TransformerSpecSupport { void appliesKeyTransformer() { given: def element = getFileElement(path) - Transformer transformer = new PropertiesFileTransformer(testObjectFactory) + Transformer transformer = new PropertiesFileTransformer(objectFactory) transformer.keyTransformer.set(keyTransformer) transformer.mergeStrategy.set(MergeStrategy.from('append')) @@ -148,7 +147,7 @@ class PropertiesFileTransformerSpec extends TransformerSpecSupport { void appliesCharset() { given: def element = getFileElement(path) - def transformer = new PropertiesFileTransformer(testObjectFactory) + def transformer = new PropertiesFileTransformer(objectFactory) transformer.charsetName.set(charset) when: 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..818697e0b 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 objectFactory = 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