aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/util
diff options
context:
space:
mode:
authorGravatar philwo <philwo@google.com>2017-04-21 16:39:30 +0200
committerGravatar Vladimir Moskva <vladmos@google.com>2017-04-24 16:50:47 +0200
commit0c613be001098153b0ef639b54401730d6e03d45 (patch)
treedd69fa6f648fa02872e2fa8c2d669dc526b09545 /src/main/java/com/google/devtools/build/lib/util
parenta75e0dfb3af05e63053d4ca9681e081ccf4a5d47 (diff)
Add explicit names to the sandboxing strategies so that they can be
selected even if they're not the preferred one on a platform. Simplify the SandboxActionContextProvider and remove the warning about sandboxing being unsupported. With the ProcessWrapperSandboxedStrategy now being reliable enough and the strategies printing their real name in the UI, this is overall a better UX. PiperOrigin-RevId: 153825986
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/util')
-rw-r--r--src/main/java/com/google/devtools/build/lib/util/OS.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/util/OS.java b/src/main/java/com/google/devtools/build/lib/util/OS.java
index fb6596f8f8..10657cc7a9 100644
--- a/src/main/java/com/google/devtools/build/lib/util/OS.java
+++ b/src/main/java/com/google/devtools/build/lib/util/OS.java
@@ -13,6 +13,8 @@
// limitations under the License.
package com.google.devtools.build.lib.util;
+import java.util.EnumSet;
+
/**
* Detects the running operating system and returns a describing enum value.
*/
@@ -23,6 +25,8 @@ public enum OS {
WINDOWS("windows", "Windows"),
UNKNOWN("unknown", "");
+ private static final EnumSet<OS> POSIX_COMPATIBLE = EnumSet.of(DARWIN, FREEBSD, LINUX);
+
private final String canonicalName;
private final String detectionName;
@@ -38,6 +42,10 @@ public enum OS {
return HOST_SYSTEM;
}
+ public static boolean isPosixCompatible() {
+ return POSIX_COMPATIBLE.contains(getCurrent());
+ }
+
public String getCanonicalName() {
return canonicalName;
}