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

Run checkpart 4 with configuration cache enabled #117250

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .buildkite/pipelines/pull-request/part-4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ config:
skip-target-branches: "7.17"
steps:
- label: part-4
command: .ci/scripts/run-gradle.sh -Dignore.tests.seed checkPart4
command: .ci/scripts/run-gradle.sh -Dignore.tests.seed checkPart4 --configuration-cache
timeout_in_minutes: 300
agents:
provider: gcp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.gradle.api.Action;
import org.gradle.api.GradleException;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.logging.LogLevel;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property;
Expand Down Expand Up @@ -103,10 +104,16 @@ private static TaskProvider<LoggedExec> createRunBwcGradleTask(
loggedExec.dependsOn("checkoutBwcBranch");
loggedExec.getWorkingDir().set(checkoutDir.get());

loggedExec.getNonTrackedEnvironment().put("JAVA_HOME", providerFactory.of(JavaHomeValueSource.class, spec -> {
spec.getParameters().getVersion().set(unreleasedVersionInfo.map(it -> it.version()));
spec.getParameters().getCheckoutDir().set(checkoutDir);
}).flatMap(s -> getJavaHome(objectFactory, toolChainService, Integer.parseInt(s))));
loggedExec.doFirst(new Action<Task>() {
@Override
public void execute(Task task) {
Provider<String> minimumCompilerVersionValueSource = providerFactory.of(JavaHomeValueSource.class, spec -> {
spec.getParameters().getVersion().set(unreleasedVersionInfo.map(it -> it.version()));
spec.getParameters().getCheckoutDir().set(checkoutDir);
}).flatMap(s -> getJavaHome(objectFactory, toolChainService, Integer.parseInt(s)));
loggedExec.getNonTrackedEnvironment().put("JAVA_HOME", minimumCompilerVersionValueSource.get());
}
});

if (isCi && OS.current() != OS.WINDOWS) {
// TODO: Disabled for now until we can figure out why files are getting corrupted
Expand Down Expand Up @@ -169,22 +176,22 @@ private static Provider<String> getJavaHome(ObjectFactory objectFactory, JavaToo
.map(launcher -> launcher.getMetadata().getInstallationPath().getAsFile().getAbsolutePath());
}

private static String readFromFile(File file) {
try {
return FileUtils.readFileToString(file).trim();
} catch (IOException ioException) {
throw new GradleException("Cannot read java properties file.", ioException);
}
}

public static abstract class JavaHomeValueSource implements ValueSource<String, JavaHomeValueSource.Params> {
public abstract static class JavaHomeValueSource implements ValueSource<String, JavaHomeValueSource.Params> {

private String minimumCompilerVersionPath(Version bwcVersion) {
return (bwcVersion.onOrAfter(BUILD_TOOL_MINIMUM_VERSION))
? "build-tools-internal/" + MINIMUM_COMPILER_VERSION_PATH
: "buildSrc/" + MINIMUM_COMPILER_VERSION_PATH;
}

private static String readFromFile(File file) {
try {
return FileUtils.readFileToString(file).trim();
} catch (IOException ioException) {
throw new GradleException("Cannot read java properties file.", ioException);
}
}

@Override
public String obtain() {
return readFromFile(
Expand Down