Skip to content

Commit

Permalink
Fix tests for Gradle 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jjohannes committed May 23, 2024
1 parent 035886b commit 8b9ee46
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package org.gradlex.jvm.dependency.conflict.test
import org.gradlex.jvm.dependency.conflict.test.fixture.GradleBuild
import spock.lang.Specification

import static org.gradlex.jvm.dependency.conflict.test.fixture.GradleBuild.GRADLE6_TEST

class CapabilityWithDifferentVersionsTest extends Specification {

@Delegate
Expand Down Expand Up @@ -37,6 +39,7 @@ class CapabilityWithDifferentVersionsTest extends Specification {
println(configurations.compileClasspath.get().files.joinToString("\\n") { it.name })
}
"""
if (GRADLE6_TEST) { configureEnvAttribute() }

expect:
printJars()
Expand All @@ -50,7 +53,7 @@ class CapabilityWithDifferentVersionsTest extends Specification {
id("java-library")
}
tasks.withType<JavaCompile>().configureEach {
options.release = 17
options.release.set(17)
}
repositories.mavenCentral()
dependencies {
Expand All @@ -62,8 +65,18 @@ class CapabilityWithDifferentVersionsTest extends Specification {
println(configurations.compileClasspath.get().files.joinToString("\\n") { it.name })
}
"""
if (GRADLE6_TEST) { configureEnvAttribute() }

expect:
printJars()
}

void configureEnvAttribute() {
buildFile << """
val envAttribute = Attribute.of("org.gradle.jvm.environment", String::class.java)
configurations.compileClasspath {
attributes.attribute(envAttribute, "standard-jvm")
}
"""
}
}

0 comments on commit 8b9ee46

Please sign in to comment.