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

Add java home to the blaze info #6810

Open
wants to merge 2 commits into
base: master
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 @@ -35,6 +35,7 @@ public abstract class BlazeInfo implements ProtoWrapper<ProjectData.BlazeInfo> {
public static final String OUTPUT_BASE_KEY = "output_base";
public static final String OUTPUT_PATH_KEY = "output_path";
public static final String RELEASE = "release";
public static final String JAVA_HOME = "java-home";

public static final String STARLARK_SEMANTICS = "starlark-semantics";

Expand Down Expand Up @@ -86,6 +87,7 @@ public static BlazeInfo create(
executionRoot, new File(getOrThrow(blazeInfoMap, blazeTestlogsKey(buildSystemName))));
File outputBase = new File(getOrThrow(blazeInfoMap, OUTPUT_BASE_KEY).trim());
File outputPath = new File(getOrThrow(blazeInfoMap, OUTPUT_PATH_KEY).trim());
File javaHome = new File(getOrThrow(blazeInfoMap, JAVA_HOME).trim());
return AutoValue_BlazeInfo.builder()
.setBlazeInfoMap(blazeInfoMap)
.setExecutionRoot(executionRoot)
Expand All @@ -94,6 +96,7 @@ public static BlazeInfo create(
.setBlazeTestlogs(blazeTestlogs)
.setOutputBase(outputBase)
.setOutputPath(outputPath)
.setJavaHome(javaHome)
.autoBuild();
}

Expand Down Expand Up @@ -152,6 +155,8 @@ public String getRelease() {
return getBlazeInfoMap().get(RELEASE);
}

public abstract File getJavaHome();

/** Creates a mock blaze info with the minimum information required for syncing. */
@VisibleForTesting
public static BlazeInfo createMockBlazeInfo(
Expand All @@ -168,7 +173,8 @@ public static BlazeInfo createMockBlazeInfo(
.put(EXECUTION_ROOT_KEY, executionRoot)
.put(blazeBinKey(buildSystemName), blazeBin)
.put(blazeGenfilesKey(buildSystemName), blazeGenFiles)
.put(blazeTestlogsKey(buildSystemName), blazeTestlogs);
.put(blazeTestlogsKey(buildSystemName), blazeTestlogs)
.put(JAVA_HOME, "/tmp/java");
return BlazeInfo.create(buildSystemName, blazeInfoMap.build());
}

Expand All @@ -188,6 +194,8 @@ public abstract static class Builder {

public abstract Builder setOutputPath(File value);

public abstract Builder setJavaHome(File value);

public abstract BlazeInfo autoBuild();

// A build method to populate the blazeInfoMap
Expand All @@ -196,6 +204,7 @@ public BlazeInfo build(BuildSystemName buildSystemName) {
blazeInfoMapBuilder().put(OUTPUT_BASE_KEY, blazeInfo.getOutputBase().getPath());
blazeInfoMapBuilder().put(OUTPUT_PATH_KEY, blazeInfo.getOutputPath().getPath());
blazeInfoMapBuilder().put(EXECUTION_ROOT_KEY, blazeInfo.getExecutionRoot().getPath());
blazeInfoMapBuilder().put(JAVA_HOME, blazeInfo.getJavaHome().getPath());
File execRoot = new File(blazeInfo.getExecutionRoot().getAbsolutePath());
blazeInfoMapBuilder()
.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public ListenableFuture<BlazeInfo> runBlazeInfo(
BlazeInfo.OUTPUT_PATH_KEY,
BlazeInfo.OUTPUT_BASE_KEY,
BlazeInfo.RELEASE,
BlazeInfo.STARLARK_SEMANTICS),
BlazeInfo.STARLARK_SEMANTICS,
BlazeInfo.JAVA_HOME),
bytes ->
BlazeInfo.create(
buildSystemName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public void doSetup() throws Throwable {
.put(BlazeInfo.OUTPUT_BASE_KEY, outputBase)
.put(BlazeInfo.OUTPUT_PATH_KEY, outputPath)
.put(BlazeInfo.PACKAGE_PATH_KEY, workspaceRoot.toString())
.put(BlazeInfo.JAVA_HOME, "/tmp/java")
.build());

// The tests run a full sync and hence also include the JDK setup part (if the workspace is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public class FastBuildChangedFilesServiceTest extends BlazeIntegrationTestCase {
"blaze-testlogs", BLAZE_TESTLOGS,
"execution_root", BLAZE_EXECROOT,
"output_base", "/blaze/output-base",
"output_path", "/blaze/output-base/output-path"
"output_path", "/blaze/output-base/output-path",
"java-home", "/tmp/java"
));

private FastBuildChangedFilesService changedFilesService;
Expand Down