diff options
author | Yue Gan <yueg@google.com> | 2017-03-20 10:58:11 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2017-03-20 11:47:24 +0000 |
commit | 5e60e3868b4bafacc138f786b304589dbd687016 (patch) | |
tree | c0d85fc4347b7ff67225bead1834ed19cc021e74 /src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java | |
parent | 2cea8bc6e17b4df623ed73155c6be7a97cfbe957 (diff) |
Rollback of commit 59180a4ea66b1395b5b85defd732859ecae919ea.
*** Reason for rollback ***
Break bazel-tests and many other jobs on CI.
http://ci.bazel.io/job/bazel-tests/BAZEL_VERSION=HEAD,PLATFORM_NAME=linux-x86_64/651/console
*** Original change description ***
Add SpawnInputExpander helper class to arrange runfiles for spawn strategies
This new class is a combination of SpawnHelper and our internal code; the
plan is to migrate all spawn strategies to the new class. The strict flag
should be enabled by default, but that's a breaking change, so we need to do
it later.
- Use it in SandboxStrategy.
- Add ActionInput.getExecPath to return a PathFragment; this avoids lots of
back and forth between path fragments and strings.
This is a step towards #159...
***
--
PiperOrigin-RevId: 150610616
MOS_MIGRATED_REVID=150610616
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 | 24 |
1 files changed, 11 insertions, 13 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 04eaf1287b..a087ee4ff8 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 @@ -134,8 +134,8 @@ public final class Runfiles { private final Artifact artifact; private SymlinkEntry(PathFragment path, Artifact artifact) { - this.path = Preconditions.checkNotNull(path); - this.artifact = Preconditions.checkNotNull(artifact); + this.path = path; + this.artifact = artifact; } public PathFragment getPath() { @@ -146,12 +146,10 @@ public final class Runfiles { return artifact; } - @Override public boolean isImmutable() { return true; } - @Override public void write(Appendable buffer, char quotationMark) { Printer.append(buffer, "SymlinkEntry(path = "); Printer.write(buffer, getPath().toString(), quotationMark); @@ -433,11 +431,11 @@ public final class Runfiles { * Returns the symlinks as a map from PathFragment to Artifact. * * @param eventHandler Used for throwing an error if we have an obscuring runlink within the - * normal source tree entries, or runfile conflicts. May be null, in which case obscuring - * symlinks are silently discarded, and conflicts are overwritten. + * normal source tree entries, or runfile conflicts. May be null, in which case obscuring + * symlinks are silently discarded, and conflicts are overwritten. * @param location Location for eventHandler warnings. Ignored if eventHandler is null. * @return Map<PathFragment, Artifact> path fragment to artifact, of normal source tree entries - * and elements that live outside the source tree. Null values represent empty input files. + * and elements that live outside the source tree. Null values represent empty input files. */ public Map<PathFragment, Artifact> getRunfilesInputs(EventHandler eventHandler, Location location) throws IOException { @@ -852,13 +850,13 @@ public final class Runfiles { * Adds a symlink. */ public Builder addSymlink(PathFragment link, Artifact target) { + Preconditions.checkNotNull(link); + Preconditions.checkNotNull(target); symlinksBuilder.add(new SymlinkEntry(link, target)); return this; } - /** - * Adds several symlinks. Neither keys nor values may be null. - */ + /** Adds several symlinks. */ public Builder addSymlinks(Map<PathFragment, Artifact> symlinks) { for (Map.Entry<PathFragment, Artifact> symlink : symlinks.entrySet()) { symlinksBuilder.add(new SymlinkEntry(symlink.getKey(), symlink.getValue())); @@ -878,13 +876,13 @@ public final class Runfiles { * Adds a root symlink. */ public Builder addRootSymlink(PathFragment link, Artifact target) { + Preconditions.checkNotNull(link); + Preconditions.checkNotNull(target); rootSymlinksBuilder.add(new SymlinkEntry(link, target)); return this; } - /** - * Adds several root symlinks. Neither keys nor values may be null. - */ + /** Adds several root symlinks. */ public Builder addRootSymlinks(Map<PathFragment, Artifact> symlinks) { for (Map.Entry<PathFragment, Artifact> symlink : symlinks.entrySet()) { rootSymlinksBuilder.add(new SymlinkEntry(symlink.getKey(), symlink.getValue())); |