File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
plugin/src/test/groovy/org/gradle/testretry Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,23 @@ abstract class AbstractPluginFuncTest extends Specification implements TestFrame
3737 @Rule
3838 TemporaryFolder testProjectDir = new TemporaryFolder ()
3939
40+ File gradleProperties
41+
4042 File settingsFile
4143
4244 File buildFile
4345
4446 def setup () {
47+ gradleProperties = testProjectDir. newFile(' gradle.properties' )
48+ testJavaToolchainVersion(). ifPresent { major ->
49+ // When a specific Java version is specified that tests should configure,
50+ // we have to configure the build to allow finding the version via an env variable.
51+ def expectedEnvVar = " JDK${ major} "
52+ assert (System . getenv(expectedEnvVar) != null ) : " Test toolchain version is configured but env var ${ expectedEnvVar} is missing!"
53+
54+ gradleProperties << " org.gradle.java.installations.fromEnv=${ expectedEnvVar} "
55+ }
56+
4557 settingsFile = testProjectDir. newFile(' settings.gradle' )
4658 settingsFile << " rootProject.name = 'hello-world'"
4759 buildFile = testProjectDir. newFile(' build.gradle' )
You can’t perform that action at this time.
0 commit comments