diff options
author | Kristina Chodorow <kchodorow@google.com> | 2016-04-22 16:14:12 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2016-04-22 21:19:16 +0000 |
commit | 7ef0251b25683d493a877d247eae2ec31c85a5a5 (patch) | |
tree | 8d6661e6dece93d09cce3699a28d9643fc9fd78f /src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java | |
parent | 549bfce438156c7a26bb37449b947a60d35eab91 (diff) |
Make suffix a PathFragment
Breaking up the runfiles tree change into some smaller changes this time around.
First step of rolling forward #848.
--
MOS_MIGRATED_REVID=120553288
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java b/src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java index 00688609ab..615fc36f5c 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java @@ -151,7 +151,7 @@ public final class Runfiles { * * <p>This is either set to the workspace name, or is empty. */ - private final String suffix; + private final PathFragment suffix; /** * The artifacts that should *always* be present in the runfiles directory. These are @@ -203,7 +203,7 @@ public final class Runfiles { * * <p>If no EventHandler is available, all values are treated as IGNORE. */ - public static enum ConflictPolicy { + public enum ConflictPolicy { IGNORE, WARN, ERROR, @@ -262,7 +262,7 @@ public final class Runfiles { */ private final NestedSet<PruningManifest> pruningManifests; - private Runfiles(String suffix, + private Runfiles(PathFragment suffix, NestedSet<Artifact> artifacts, NestedSet<SymlinkEntry> symlinks, NestedSet<SymlinkEntry> rootSymlinks, @@ -281,7 +281,7 @@ public final class Runfiles { /** * Returns the runfiles' suffix. */ - public String getSuffix() { + public PathFragment getSuffix() { return suffix; } @@ -449,10 +449,9 @@ public final class Runfiles { // Copy manifest map to another manifest map, prepending the workspace name to every path. // E.g. for workspace "myworkspace", the runfile entry "mylib.so"->"/path/to/mylib.so" becomes // "myworkspace/mylib.so"->"/path/to/mylib.so". - PathFragment suffixPath = new PathFragment(suffix); Map<PathFragment, Artifact> rootManifest = new HashMap<>(); for (Map.Entry<PathFragment, Artifact> entry : manifest.entrySet()) { - checker.put(rootManifest, suffixPath.getRelative(entry.getKey()), entry.getValue()); + checker.put(rootManifest, suffix.getRelative(entry.getKey()), entry.getValue()); } // Finally add symlinks relative to the root of the runfiles tree, on top of everything else. @@ -636,7 +635,7 @@ public final class Runfiles { public static final class Builder { /** This is set to the workspace name */ - private String suffix; + private PathFragment suffix; /** * This must be COMPILE_ORDER because {@link #asMapWithoutRootSymlinks} overwrites earlier @@ -659,7 +658,7 @@ public final class Runfiles { * Only used for Runfiles.EMPTY. */ private Builder() { - this.suffix = ""; + this.suffix = PathFragment.EMPTY_FRAGMENT; } /** @@ -667,7 +666,7 @@ public final class Runfiles { * @param workspace is the string specified in workspace() in the WORKSPACE file. */ public Builder(String workspace) { - this.suffix = workspace; + this.suffix = new PathFragment(workspace); } /** |