aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2018-02-27 05:47:21 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-27 05:48:54 -0800
commitc2499c406d0727853ea0ddc5372a50be95de5515 (patch)
tree16a06cfd31ae66c6a32155071b8dfc3d8a8b090d /src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
parent4c763e8ff61884952953b7bca8793796f282cdc0 (diff)
Expose --output_user_base to the Bazel server process
...so that it can use that path to compute other directories in the output user base, in particular the default location for caches. The first cache we will add is the hash-index cache for downloads of external archives, but a spawn cache might be added later in the output user base as well. Change-Id: I24b1c33235c8f76ec008ecb1789163de2b2a45be PiperOrigin-RevId: 187164275
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
index a27b9b6078..df1692fdd5 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
@@ -977,17 +977,22 @@ public final class BlazeRuntime {
String productName = startupOptions.productName.toLowerCase(Locale.US);
PathFragment workspaceDirectory = startupOptions.workspaceDirectory;
+ PathFragment outputUserRoot = startupOptions.outputUserRoot;
PathFragment installBase = startupOptions.installBase;
PathFragment outputBase = startupOptions.outputBase;
maybeForceJNIByGettingPid(installBase); // Must be before first use of JNI.
- // From the point of view of the Java program --install_base and --output_base
- // are mandatory options, despite the comment in their declarations.
+ // From the point of view of the Java program --install_base, --output_base, and
+ // --output_user_root are mandatory options, despite the comment in their declarations.
if (installBase == null || !installBase.isAbsolute()) { // (includes "" default case)
throw new IllegalArgumentException(
"Bad --install_base option specified: '" + installBase + "'");
}
+ if (outputUserRoot != null && !outputUserRoot.isAbsolute()) { // (includes "" default case)
+ throw new IllegalArgumentException(
+ "Bad --output_user_root option specified: '" + outputUserRoot + "'");
+ }
if (outputBase != null && !outputBase.isAbsolute()) { // (includes "" default case)
throw new IllegalArgumentException(
"Bad --output_base option specified: '" + outputBase + "'");
@@ -1009,6 +1014,7 @@ public final class BlazeRuntime {
Path.setFileSystemForSerialization(fs);
SubprocessBuilder.setSubprocessFactory(subprocessFactoryImplementation());
+ Path outputUserRootPath = fs.getPath(outputUserRoot);
Path installBasePath = fs.getPath(installBase);
Path outputBasePath = fs.getPath(outputBase);
Path workspaceDirectoryPath = null;
@@ -1017,7 +1023,8 @@ public final class BlazeRuntime {
}
ServerDirectories serverDirectories =
- new ServerDirectories(installBasePath, outputBasePath, startupOptions.installMD5);
+ new ServerDirectories(
+ installBasePath, outputBasePath, outputUserRootPath, startupOptions.installMD5);
Clock clock = BlazeClock.instance();
BlazeRuntime.Builder runtimeBuilder =
new BlazeRuntime.Builder()