Skip to content

Commit

Permalink
[BUG] Gradle Check Failed on Windows due to JDK19 pulling by gradle
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
reta committed Nov 9, 2022
1 parent 3423f44 commit 57efc04
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import org.gradle.plugins.ide.eclipse.model.EclipseJdt
import org.gradle.plugins.ide.eclipse.model.SourceFolder
import org.gradle.api.Project;
import org.gradle.process.ExecResult;
import org.gradle.internal.os.OperatingSystem
import org.gradle.util.DistributionLocator
import org.gradle.util.GradleVersion

Expand Down
3 changes: 2 additions & 1 deletion buildSrc/src/main/java/org/opensearch/gradle/Jdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.TaskDependency;
import org.gradle.internal.os.OperatingSystem;

import java.io.File;
import java.util.Arrays;
Expand Down Expand Up @@ -169,7 +170,7 @@ public Object getBinJavaPath() {
return new Object() {
@Override
public String toString() {
return getHomeRoot() + "/bin/java";
return OperatingSystem.current().getExecutableName(getHomeRoot() + "/bin/java");
}
};
}
Expand Down
6 changes: 5 additions & 1 deletion gradle/runtime-jdk-provision.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ if (BuildParams.getIsRuntimeJavaHomeSet()) {
configure(allprojects - project(':build-tools')) {
project.tasks.withType(Test).configureEach { Test test ->
if (BuildParams.getIsRuntimeJavaHomeSet()) {
test.executable = "${BuildParams.runtimeJavaHome}/bin/java"
if (OperatingSystem.current().isWindows()) {
test.executable = "${BuildParams.runtimeJavaHome}/bin/java.exe"
} else {
test.executable = "${BuildParams.runtimeJavaHome}/bin/java"
}
}
}
}
Expand Down

0 comments on commit 57efc04

Please sign in to comment.