Skip to content

Commit

Permalink
Add java home to the blaze info
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-mcnamara committed Sep 28, 2024
1 parent d1bd4a8 commit 18bedc2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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 Down Expand Up @@ -188,6 +193,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 +203,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

0 comments on commit 18bedc2

Please sign in to comment.