Skip to content

Commit

Permalink
Make suffix a PathFragment
Browse files Browse the repository at this point in the history
Breaking up the runfiles tree change into some smaller changes this time around.

First step of rolling forward #848.

--
MOS_MIGRATED_REVID=120553288
  • Loading branch information
kchodorow authored and damienmg committed Apr 22, 2016
1 parent 549bfce commit 7ef0251
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public Artifact getArtifact() {
*
* <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
Expand Down Expand Up @@ -203,7 +203,7 @@ public interface EmptyFilesSupplier {
*
* <p>If no EventHandler is available, all values are treated as IGNORE.
*/
public static enum ConflictPolicy {
public enum ConflictPolicy {
IGNORE,
WARN,
ERROR,
Expand Down Expand Up @@ -262,7 +262,7 @@ public Artifact getManifestFile() {
*/
private final NestedSet<PruningManifest> pruningManifests;

private Runfiles(String suffix,
private Runfiles(PathFragment suffix,
NestedSet<Artifact> artifacts,
NestedSet<SymlinkEntry> symlinks,
NestedSet<SymlinkEntry> rootSymlinks,
Expand All @@ -281,7 +281,7 @@ private Runfiles(String suffix,
/**
* Returns the runfiles' suffix.
*/
public String getSuffix() {
public PathFragment getSuffix() {
return suffix;
}

Expand Down Expand Up @@ -449,10 +449,9 @@ public Map<PathFragment, Artifact> getRunfilesInputs(EventHandler eventHandler,
// 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.
Expand Down Expand Up @@ -636,7 +635,7 @@ public void put(Map<PathFragment, Artifact> map, PathFragment path, Artifact art
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
Expand All @@ -659,15 +658,15 @@ public static final class Builder {
* Only used for Runfiles.EMPTY.
*/
private Builder() {
this.suffix = "";
this.suffix = PathFragment.EMPTY_FRAGMENT;
}

/**
* Creates a builder with the given suffix.
* @param workspace is the string specified in workspace() in the WORKSPACE file.
*/
public Builder(String workspace) {
this.suffix = workspace;
this.suffix = new PathFragment(workspace);
}

/**
Expand Down

0 comments on commit 7ef0251

Please sign in to comment.