Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add a new source set to share test kits (#1081)" #1085

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ 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
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))
Expand All @@ -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)

Expand All @@ -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'))

Expand All @@ -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'))

Expand All @@ -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'))

Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading