Skip to content

Commit

Permalink
Rollback of commit 59180a4.
Browse files Browse the repository at this point in the history
*** 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
  • Loading branch information
hermione521 committed Mar 20, 2017
1 parent 2cea8bc commit 5e60e38
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 521 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

package com.google.devtools.build.lib.actions;

import com.google.devtools.build.lib.vfs.PathFragment;

/**
* Represents an input file to a build action, with an appropriate relative path and digest
* value.
Expand All @@ -34,13 +32,6 @@
*/
public interface ActionInput {

/**
* @return the relative path to the input file.
*/
String getExecPathString();

/**
* @return the relative path to the input file.
*/
PathFragment getExecPath();
/** @return the relative path to the input file. */
public String getExecPathString();
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public void expand(Artifact mm, Collection<? super Artifact> output) {
*/
private static class BasicActionInput implements ActionInput {
private final String path;

public BasicActionInput(String path) {
this.path = Preconditions.checkNotNull(path);
}
Expand All @@ -79,11 +78,6 @@ public String getExecPathString() {
return path;
}

@Override
public PathFragment getExecPath() {
return new PathFragment(path);
}

@Override
public int hashCode() {
return path.hashCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ public final Root getRoot() {
return root;
}

@Override
public final PathFragment getExecPath() {
return execPath;
}
Expand Down
24 changes: 11 additions & 13 deletions src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ private static final class SymlinkEntry implements SkylarkValue {
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() {
Expand All @@ -146,12 +146,10 @@ public Artifact getArtifact() {
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);
Expand Down Expand Up @@ -433,11 +431,11 @@ static Map<PathFragment, Artifact> filterListForObscuringSymlinks(
* 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 {
Expand Down Expand Up @@ -852,13 +850,13 @@ public Builder addTransitiveArtifacts(NestedSet<Artifact> artifacts) {
* 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()));
Expand All @@ -878,13 +876,13 @@ public Builder addSymlinks(NestedSet<SymlinkEntry> symlinks) {
* 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()));
Expand Down

This file was deleted.

Loading

0 comments on commit 5e60e38

Please sign in to comment.