aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2016-02-04 10:43:11 +0000
committerGravatar David Chen <dzc@google.com>2016-02-04 18:13:44 +0000
commit6979c8e8f5deec422a0ad1b5e558d77f583108ae (patch)
tree4cb8ef5984b9ba32e4166e4f8d69b72f0671fa92 /src/main/java/com
parent7ce3a4c734c004c325ac5f7c01b2a40b501e612c (diff)
Fileset: introduce support for workspace-relative strip_prefix values.
-- MOS_MIGRATED_REVID=113830075
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/FilesetEntry.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/FilesetEntry.java b/src/main/java/com/google/devtools/build/lib/packages/FilesetEntry.java
index eba5aba3b2..c94216400f 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/FilesetEntry.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/FilesetEntry.java
@@ -47,6 +47,7 @@ public final class FilesetEntry implements SkylarkValue {
public static final SymlinkBehavior DEFAULT_SYMLINK_BEHAVIOR = SymlinkBehavior.COPY;
public static final String DEFAULT_STRIP_PREFIX = ".";
+ public static final String STRIP_PREFIX_WORKSPACE = "%workspace%";
@Override
public boolean isImmutable() {
@@ -220,8 +221,14 @@ public final class FilesetEntry implements SkylarkValue {
return "Cannot specify absolute destdir '" + destDir + "'";
} else if (!stripPrefix.equals(DEFAULT_STRIP_PREFIX) && files == null) {
return "If the strip prefix is not \"" + DEFAULT_STRIP_PREFIX + "\", files must be specified";
+ } else if (stripPrefix.startsWith("/")) {
+ return "Cannot specify absolute strip prefix; perhaps you need to use \""
+ + STRIP_PREFIX_WORKSPACE + "\"";
} else if (new PathFragment(stripPrefix).containsUplevelReferences()) {
return "Strip prefix must not contain uplevel references";
+ } else if (stripPrefix.startsWith("%") && !stripPrefix.startsWith(STRIP_PREFIX_WORKSPACE)) {
+ return "If the strip_prefix starts with \"%\" then it must start with \""
+ + STRIP_PREFIX_WORKSPACE + "\"";
} else {
return null;
}