Skip to content

Commit

Permalink
Fix declaring dedicated toolchain java home
Browse files Browse the repository at this point in the history
  • Loading branch information
breskeby committed Oct 10, 2023
1 parent 0efd101 commit 31b5a7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ public void apply(Project project) {
}

private Provider<MetadataBasedToolChainMatcher> resolveToolchainSpecFromEnv() {
return providers.environmentVariable("JAVA_TOOLCHAIN_HOME").map(toolChainEnvVariable -> {
return providers.environmentVariable("TOOLCHAIN_JAVA_HOME").map(toolChainEnvVariable -> {
File toolChainDir = new File(toolChainEnvVariable);
JvmInstallationMetadata metadata = metadataDetector.getMetadata(getJavaInstallation(toolChainDir));
if (metadata.isValidInstallation() == false) {
throw new GradleException(
"Configured JAVA_TOOLCHAIN_HOME " + toolChainEnvVariable + " does not point to a valid jdk installation."
"Configured TOOLCHAIN_JAVA_HOME " + toolChainEnvVariable + " does not point to a valid jdk installation."
);
}
return new MetadataBasedToolChainMatcher(metadata);
Expand Down Expand Up @@ -205,9 +205,9 @@ private void logGlobalBuildInfo() {
LOGGER.quiet(" JDK Version : " + gradleJvmImplementationVersion + " (" + gradleJvmVendorDetails + ")");
LOGGER.quiet(" JAVA_HOME : " + gradleJvm.getJavaHome());
}
String javaToolchainHome = System.getenv("JAVA_TOOLCHAIN_HOME");
String javaToolchainHome = System.getenv("TOOLCHAIN_JAVA_HOME");
if (javaToolchainHome != null) {
LOGGER.quiet(" JAVA_TOOLCHAIN_HOME : " + javaToolchainHome);
LOGGER.quiet(" TOOLCHAIN_JAVA_HOME : " + javaToolchainHome);
}
LOGGER.quiet(" Random Testing Seed : " + BuildParams.getTestSeed());
LOGGER.quiet(" In FIPS 140 mode : " + BuildParams.isInFipsJvm());
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ org.gradle.java.installations.auto-detect=false
# log some dependency verification info to console
org.gradle.dependency.verification.console=verbose

# allow user to specify toolchain via the RUNTIME_JAVA_HOME environment variable
org.gradle.java.installations.fromEnv=RUNTIME_JAVA_HOME
# allow user to specify toolchain via the RUNTIME_JAVA_HOME and TOOLCHAIN_JAVA_HOME environment variable
org.gradle.java.installations.fromEnv=RUNTIME_JAVA_HOME,TOOLCHAIN_JAVA_HOME

0 comments on commit 31b5a7a

Please sign in to comment.