Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ private void registerInternalDistributionResolutions(List<DistributionResolution
String versionProperty = System.getProperty("tests.bwc.main.version");
// We use this phony version as a placeholder for the real version
if (distribution.getVersion().equals("0.0.0")) {
if (versionProperty == null) {
throw new GradleException("System property 'tests.bwc.main.version' expected for building bwc version.");
}
BwcVersions.UnreleasedVersionInfo unreleasedVersionInfo = new BwcVersions.UnreleasedVersionInfo(
Version.fromString(versionProperty),
"main",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private OsUtils() {}
* This method returns true if the given version of the JDK is known to be incompatible
*/
public static boolean jdkIsIncompatibleWithOS(Version version) {
return version.onOrBefore("8.10.4") && isUbuntu2404OrLater();
return version.after("0.0.0") && version.onOrBefore("8.10.4") && isUbuntu2404OrLater();
}

private static boolean isUbuntu2404OrLater() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public abstract class AbstractLocalClusterFactory<S extends LocalClusterSpec, H
private static final String ENABLE_DEBUG_JVM_ARGS = "-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=";
private static final String ENTITLEMENT_POLICY_YAML = "entitlement-policy.yaml";
private static final String PLUGIN_DESCRIPTOR_PROPERTIES = "plugin-descriptor.properties";
public static final String DISTRO_WITH_JDK_LOWER_21 = "8.11.0";
public static final String FIRST_DISTRO_WITH_JDK_21 = "8.11.0";

private final DistributionResolver distributionResolver;

Expand Down Expand Up @@ -869,7 +869,7 @@ private void startElasticsearch() {
private Map<String, String> getEnvironmentVariables() {
Map<String, String> environment = new HashMap<>(spec.resolveEnvironment());
String esFallbackJavaHome = System.getenv("ES_FALLBACK_JAVA_HOME");
if (spec.getVersion().before(DISTRO_WITH_JDK_LOWER_21) && esFallbackJavaHome != null && esFallbackJavaHome.isEmpty() == false) {
if (jdkIsIncompatible(spec.getVersion()) && esFallbackJavaHome != null && esFallbackJavaHome.isEmpty() == false) {
environment.put("ES_JAVA_HOME", esFallbackJavaHome);
}
environment.put("ES_PATH_CONF", configDir.toString());
Expand Down Expand Up @@ -922,6 +922,10 @@ private Map<String, String> getEnvironmentVariables() {
return environment;
}

private boolean jdkIsIncompatible(Version version) {
return version.after("0.0.0") && version.before(FIRST_DISTRO_WITH_JDK_21);
}

private record ReplacementKey(String key, String fallback) {
ReplacementKey {
assert fallback == null || fallback.isEmpty() == false; // no empty fallback, which would match anything
Expand Down