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

[BUILD] Tweak build params api for runtime version specific build logic #119212

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -67,4 +67,6 @@ public interface BuildParameterExtension {
Random getRandom();

Boolean isGraalVmRuntime();

void withMinimumJavaRuntimeVersion(JavaVersion version, Runnable runnable);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgive my bikeshedding: we use the term "minimum runtime version" to mean something slightly different. I also wonder if the name here should give some clue as to the fact that the given Runnable is conditional. Some kind of "if" or "when" prefix might better. Perhaps ifJavaRuntimeVersion or ifJavaRuntimeVersionCompatibleWith?

}
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,10 @@ public void setBwcVersions(Provider<BwcVersions> bwcVersions) {
public void setGitOrigin(String gitOrigin) {
this.gitOrigin = gitOrigin;
}

public void withMinimumJavaRuntimeVersion(JavaVersion version, Runnable runnable) {
if (runtimeJavaVersion.get().isCompatibleWith(version)) {
runnable.run();
}
}
}
2 changes: 1 addition & 1 deletion libs/simdvec/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tasks.matching { it.name == "compileMain21Java" }.configureEach {
}

tasks.named('test').configure {
if (buildParams.getRuntimeJavaVersion().map{ it.majorVersion.toInteger() }.get() >= 21) {
buildParams.withMinimumJavaRuntimeVersion(JavaVersion.VERSION_21) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this conditional on main anymore given the minimum runtime version is 21.

jvmArgs '--add-modules=jdk.incubator.vector'
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/analysis-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tasks.named("yamlRestCompatTestTransform").configure { task ->
}

tasks.named("yamlRestTest").configure {
if (buildParams.getRuntimeJavaVersion().map{ it.majorVersion.toInteger() }.get() >= 24 ||
if (buildParams.getRuntimeJavaVersion().get().isCompatibleWith(JavaVersion.VERSION_24) ||
"-Des.entitlements.enabled=true".equals(System.getProperty("tests.jvm.argline"))) {
systemProperty 'tests.rest.blacklist',
[
Expand Down