Skip to content

Commit 8b9ee46

Browse files
committed
Fix tests for Gradle 6.x
1 parent 035886b commit 8b9ee46

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/test/groovy/org/gradlex/jvm/dependency/conflict/test/CapabilityWithDifferentVersionsTest.groovy

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package org.gradlex.jvm.dependency.conflict.test
33
import org.gradlex.jvm.dependency.conflict.test.fixture.GradleBuild
44
import spock.lang.Specification
55

6+
import static org.gradlex.jvm.dependency.conflict.test.fixture.GradleBuild.GRADLE6_TEST
7+
68
class CapabilityWithDifferentVersionsTest extends Specification {
79

810
@Delegate
@@ -37,6 +39,7 @@ class CapabilityWithDifferentVersionsTest extends Specification {
3739
println(configurations.compileClasspath.get().files.joinToString("\\n") { it.name })
3840
}
3941
"""
42+
if (GRADLE6_TEST) { configureEnvAttribute() }
4043

4144
expect:
4245
printJars()
@@ -50,7 +53,7 @@ class CapabilityWithDifferentVersionsTest extends Specification {
5053
id("java-library")
5154
}
5255
tasks.withType<JavaCompile>().configureEach {
53-
options.release = 17
56+
options.release.set(17)
5457
}
5558
repositories.mavenCentral()
5659
dependencies {
@@ -62,8 +65,18 @@ class CapabilityWithDifferentVersionsTest extends Specification {
6265
println(configurations.compileClasspath.get().files.joinToString("\\n") { it.name })
6366
}
6467
"""
68+
if (GRADLE6_TEST) { configureEnvAttribute() }
6569

6670
expect:
6771
printJars()
6872
}
73+
74+
void configureEnvAttribute() {
75+
buildFile << """
76+
val envAttribute = Attribute.of("org.gradle.jvm.environment", String::class.java)
77+
configurations.compileClasspath {
78+
attributes.attribute(envAttribute, "standard-jvm")
79+
}
80+
"""
81+
}
6982
}

0 commit comments

Comments
 (0)