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

Optionally run Gradle build + ITs using different JDK #36238

Merged
merged 1 commit into from
Oct 4, 2023
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
23 changes: 23 additions & 0 deletions devtools/gradle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@
<gradle.executable>..\gradlew.bat</gradle.executable>
</properties>
</profile>
<profile>
<id>gradleJavaHomeSet</id>
<activation>
<property>
<name>env.GRADLE_JAVA_HOME</name>
</property>
</activation>
<properties>
<gradleJavaHome>${env.GRADLE_JAVA_HOME}</gradleJavaHome>
</properties>
</profile>
<profile>
<id>gradleJavaHomeNotSet</id>
<activation>
<property>
<name>!env.GRADLE_JAVA_HOME</name>
</property>
</activation>
<properties>
<gradleJavaHome>${env.JAVA_HOME}</gradleJavaHome>
</properties>
</profile>
<profile>
<id>run-gradle</id>
<activation>
Expand Down Expand Up @@ -79,6 +101,7 @@
<environmentVariables>
<MAVEN_REPO_LOCAL>${settings.localRepository}</MAVEN_REPO_LOCAL>
<GRADLE_OPTS>${env.MAVEN_OPTS}</GRADLE_OPTS>
<JAVA_HOME>${gradleJavaHome}</JAVA_HOME>
</environmentVariables>
<skip>${skip.gradle.build}</skip>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ public BuildResult runGradleWrapper(boolean expectError, File projectDir, boolea
.redirectOutput(logOutput)
// Should prevent "fragmented" output (parts of stdout and stderr interleaved)
.redirectErrorStream(true);
if (System.getenv("JAVA_HOME") == null) {
if (System.getenv("GRADLE_JAVA_HOME") != null) {
// JAVA_HOME for Gradle explicitly configured.
pb.environment().put("JAVA_HOME", System.getenv("GRADLE_JAVA_HOME"));
} else if (System.getenv("JAVA_HOME") == null || System.getenv("JAVA_HOME").isEmpty()) {
// This helps running the tests in IntelliJ w/o configuring an explicit JAVA_HOME env var.
pb.environment().put("JAVA_HOME", System.getProperty("java.home"));
}
Expand Down
Loading