Rename Root to ArtifactRoot.
This is slightly more descriptive, and we will potentially want to use the name Root for a broader concept shared between ArtifactRoot and RootedPath.
PiperOrigin-RevId: 182082367
diff --git a/src/main/java/com/google/devtools/build/lib/actions/Artifact.java b/src/main/java/com/google/devtools/build/lib/actions/Artifact.java
index 7468de1..a72c77d 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/Artifact.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/Artifact.java
@@ -164,7 +164,7 @@
private final int hashCode;
private final Path path;
- private final Root root;
+ private final ArtifactRoot root;
private final PathFragment execPath;
private final PathFragment rootRelativePath;
private final ArtifactOwner owner;
@@ -176,18 +176,20 @@
*
* <p>In a source Artifact, the path tail after the root will be identical to the execPath, but
* the root will be orthogonal to execRoot.
+ *
* <pre>
* [path] == [/root/][execPath]
* </pre>
*
* <p>In a derived Artifact, the execPath will overlap with part of the root, which in turn will
* be below the execRoot.
+ *
* <pre>
* [path] == [/root][pathTail] == [/execRoot][execPath] == [/execRoot][rootPrefix][pathTail]
* </pre>
*/
@VisibleForTesting
- public Artifact(Path path, Root root, PathFragment execPath, ArtifactOwner owner) {
+ public Artifact(Path path, ArtifactRoot root, PathFragment execPath, ArtifactOwner owner) {
if (root == null || !path.startsWith(root.getPath())) {
throw new IllegalArgumentException(root + ": illegal root for " + path
+ " (execPath: " + execPath + ")");
@@ -233,7 +235,7 @@
* <pre>
*/
@VisibleForTesting
- public Artifact(Path path, Root root, PathFragment execPath) {
+ public Artifact(Path path, ArtifactRoot root, PathFragment execPath) {
this(path, root, execPath, ArtifactOwner.NULL_OWNER);
}
@@ -241,17 +243,15 @@
* Constructs a source or derived Artifact for the specified path and specified root. The root
* must be an ancestor of the path.
*/
- @VisibleForTesting // Only exists for testing.
- public Artifact(Path path, Root root) {
+ @VisibleForTesting // Only exists for testing.
+ public Artifact(Path path, ArtifactRoot root) {
this(path, root, root.getExecPath().getRelative(path.relativeTo(root.getPath())),
ArtifactOwner.NULL_OWNER);
}
- /**
- * Constructs a source or derived Artifact for the specified root-relative path and root.
- */
- @VisibleForTesting // Only exists for testing.
- public Artifact(PathFragment rootRelativePath, Root root) {
+ /** Constructs a source or derived Artifact for the specified root-relative path and root. */
+ @VisibleForTesting // Only exists for testing.
+ public Artifact(PathFragment rootRelativePath, ArtifactRoot root) {
this(root.getPath().getRelative(rootRelativePath), root,
root.getExecPath().getRelative(rootRelativePath), ArtifactOwner.NULL_OWNER);
}
@@ -347,13 +347,15 @@
/**
* Returns the root beneath which this Artifact resides, if any. This may be one of the
- * package-path entries (for source Artifacts), or one of the bin, genfiles or includes dirs
- * (for derived Artifacts). It will always be an ancestor of getPath().
+ * package-path entries (for source Artifacts), or one of the bin, genfiles or includes dirs (for
+ * derived Artifacts). It will always be an ancestor of getPath().
*/
- @SkylarkCallable(name = "root", structField = true,
- doc = "The root beneath which this file resides."
+ @SkylarkCallable(
+ name = "root",
+ structField = true,
+ doc = "The root beneath which this file resides."
)
- public final Root getRoot() {
+ public final ArtifactRoot getRoot() {
return root;
}
@@ -443,7 +445,11 @@
private final SpecialArtifactType type;
@VisibleForTesting
- public SpecialArtifact(Path path, Root root, PathFragment execPath, ArtifactOwner owner,
+ public SpecialArtifact(
+ Path path,
+ ArtifactRoot root,
+ PathFragment execPath,
+ ArtifactOwner owner,
SpecialArtifactType type) {
super(path, root, execPath, owner);
this.type = type;
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java b/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
index 37bd6f4..26d97f7 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
@@ -145,7 +145,7 @@
}
@Override
- public Artifact getSourceArtifact(PathFragment execPath, Root root, ArtifactOwner owner) {
+ public Artifact getSourceArtifact(PathFragment execPath, ArtifactRoot root, ArtifactOwner owner) {
Preconditions.checkArgument(!execPath.isAbsolute(), "%s %s %s", execPath, root, owner);
Preconditions.checkNotNull(owner, "%s %s", execPath, root);
execPath = execPath.normalize();
@@ -153,11 +153,11 @@
}
@Override
- public Artifact getSourceArtifact(PathFragment execPath, Root root) {
+ public Artifact getSourceArtifact(PathFragment execPath, ArtifactRoot root) {
return getSourceArtifact(execPath, root, ArtifactOwner.NULL_OWNER);
}
- private void validatePath(PathFragment rootRelativePath, Root root) {
+ private void validatePath(PathFragment rootRelativePath, ArtifactRoot root) {
Preconditions.checkArgument(!root.isSourceRoot());
Preconditions.checkArgument(!rootRelativePath.isAbsolute(), rootRelativePath);
Preconditions.checkArgument(rootRelativePath.isNormalized(), rootRelativePath);
@@ -177,8 +177,8 @@
* computed as {@code root.getRelative(rootRelativePath).relativeTo(root.execRoot)}.
*/
// TODO(bazel-team): Don't allow root == execRootParent.
- public Artifact getDerivedArtifact(PathFragment rootRelativePath, Root root,
- ArtifactOwner owner) {
+ public Artifact getDerivedArtifact(
+ PathFragment rootRelativePath, ArtifactRoot root, ArtifactOwner owner) {
validatePath(rootRelativePath, root);
Path path = root.getPath().getRelative(rootRelativePath);
return getArtifact(path, root, path.relativeTo(root.getExecRoot()), owner, null);
@@ -192,8 +192,8 @@
* <p>The root must be below the execRootParent, and the execPath of the resulting Artifact is
* computed as {@code root.getRelative(rootRelativePath).relativeTo(root.execRoot)}.
*/
- public Artifact getFilesetArtifact(PathFragment rootRelativePath, Root root,
- ArtifactOwner owner) {
+ public Artifact getFilesetArtifact(
+ PathFragment rootRelativePath, ArtifactRoot root, ArtifactOwner owner) {
validatePath(rootRelativePath, root);
Path path = root.getPath().getRelative(rootRelativePath);
return getArtifact(
@@ -201,22 +201,22 @@
}
/**
- * Returns an artifact that represents a TreeArtifact; that is, a directory containing some
- * tree of ArtifactFiles unknown at analysis time.
+ * Returns an artifact that represents a TreeArtifact; that is, a directory containing some tree
+ * of ArtifactFiles unknown at analysis time.
*
* <p>The root must be below the execRootParent, and the execPath of the resulting Artifact is
* computed as {@code root.getRelative(rootRelativePath).relativeTo(root.execRoot)}.
*/
- public Artifact getTreeArtifact(PathFragment rootRelativePath, Root root,
- ArtifactOwner owner) {
+ public Artifact getTreeArtifact(
+ PathFragment rootRelativePath, ArtifactRoot root, ArtifactOwner owner) {
validatePath(rootRelativePath, root);
Path path = root.getPath().getRelative(rootRelativePath);
return getArtifact(
path, root, path.relativeTo(root.getExecRoot()), owner, SpecialArtifactType.TREE);
}
- public Artifact getConstantMetadataArtifact(PathFragment rootRelativePath, Root root,
- ArtifactOwner owner) {
+ public Artifact getConstantMetadataArtifact(
+ PathFragment rootRelativePath, ArtifactRoot root, ArtifactOwner owner) {
validatePath(rootRelativePath, root);
Path path = root.getPath().getRelative(rootRelativePath);
return getArtifact(
@@ -225,12 +225,15 @@
}
/**
- * Returns the Artifact for the specified path, creating one if not found and
- * setting the <code>root</code> and <code>execPath</code> to the
- * specified values.
+ * Returns the Artifact for the specified path, creating one if not found and setting the <code>
+ * root</code> and <code>execPath</code> to the specified values.
*/
- private synchronized Artifact getArtifact(Path path, Root root, PathFragment execPath,
- ArtifactOwner owner, @Nullable SpecialArtifactType type) {
+ private synchronized Artifact getArtifact(
+ Path path,
+ ArtifactRoot root,
+ PathFragment execPath,
+ ArtifactOwner owner,
+ @Nullable SpecialArtifactType type) {
Preconditions.checkNotNull(root);
Preconditions.checkNotNull(execPath);
@@ -250,7 +253,11 @@
return artifact;
}
- private Artifact createArtifact(Path path, Root root, PathFragment execPath, ArtifactOwner owner,
+ private Artifact createArtifact(
+ Path path,
+ ArtifactRoot root,
+ PathFragment execPath,
+ ArtifactOwner owner,
@Nullable SpecialArtifactType type) {
Preconditions.checkNotNull(owner, path);
if (type == null) {
@@ -261,13 +268,15 @@
}
/**
- * Returns an {@link Artifact} with exec path formed by composing {@code baseExecPath} and
- * {@code relativePath} (via {@code baseExecPath.getRelative(relativePath)} if baseExecPath is
- * not null). That Artifact will have root determined by the package roots of this factory if it
- * lives in a subpackage distinct from that of baseExecPath, and {@code baseRoot} otherwise.
+ * Returns an {@link Artifact} with exec path formed by composing {@code baseExecPath} and {@code
+ * relativePath} (via {@code baseExecPath.getRelative(relativePath)} if baseExecPath is not null).
+ * That Artifact will have root determined by the package roots of this factory if it lives in a
+ * subpackage distinct from that of baseExecPath, and {@code baseRoot} otherwise.
*/
public synchronized Artifact resolveSourceArtifactWithAncestor(
- PathFragment relativePath, PathFragment baseExecPath, Root baseRoot,
+ PathFragment relativePath,
+ PathFragment baseExecPath,
+ ArtifactRoot baseRoot,
RepositoryName repositoryName) {
Preconditions.checkState(
(baseExecPath == null) == (baseRoot == null),
@@ -288,10 +297,10 @@
if (isDerivedArtifact(execPath)) {
return null;
}
- Root sourceRoot = findSourceRoot(execPath, baseExecPath, baseRoot, repositoryName);
+ ArtifactRoot sourceRoot = findSourceRoot(execPath, baseExecPath, baseRoot, repositoryName);
Artifact artifact = sourceArtifactCache.getArtifactIfValid(execPath);
if (artifact != null) {
- Root artifactRoot = artifact.getRoot();
+ ArtifactRoot artifactRoot = artifact.getRoot();
Preconditions.checkState(
sourceRoot == null || sourceRoot.equals(artifactRoot),
"roots mismatch: %s %s %s",
@@ -308,8 +317,10 @@
* root directory if our execPath doesn't start with baseExecPath due to uplevel references.
*/
@Nullable
- private Root findSourceRoot(
- PathFragment execPath, @Nullable PathFragment baseExecPath, @Nullable Root baseRoot,
+ private ArtifactRoot findSourceRoot(
+ PathFragment execPath,
+ @Nullable PathFragment baseExecPath,
+ @Nullable ArtifactRoot baseRoot,
RepositoryName repositoryName) {
PathFragment dir = execPath.getParentDirectory();
if (dir == null) {
@@ -323,7 +334,7 @@
}
while (dir != null && !dir.equals(baseExecPath)) {
- Root sourceRoot =
+ ArtifactRoot sourceRoot =
packageRoots.getRootForPackage(PackageIdentifier.create(repositoryName, dir));
if (sourceRoot != null) {
return sourceRoot;
@@ -365,7 +376,8 @@
unresolvedPaths.add(execPath);
}
}
- Map<PathFragment, Root> sourceRoots = resolver.findPackageRootsForFiles(unresolvedPaths);
+ Map<PathFragment, ArtifactRoot> sourceRoots =
+ resolver.findPackageRootsForFiles(unresolvedPaths);
// We are missing some dependencies. We need to rerun this method later.
if (sourceRoots == null) {
return null;
@@ -380,7 +392,7 @@
public Path getPathFromSourceExecPath(PathFragment execPath) {
Preconditions.checkState(
!execPath.startsWith(derivedPathPrefix), "%s is derived: %s", execPath, derivedPathPrefix);
- Root sourceRoot =
+ ArtifactRoot sourceRoot =
packageRoots.getRootForPackage(PackageIdentifier.create(RepositoryName.MAIN, execPath));
if (sourceRoot != null) {
return sourceRoot.getPath().getRelative(execPath);
@@ -388,7 +400,7 @@
return execRoot.getRelative(execPath);
}
- private Artifact createArtifactIfNotValid(Root sourceRoot, PathFragment execPath) {
+ private Artifact createArtifactIfNotValid(ArtifactRoot sourceRoot, PathFragment execPath) {
if (sourceRoot == null) {
return null; // not a path that we can find...
}
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ArtifactResolver.java b/src/main/java/com/google/devtools/build/lib/actions/ArtifactResolver.java
index 7542118..2b543d2 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ArtifactResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ArtifactResolver.java
@@ -34,15 +34,15 @@
* @param owner the artifact owner.
* @return the canonical source artifact for the given path
*/
- Artifact getSourceArtifact(PathFragment execPath, Root root, ArtifactOwner owner);
+ Artifact getSourceArtifact(PathFragment execPath, ArtifactRoot root, ArtifactOwner owner);
/**
* Returns the source Artifact for the specified path, creating it if not found and setting its
* root and execPath.
*
- * @see #getSourceArtifact(PathFragment, Root, ArtifactOwner)
+ * @see #getSourceArtifact(PathFragment, ArtifactRoot, ArtifactOwner)
*/
- Artifact getSourceArtifact(PathFragment execPath, Root root);
+ Artifact getSourceArtifact(PathFragment execPath, ArtifactRoot root);
/**
* Resolves a source Artifact given an execRoot-relative path.
diff --git a/src/main/java/com/google/devtools/build/lib/actions/Root.java b/src/main/java/com/google/devtools/build/lib/actions/ArtifactRoot.java
similarity index 83%
rename from src/main/java/com/google/devtools/build/lib/actions/Root.java
rename to src/main/java/com/google/devtools/build/lib/actions/ArtifactRoot.java
index 27c6898..47b3c5e 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/Root.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ArtifactRoot.java
@@ -44,16 +44,19 @@
* <p>The derived roots must have paths that point inside the exec root, i.e. below the directory
* that is the root of the merged directory tree.
*/
-@SkylarkModule(name = "root",
- category = SkylarkModuleCategory.BUILTIN,
- doc = "A root for files. The roots are the directories containing files, and they are mapped "
- + "together into a single directory tree to form the execution environment.")
+@SkylarkModule(
+ name = "root",
+ category = SkylarkModuleCategory.BUILTIN,
+ doc =
+ "A root for files. The roots are the directories containing files, and they are mapped "
+ + "together into a single directory tree to form the execution environment."
+)
@Immutable
-public final class Root implements Comparable<Root>, Serializable, SkylarkValue {
+public final class ArtifactRoot implements Comparable<ArtifactRoot>, Serializable, SkylarkValue {
// This must always be consistent with Package.getSourceRoot; otherwise computing source roots
// from exec paths does not work, which can break the action cache for input-discovering actions.
- public static Root computeSourceRoot(Path packageRoot, RepositoryName repository) {
+ public static ArtifactRoot computeSourceRoot(Path packageRoot, RepositoryName repository) {
if (repository.isMain()) {
return asSourceRoot(packageRoot);
} else {
@@ -66,8 +69,8 @@
}
/** Returns the given path as a source root. The path may not be {@code null}. */
- public static Root asSourceRoot(Path path) {
- return new Root(null, path);
+ public static ArtifactRoot asSourceRoot(Path path) {
+ return new ArtifactRoot(null, path);
}
/**
@@ -77,17 +80,17 @@
* <p>Be careful with this method - all derived roots must be registered with the artifact factory
* before the analysis phase.
*/
- public static Root asDerivedRoot(Path execRoot, Path root) {
+ public static ArtifactRoot asDerivedRoot(Path execRoot, Path root) {
Preconditions.checkArgument(root.startsWith(execRoot));
Preconditions.checkArgument(!root.equals(execRoot));
- return new Root(execRoot, root);
+ return new ArtifactRoot(execRoot, root);
}
- public static Root middlemanRoot(Path execRoot, Path outputDir) {
+ public static ArtifactRoot middlemanRoot(Path execRoot, Path outputDir) {
Path root = outputDir.getRelative("internal");
Preconditions.checkArgument(root.startsWith(execRoot));
Preconditions.checkArgument(!root.equals(execRoot));
- return new Root(execRoot, root, true);
+ return new ArtifactRoot(execRoot, root, true);
}
@Nullable private final Path execRoot;
@@ -95,14 +98,14 @@
private final boolean isMiddlemanRoot;
private final PathFragment execPath;
- private Root(@Nullable Path execRoot, Path path, boolean isMiddlemanRoot) {
+ private ArtifactRoot(@Nullable Path execRoot, Path path, boolean isMiddlemanRoot) {
this.execRoot = execRoot;
this.path = Preconditions.checkNotNull(path);
this.isMiddlemanRoot = isMiddlemanRoot;
this.execPath = isSourceRoot() ? PathFragment.EMPTY_FRAGMENT : path.relativeTo(execRoot);
}
- private Root(@Nullable Path execRoot, Path path) {
+ private ArtifactRoot(@Nullable Path execRoot, Path path) {
this(execRoot, path, false);
}
@@ -138,7 +141,7 @@
}
@Override
- public int compareTo(Root o) {
+ public int compareTo(ArtifactRoot o) {
return path.compareTo(o.path);
}
@@ -152,10 +155,10 @@
if (o == this) {
return true;
}
- if (!(o instanceof Root)) {
+ if (!(o instanceof ArtifactRoot)) {
return false;
}
- Root r = (Root) o;
+ ArtifactRoot r = (ArtifactRoot) o;
return path.equals(r.path) && Objects.equals(execRoot, r.execRoot);
}
diff --git a/src/main/java/com/google/devtools/build/lib/actions/MiddlemanFactory.java b/src/main/java/com/google/devtools/build/lib/actions/MiddlemanFactory.java
index fbbc100..43a9e37 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/MiddlemanFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/MiddlemanFactory.java
@@ -45,15 +45,15 @@
*
* @param owner the owner of the action that will be created; must not be null
* @param purpose the purpose for which this middleman is created. This should be a string which
- * is suitable for use as a filename. A single rule may have many middlemen with distinct
- * purposes.
+ * is suitable for use as a filename. A single rule may have many middlemen with distinct
+ * purposes.
* @param inputs the set of artifacts for which the created artifact is to be the middleman.
* @param middlemanDir the directory in which to place the middleman.
* @return null iff {@code inputs} is empty; the single element of {@code inputs} if there's only
- * one; a new aggregating middleman for the {@code inputs} otherwise
+ * one; a new aggregating middleman for the {@code inputs} otherwise
*/
public Artifact createAggregatingMiddleman(
- ActionOwner owner, String purpose, Iterable<Artifact> inputs, Root middlemanDir) {
+ ActionOwner owner, String purpose, Iterable<Artifact> inputs, ArtifactRoot middlemanDir) {
if (hasExactlyOneInput(inputs)) { // Optimization: No middleman for just one input.
return Iterables.getOnlyElement(inputs);
}
@@ -64,28 +64,26 @@
}
/**
- * Returns <code>null</code> iff inputs is empty. Returns the sole element
- * of inputs iff <code>inputs.size()==1</code>. Otherwise, returns a
- * middleman artifact and creates a middleman action that generates that
- * artifact.
+ * Returns <code>null</code> iff inputs is empty. Returns the sole element of inputs iff <code>
+ * inputs.size()==1</code>. Otherwise, returns a middleman artifact and creates a middleman action
+ * that generates that artifact.
*
* @param owner the owner of the action that will be created.
- * @param owningArtifact the artifact of the file for which the runfiles
- * should be created. There may be at most one set of runfiles for
- * an owning artifact, unless the owning artifact is null. There
- * may be at most one set of runfiles per owner with a null
- * owning artifact.
- * Further, if the owning Artifact is non-null, the owning Artifacts'
- * root-relative path must be unique and the artifact must be part
- * of the runfiles tree for which this middleman is created. Usually
- * this artifact will be an executable program.
- * @param inputs the set of artifacts for which the created artifact is to be
- * the middleman.
+ * @param owningArtifact the artifact of the file for which the runfiles should be created. There
+ * may be at most one set of runfiles for an owning artifact, unless the owning artifact is
+ * null. There may be at most one set of runfiles per owner with a null owning artifact.
+ * Further, if the owning Artifact is non-null, the owning Artifacts' root-relative path must
+ * be unique and the artifact must be part of the runfiles tree for which this middleman is
+ * created. Usually this artifact will be an executable program.
+ * @param inputs the set of artifacts for which the created artifact is to be the middleman.
* @param middlemanDir the directory in which to place the middleman.
*/
public Artifact createRunfilesMiddleman(
- ActionOwner owner, @Nullable Artifact owningArtifact, Iterable<Artifact> inputs,
- Root middlemanDir, String tag) {
+ ActionOwner owner,
+ @Nullable Artifact owningArtifact,
+ Iterable<Artifact> inputs,
+ ArtifactRoot middlemanDir,
+ String tag) {
Preconditions.checkArgument(middlemanDir.isMiddlemanRoot());
if (hasExactlyOneInput(inputs)) { // Optimization: No middleman for just one input.
return Iterables.getOnlyElement(inputs);
@@ -114,19 +112,23 @@
*
* @param owner the owner of the action that will be created. May not be null.
* @param middlemanName a unique file name for the middleman artifact in the {@code middlemanDir};
- * in practice this is usually the owning rule's label (so it gets escaped as such)
+ * in practice this is usually the owning rule's label (so it gets escaped as such)
* @param purpose the purpose for which this middleman is created. This should be a string which
- * is suitable for use as a filename. A single rule may have many middlemen with distinct
- * purposes.
+ * is suitable for use as a filename. A single rule may have many middlemen with distinct
+ * purposes.
* @param inputs the set of artifacts for which the created artifact is to be the middleman; must
- * not be null or empty
+ * not be null or empty
* @param middlemanDir the directory in which to place the middleman.
* @return a middleman that enforces scheduling order (just like a scheduling middleman) and
- * propagates errors, but is ignored by the dependency checker
+ * propagates errors, but is ignored by the dependency checker
* @throws IllegalArgumentException if {@code inputs} is null or empty
*/
- public Artifact createErrorPropagatingMiddleman(ActionOwner owner, String middlemanName,
- String purpose, Iterable<Artifact> inputs, Root middlemanDir) {
+ public Artifact createErrorPropagatingMiddleman(
+ ActionOwner owner,
+ String middlemanName,
+ String purpose,
+ Iterable<Artifact> inputs,
+ ArtifactRoot middlemanDir) {
Preconditions.checkArgument(inputs != null);
Preconditions.checkArgument(!Iterables.isEmpty(inputs));
// We must always create this middleman even if there is only one input.
@@ -135,11 +137,11 @@
}
/**
- * Returns the same artifact as {@code createErrorPropagatingMiddleman} would return,
- * but doesn't create any action.
+ * Returns the same artifact as {@code createErrorPropagatingMiddleman} would return, but doesn't
+ * create any action.
*/
- public Artifact getErrorPropagatingMiddlemanArtifact(String middlemanName, String purpose,
- Root middlemanDir) {
+ public Artifact getErrorPropagatingMiddlemanArtifact(
+ String middlemanName, String purpose, ArtifactRoot middlemanDir) {
return getStampFileArtifact(middlemanName, purpose, middlemanDir);
}
@@ -150,11 +152,15 @@
* another synchronized method (getArtifact()).
*
* @return null iff {@code inputs} is null or empty; the middleman file and the middleman action
- * otherwise
+ * otherwise
*/
private Pair<Artifact, Action> createMiddleman(
- ActionOwner owner, String middlemanName, String purpose, Iterable<Artifact> inputs,
- Root middlemanDir, MiddlemanType middlemanType) {
+ ActionOwner owner,
+ String middlemanName,
+ String purpose,
+ Iterable<Artifact> inputs,
+ ArtifactRoot middlemanDir,
+ MiddlemanType middlemanType) {
if (inputs == null || CollectionUtils.isEmpty(inputs)) {
return null;
}
@@ -175,8 +181,13 @@
* <p>Note: there's no need to synchronize this method; the only use of a field is via a call to
* another synchronized method (getArtifact()).
*/
- public Artifact createMiddlemanAllowMultiple(ActionRegistry registry, ActionOwner owner,
- PathFragment packageDirectory, String purpose, Iterable<Artifact> inputs, Root middlemanDir) {
+ public Artifact createMiddlemanAllowMultiple(
+ ActionRegistry registry,
+ ActionOwner owner,
+ PathFragment packageDirectory,
+ String purpose,
+ Iterable<Artifact> inputs,
+ ArtifactRoot middlemanDir) {
String escapedPackageDirectory = Actions.escapedPath(packageDirectory.getPathString());
PathFragment stampName =
PathFragment.create("_middlemen/" + (purpose.startsWith(escapedPackageDirectory)
@@ -188,7 +199,8 @@
return stampFile;
}
- private Artifact getStampFileArtifact(String middlemanName, String purpose, Root middlemanDir) {
+ private Artifact getStampFileArtifact(
+ String middlemanName, String purpose, ArtifactRoot middlemanDir) {
String escapedFilename = Actions.escapedPath(middlemanName);
PathFragment stampName = PathFragment.create("_middlemen/" + escapedFilename + "-" + purpose);
Artifact stampFile = artifactFactory.getDerivedArtifact(stampName, middlemanDir,
diff --git a/src/main/java/com/google/devtools/build/lib/actions/PackageRootResolver.java b/src/main/java/com/google/devtools/build/lib/actions/PackageRootResolver.java
index 35a795a..e7529bc 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/PackageRootResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/PackageRootResolver.java
@@ -26,13 +26,14 @@
/**
* Returns mapping from execPath to Root. Root will be null if the path has no containing package.
*
- * @param execPaths the paths to find {@link Root}s for. The search for a containing package will
- * start with the path's parent directory, since the path is assumed to be a file.
- * @return mappings from {@code execPath} to {@link Root}, or null if for some reason we cannot
- * determine the result at this time (such as when used within a SkyFunction)
+ * @param execPaths the paths to find {@link ArtifactRoot}s for. The search for a containing
+ * package will start with the path's parent directory, since the path is assumed to be a
+ * file.
+ * @return mappings from {@code execPath} to {@link ArtifactRoot}, or null if for some reason we
+ * cannot determine the result at this time (such as when used within a SkyFunction)
*/
@Nullable
- Map<PathFragment, Root> findPackageRootsForFiles(Iterable<PathFragment> execPaths)
+ Map<PathFragment, ArtifactRoot> findPackageRootsForFiles(Iterable<PathFragment> execPaths)
throws InterruptedException;
/**
@@ -40,13 +41,14 @@
* Unlike {@link #findPackageRootsForFiles(Iterable)}, this function allows directories in the
* list of exec paths.
*
- * @param execPaths the paths to find {@link Root}s for. The search for a containing package will
- * start with the path's parent directory, since the path is assumed to be a file.
- * @return mappings from {@code execPath} to {@link Root}, or null if for some reason we cannot
- * determine the result at this time (such as when used within a SkyFunction)
+ * @param execPaths the paths to find {@link ArtifactRoot}s for. The search for a containing
+ * package will start with the path's parent directory, since the path is assumed to be a
+ * file.
+ * @return mappings from {@code execPath} to {@link ArtifactRoot}, or null if for some reason we
+ * cannot determine the result at this time (such as when used within a SkyFunction)
*/
// TODO(bazel-team): Remove this once we don't need to find package roots for directories.
@Nullable
- Map<PathFragment, Root> findPackageRoots(Iterable<PathFragment> execPaths)
+ Map<PathFragment, ArtifactRoot> findPackageRoots(Iterable<PathFragment> execPaths)
throws InterruptedException;
}
diff --git a/src/main/java/com/google/devtools/build/lib/actions/PackageRoots.java b/src/main/java/com/google/devtools/build/lib/actions/PackageRoots.java
index 35f7f3f..9275e3f 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/PackageRoots.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/PackageRoots.java
@@ -39,12 +39,12 @@
/** Interface for getting the source root of a package, given its {@link PackageIdentifier}. */
interface PackageRootLookup {
/**
- * Returns the {@link Root} of a package, given its {@link PackageIdentifier}. May be null if
- * the given {@code packageIdentifier} does not correspond to a package in this build. However,
- * if there is a unique source root for all packages, this may return that root even if the
- * {@code packageIdentifier} given does not correspond to any packages.
+ * Returns the {@link ArtifactRoot} of a package, given its {@link PackageIdentifier}. May be
+ * null if the given {@code packageIdentifier} does not correspond to a package in this build.
+ * However, if there is a unique source root for all packages, this may return that root even if
+ * the {@code packageIdentifier} given does not correspond to any packages.
*/
@Nullable
- Root getRootForPackage(PackageIdentifier packageIdentifier);
+ ArtifactRoot getRootForPackage(PackageIdentifier packageIdentifier);
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java b/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java
index 2d7466d..098a04e 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java
@@ -21,8 +21,8 @@
import com.google.devtools.build.lib.actions.ActionKeyContext;
import com.google.devtools.build.lib.actions.ActionRegistry;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.MiddlemanFactory;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoKey;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.events.ExtendedEventHandler;
@@ -52,10 +52,11 @@
/**
* Returns the artifact for the derived file {@code rootRelativePath}.
*
- * <p><b>DO NOT USE</b> in rule implementations. Use
- * {@link RuleContext#getPackageRelativeArtifact(PathFragment, Root)} or
- * {@link RuleContext#getUniqueDirectoryArtifact(String, PathFragment, Root)}, or, if there is
- * really no other way, {@link RuleContext#getShareableArtifact(PathFragment, Root)} instead.
+ * <p><b>DO NOT USE</b> in rule implementations. Use {@link
+ * RuleContext#getPackageRelativeArtifact(PathFragment, ArtifactRoot)} or {@link
+ * RuleContext#getUniqueDirectoryArtifact(String, PathFragment, ArtifactRoot)}, or, if there is
+ * really no other way, {@link RuleContext#getShareableArtifact(PathFragment, ArtifactRoot)}
+ * instead.
*
* <p>Creates the artifact if necessary and sets the root of that artifact to {@code root}.
*
@@ -63,33 +64,32 @@
* artifacts generated by two different rules to clash. To avoid this, use the artifact creation
* method on {@link RuleContext} mentioned above.
*/
- Artifact getDerivedArtifact(PathFragment rootRelativePath, Root root);
+ Artifact getDerivedArtifact(PathFragment rootRelativePath, ArtifactRoot root);
/**
- * Returns an artifact for the derived file {@code rootRelativePath} whose changes do not cause
- * a rebuild.
+ * Returns an artifact for the derived file {@code rootRelativePath} whose changes do not cause a
+ * rebuild.
*
* <p>Creates the artifact if necessary and sets the root of that artifact to {@code root}.
*
* <p>This is useful for files that store data that changes very frequently (e.g. current time)
* but does not substantially affect the result of the build.
*/
- Artifact getConstantMetadataArtifact(PathFragment rootRelativePath,
- Root root);
+ Artifact getConstantMetadataArtifact(PathFragment rootRelativePath, ArtifactRoot root);
/**
* Returns the artifact for the derived TreeArtifact with directory {@code rootRelativePath},
- * creating it if necessary, and setting the root of that artifact to
- * {@code root}. The artifact will be a TreeArtifact.
+ * creating it if necessary, and setting the root of that artifact to {@code root}. The artifact
+ * will be a TreeArtifact.
*/
- Artifact getTreeArtifact(PathFragment rootRelativePath, Root root);
+ Artifact getTreeArtifact(PathFragment rootRelativePath, ArtifactRoot root);
/**
- * Returns the artifact for the derived file {@code rootRelativePath},
- * creating it if necessary, and setting the root of that artifact to
- * {@code root}. The artifact will represent the output directory of a {@code Fileset}.
+ * Returns the artifact for the derived file {@code rootRelativePath}, creating it if necessary,
+ * and setting the root of that artifact to {@code root}. The artifact will represent the output
+ * directory of a {@code Fileset}.
*/
- Artifact getFilesetArtifact(PathFragment rootRelativePath, Root root);
+ Artifact getFilesetArtifact(PathFragment rootRelativePath, ArtifactRoot root);
/**
* Returns the middleman factory associated with the build.
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BlazeDirectories.java b/src/main/java/com/google/devtools/build/lib/analysis/BlazeDirectories.java
index 3e7df15..bbae6b4 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BlazeDirectories.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BlazeDirectories.java
@@ -16,7 +16,7 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.hash.HashCode;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.skyframe.serialization.InjectingObjectCodec;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
@@ -171,8 +171,8 @@
* Returns the configuration-independent root where the build-data should be placed, given the
* {@link BlazeDirectories} of this server instance. Nothing else should be placed here.
*/
- public Root getBuildDataDirectory(String workspaceName) {
- return Root.asDerivedRoot(getExecRoot(workspaceName), getOutputPath(workspaceName));
+ public ArtifactRoot getBuildDataDirectory(String workspaceName) {
+ return ArtifactRoot.asDerivedRoot(getExecRoot(workspaceName), getOutputPath(workspaceName));
}
/**
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/CachingAnalysisEnvironment.java b/src/main/java/com/google/devtools/build/lib/analysis/CachingAnalysisEnvironment.java
index 81d5d2e..94cc572 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/CachingAnalysisEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/CachingAnalysisEnvironment.java
@@ -23,8 +23,8 @@
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactFactory;
import com.google.devtools.build.lib.actions.ArtifactOwner;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.MiddlemanFactory;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoCollection;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoKey;
@@ -233,7 +233,7 @@
}
@Override
- public Artifact getDerivedArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getDerivedArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
Preconditions.checkState(enabled);
return trackArtifactAndOrigin(
artifactFactory.getDerivedArtifact(rootRelativePath, root, getOwner()),
@@ -241,7 +241,7 @@
}
@Override
- public Artifact getTreeArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getTreeArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
Preconditions.checkState(enabled);
return trackArtifactAndOrigin(
artifactFactory.getTreeArtifact(rootRelativePath, root, getOwner()),
@@ -249,7 +249,7 @@
}
@Override
- public Artifact getFilesetArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getFilesetArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
Preconditions.checkState(enabled);
return trackArtifactAndOrigin(
artifactFactory.getFilesetArtifact(rootRelativePath, root, getOwner()),
@@ -257,7 +257,7 @@
}
@Override
- public Artifact getConstantMetadataArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getConstantMetadataArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return artifactFactory.getConstantMetadataArtifact(rootRelativePath, root, getOwner());
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredTargetFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredTargetFactory.java
index 3ad0240..af99802 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredTargetFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredTargetFactory.java
@@ -22,8 +22,8 @@
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactFactory;
import com.google.devtools.build.lib.actions.ArtifactOwner;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.FailAction;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration.Fragment;
import com.google.devtools.build.lib.analysis.config.ConfigMatchingProvider;
@@ -163,9 +163,10 @@
BuildConfiguration configuration, boolean isFileset, ArtifactFactory artifactFactory)
throws InterruptedException {
Rule rule = outputFile.getAssociatedRule();
- Root root = rule.hasBinaryOutput()
- ? configuration.getBinDirectory(rule.getRepository())
- : configuration.getGenfilesDirectory(rule.getRepository());
+ ArtifactRoot root =
+ rule.hasBinaryOutput()
+ ? configuration.getBinDirectory(rule.getRepository())
+ : configuration.getGenfilesDirectory(rule.getRepository());
ArtifactOwner owner =
ConfiguredTargetKey.of(
rule.getLabel(),
@@ -276,7 +277,7 @@
Artifact artifact =
artifactFactory.getSourceArtifact(
inputFile.getExecPath(),
- Root.asSourceRoot(inputFile.getPackage().getSourceRoot()),
+ ArtifactRoot.asSourceRoot(inputFile.getPackage().getSourceRoot()),
ConfiguredTargetKey.of(target.getLabel(), config));
return new InputFileConfiguredTarget(targetContext, inputFile, artifact);
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
index 2e366d9..674fd55 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
@@ -37,7 +37,7 @@
import com.google.devtools.build.lib.actions.ActionRegistry;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactOwner;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider.PrerequisiteValidator;
import com.google.devtools.build.lib.analysis.actions.ActionConstructionContext;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoKey;
@@ -269,12 +269,12 @@
}
@Override
- public Root getBinDirectory() {
+ public ArtifactRoot getBinDirectory() {
return getConfiguration().getBinDirectory(rule.getRepository());
}
@Override
- public Root getMiddlemanDirectory() {
+ public ArtifactRoot getMiddlemanDirectory() {
return getConfiguration().getMiddlemanDirectory(rule.getRepository());
}
@@ -565,27 +565,26 @@
target.getLabel().getPackageIdentifier().equals(getLabel().getPackageIdentifier()),
"Creating output artifact for target '%s' in different package than the rule '%s' "
+ "being analyzed", target.getLabel(), getLabel());
- Root root = getBinOrGenfilesDirectory();
+ ArtifactRoot root = getBinOrGenfilesDirectory();
return getPackageRelativeArtifact(target.getName(), root);
}
/**
- * Returns the root of either the "bin" or "genfiles"
- * tree, based on this target and the current configuration.
- * The choice of which tree to use is based on the rule with
- * which this target (which must be an OutputFile or a Rule) is associated.
+ * Returns the root of either the "bin" or "genfiles" tree, based on this target and the current
+ * configuration. The choice of which tree to use is based on the rule with which this target
+ * (which must be an OutputFile or a Rule) is associated.
*/
- public Root getBinOrGenfilesDirectory() {
+ public ArtifactRoot getBinOrGenfilesDirectory() {
return rule.hasBinaryOutput()
? getConfiguration().getBinDirectory(rule.getRepository())
: getConfiguration().getGenfilesDirectory(rule.getRepository());
}
/**
- * Creates an artifact in a directory that is unique to the package that contains the rule,
- * thus guaranteeing that it never clashes with artifacts created by rules in other packages.
+ * Creates an artifact in a directory that is unique to the package that contains the rule, thus
+ * guaranteeing that it never clashes with artifacts created by rules in other packages.
*/
- public Artifact getPackageRelativeArtifact(String relative, Root root) {
+ public Artifact getPackageRelativeArtifact(String relative, ArtifactRoot root) {
return getPackageRelativeArtifact(PathFragment.create(relative), root);
}
@@ -620,18 +619,18 @@
* option.
*
* <p>This artifact can be created anywhere in the output tree, which, in addition to making
- * sharing possible, opens up the possibility of action conflicts and makes it impossible to
- * infer the label of the rule creating the artifact from the path of the artifact.
+ * sharing possible, opens up the possibility of action conflicts and makes it impossible to infer
+ * the label of the rule creating the artifact from the path of the artifact.
*/
- public Artifact getShareableArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getShareableArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return getAnalysisEnvironment().getDerivedArtifact(rootRelativePath, root);
}
/**
- * Creates an artifact in a directory that is unique to the package that contains the rule,
- * thus guaranteeing that it never clashes with artifacts created by rules in other packages.
+ * Creates an artifact in a directory that is unique to the package that contains the rule, thus
+ * guaranteeing that it never clashes with artifacts created by rules in other packages.
*/
- public Artifact getPackageRelativeArtifact(PathFragment relative, Root root) {
+ public Artifact getPackageRelativeArtifact(PathFragment relative, ArtifactRoot root) {
return getDerivedArtifact(getPackageDirectory().getRelative(relative), root);
}
@@ -639,15 +638,16 @@
* Returns the root-relative path fragment under which output artifacts of this rule should go.
*
* <p>Note that:
+ *
* <ul>
* <li>This doesn't guarantee that there are no clashes with rules in the same package.
- * <li>If possible, {@link #getPackageRelativeArtifact(PathFragment, Root)} should be used
- * instead of this method.
+ * <li>If possible, {@link #getPackageRelativeArtifact(PathFragment, ArtifactRoot)} should be
+ * used instead of this method.
* </ul>
*
* Ideally, user-visible artifacts should all have corresponding output file targets, all others
- * should go into a rule-specific directory.
- * {@link #getUniqueDirectoryArtifact(String, PathFragment, Root)}) ensures that this is the case.
+ * should go into a rule-specific directory. {@link #getUniqueDirectoryArtifact(String,
+ * PathFragment, ArtifactRoot)}) ensures that this is the case.
*/
public PathFragment getPackageDirectory() {
return getLabel().getPackageIdentifier().getSourceRoot();
@@ -661,7 +661,7 @@
* method.
*/
@Override
- public Artifact getDerivedArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getDerivedArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
Preconditions.checkState(rootRelativePath.startsWith(getPackageDirectory()),
"Output artifact '%s' not under package directory '%s' for target '%s'",
rootRelativePath, getPackageDirectory(), getLabel());
@@ -675,7 +675,7 @@
* thus ensuring that it doesn't clash with other artifacts generated by other rules using this
* method.
*/
- public Artifact getTreeArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getTreeArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
Preconditions.checkState(rootRelativePath.startsWith(getPackageDirectory()),
"Output artifact '%s' not under package directory '%s' for target '%s'",
rootRelativePath, getPackageDirectory(), getLabel());
@@ -686,7 +686,7 @@
* Creates a tree artifact in a directory that is unique to the package that contains the rule,
* thus guaranteeing that it never clashes with artifacts created by rules in other packages.
*/
- public Artifact getPackageRelativeTreeArtifact(PathFragment relative, Root root) {
+ public Artifact getPackageRelativeTreeArtifact(PathFragment relative, ArtifactRoot root) {
return getTreeArtifact(getPackageDirectory().getRelative(relative), root);
}
@@ -695,7 +695,7 @@
* clashes with artifacts created by other rules.
*/
public Artifact getUniqueDirectoryArtifact(
- String uniqueDirectory, String relative, Root root) {
+ String uniqueDirectory, String relative, ArtifactRoot root) {
return getUniqueDirectoryArtifact(uniqueDirectory, PathFragment.create(relative), root);
}
@@ -704,7 +704,7 @@
* clashes with artifacts created by other rules.
*/
public Artifact getUniqueDirectoryArtifact(
- String uniqueDirectory, PathFragment relative, Root root) {
+ String uniqueDirectory, PathFragment relative, ArtifactRoot root) {
return getDerivedArtifact(getUniqueDirectory(uniqueDirectory).getRelative(relative), root);
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java b/src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java
index 9a9eee3..082c122 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java
@@ -14,8 +14,8 @@
package com.google.devtools.build.lib.analysis;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.PackageRootResolver;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.events.ExtendedEventHandler;
import com.google.devtools.build.lib.skyframe.SkyframeExecutor;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -37,14 +37,14 @@
}
@Override
- public Map<PathFragment, Root> findPackageRootsForFiles(Iterable<PathFragment> execPaths)
+ public Map<PathFragment, ArtifactRoot> findPackageRootsForFiles(Iterable<PathFragment> execPaths)
throws InterruptedException {
return executor.getArtifactRootsForFiles(eventHandler, execPaths);
}
-
+
@Override
@Nullable
- public Map<PathFragment, Root> findPackageRoots(Iterable<PathFragment> execPaths)
+ public Map<PathFragment, ArtifactRoot> findPackageRoots(Iterable<PathFragment> execPaths)
throws InterruptedException {
return executor.getArtifactRoots(eventHandler, execPaths);
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/ActionConstructionContext.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/ActionConstructionContext.java
index 3b10c5a..1eefb53 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/ActionConstructionContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/ActionConstructionContext.java
@@ -15,7 +15,7 @@
import com.google.devtools.build.lib.actions.ActionOwner;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.AnalysisEnvironment;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.platform.PlatformInfo;
@@ -28,15 +28,11 @@
*/
public interface ActionConstructionContext {
- /**
- * Returns the bin directory for constructed actions.
- */
- Root getBinDirectory();
+ /** Returns the bin directory for constructed actions. */
+ ArtifactRoot getBinDirectory();
- /**
- * Returns the internal directory (used for middlemen) for constructed actions.
- */
- Root getMiddlemanDirectory();
+ /** Returns the internal directory (used for middlemen) for constructed actions. */
+ ArtifactRoot getMiddlemanDirectory();
/** Returns the action owner that should be used for actions. */
ActionOwner getActionOwner();
@@ -54,7 +50,7 @@
* thus ensuring that it doesn't clash with other artifacts generated by other rules using this
* method.
*/
- Artifact getDerivedArtifact(PathFragment rootRelativePath, Root root);
+ Artifact getDerivedArtifact(PathFragment rootRelativePath, ArtifactRoot root);
/** Returns the {@link PlatformInfo} describing the execution platform this action should use. */
@Nullable
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/buildinfo/BuildInfoFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/buildinfo/BuildInfoFactory.java
index 07e9918..468fb27 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/buildinfo/BuildInfoFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/buildinfo/BuildInfoFactory.java
@@ -14,11 +14,10 @@
package com.google.devtools.build.lib.analysis.buildinfo;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.io.Serializable;
/**
@@ -47,7 +46,8 @@
* Context for the creation of build-info artifacts.
*/
interface BuildInfoContext {
- Artifact getBuildInfoArtifact(PathFragment rootRelativePath, Root root, BuildInfoType type);
+ Artifact getBuildInfoArtifact(
+ PathFragment rootRelativePath, ArtifactRoot root, BuildInfoType type);
}
/**
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
index 9b6f5d1..10daadd 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
@@ -34,7 +34,7 @@
import com.google.common.collect.Multimap;
import com.google.common.collect.MutableClassToInstanceMap;
import com.google.devtools.build.lib.actions.ActionEnvironment;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider;
import com.google.devtools.build.lib.analysis.RuleContext;
@@ -1185,8 +1185,10 @@
this.middleman = false;
}
- Root getRoot(
- RepositoryName repositoryName, String outputDirName, BlazeDirectories directories,
+ ArtifactRoot getRoot(
+ RepositoryName repositoryName,
+ String outputDirName,
+ BlazeDirectories directories,
RepositoryName mainRepositoryName) {
// e.g., execroot/repo1
Path execRoot = directories.getExecRoot(mainRepositoryName.strippedName());
@@ -1194,10 +1196,11 @@
Path outputDir = execRoot.getRelative(directories.getRelativeOutputPath())
.getRelative(outputDirName);
if (middleman) {
- return INTERNER.intern(Root.middlemanRoot(execRoot, outputDir));
+ return INTERNER.intern(ArtifactRoot.middlemanRoot(execRoot, outputDir));
}
// e.g., [[execroot/repo1]/bazel-out/config/bin]
- return INTERNER.intern(Root.asDerivedRoot(execRoot, outputDir.getRelative(nameFragment)));
+ return INTERNER.intern(
+ ArtifactRoot.asDerivedRoot(execRoot, outputDir.getRelative(nameFragment)));
}
}
@@ -1206,16 +1209,16 @@
// We intern the roots for non-main repositories, so we don't keep around thousands of copies of
// the same root.
- private static Interner<Root> INTERNER = Interners.newWeakInterner();
+ private static Interner<ArtifactRoot> INTERNER = Interners.newWeakInterner();
// We precompute the roots for the main repository, since that's the common case.
- private final Root outputDirectoryForMainRepository;
- private final Root binDirectoryForMainRepository;
- private final Root includeDirectoryForMainRepository;
- private final Root genfilesDirectoryForMainRepository;
- private final Root coverageDirectoryForMainRepository;
- private final Root testlogsDirectoryForMainRepository;
- private final Root middlemanDirectoryForMainRepository;
+ private final ArtifactRoot outputDirectoryForMainRepository;
+ private final ArtifactRoot binDirectoryForMainRepository;
+ private final ArtifactRoot includeDirectoryForMainRepository;
+ private final ArtifactRoot genfilesDirectoryForMainRepository;
+ private final ArtifactRoot coverageDirectoryForMainRepository;
+ private final ArtifactRoot testlogsDirectoryForMainRepository;
+ private final ArtifactRoot middlemanDirectoryForMainRepository;
private final boolean separateGenfilesDirectory;
@@ -1575,22 +1578,18 @@
return platformName;
}
- /**
- * Returns the output directory for this build configuration.
- */
- public Root getOutputDirectory(RepositoryName repositoryName) {
+ /** Returns the output directory for this build configuration. */
+ public ArtifactRoot getOutputDirectory(RepositoryName repositoryName) {
return repositoryName.isMain() || repositoryName.equals(mainRepositoryName)
? outputDirectoryForMainRepository
: OutputDirectory.OUTPUT.getRoot(
repositoryName, outputDirName, directories, mainRepositoryName);
}
- /**
- * Returns the bin directory for this build configuration.
- */
+ /** Returns the bin directory for this build configuration. */
@SkylarkCallable(name = "bin_dir", structField = true, documented = false)
@Deprecated
- public Root getBinDirectory() {
+ public ArtifactRoot getBinDirectory() {
return getBinDirectory(RepositoryName.MAIN);
}
@@ -1600,7 +1599,7 @@
* issue right now because it only effects Blaze's include scanning (internal) and Bazel's
* repositories (external) but will need to be fixed.
*/
- public Root getBinDirectory(RepositoryName repositoryName) {
+ public ArtifactRoot getBinDirectory(RepositoryName repositoryName) {
return repositoryName.isMain() || repositoryName.equals(mainRepositoryName)
? binDirectoryForMainRepository
: OutputDirectory.BIN.getRoot(
@@ -1614,26 +1613,22 @@
return getBinDirectory().getExecPath();
}
- /**
- * Returns the include directory for this build configuration.
- */
- public Root getIncludeDirectory(RepositoryName repositoryName) {
+ /** Returns the include directory for this build configuration. */
+ public ArtifactRoot getIncludeDirectory(RepositoryName repositoryName) {
return repositoryName.isMain() || repositoryName.equals(mainRepositoryName)
? includeDirectoryForMainRepository
: OutputDirectory.INCLUDE.getRoot(
repositoryName, outputDirName, directories, mainRepositoryName);
}
- /**
- * Returns the genfiles directory for this build configuration.
- */
+ /** Returns the genfiles directory for this build configuration. */
@SkylarkCallable(name = "genfiles_dir", structField = true, documented = false)
@Deprecated
- public Root getGenfilesDirectory() {
+ public ArtifactRoot getGenfilesDirectory() {
return getGenfilesDirectory(RepositoryName.MAIN);
}
- public Root getGenfilesDirectory(RepositoryName repositoryName) {
+ public ArtifactRoot getGenfilesDirectory(RepositoryName repositoryName) {
if (!separateGenfilesDirectory) {
return getBinDirectory(repositoryName);
}
@@ -1645,21 +1640,19 @@
}
/**
- * Returns the directory where coverage-related artifacts and metadata files
- * should be stored. This includes for example uninstrumented class files
- * needed for Jacoco's coverage reporting tools.
+ * Returns the directory where coverage-related artifacts and metadata files should be stored.
+ * This includes for example uninstrumented class files needed for Jacoco's coverage reporting
+ * tools.
*/
- public Root getCoverageMetadataDirectory(RepositoryName repositoryName) {
+ public ArtifactRoot getCoverageMetadataDirectory(RepositoryName repositoryName) {
return repositoryName.isMain() || repositoryName.equals(mainRepositoryName)
? coverageDirectoryForMainRepository
: OutputDirectory.COVERAGE.getRoot(
repositoryName, outputDirName, directories, mainRepositoryName);
}
- /**
- * Returns the testlogs directory for this build configuration.
- */
- public Root getTestLogsDirectory(RepositoryName repositoryName) {
+ /** Returns the testlogs directory for this build configuration. */
+ public ArtifactRoot getTestLogsDirectory(RepositoryName repositoryName) {
return repositoryName.isMain() || repositoryName.equals(mainRepositoryName)
? testlogsDirectoryForMainRepository
: OutputDirectory.TESTLOGS.getRoot(
@@ -1686,10 +1679,8 @@
return OS.getCurrent() == OS.WINDOWS ? ";" : ":";
}
- /**
- * Returns the internal directory (used for middlemen) for this build configuration.
- */
- public Root getMiddlemanDirectory(RepositoryName repositoryName) {
+ /** Returns the internal directory (used for middlemen) for this build configuration. */
+ public ArtifactRoot getMiddlemanDirectory(RepositoryName repositoryName) {
return repositoryName.isMain() || repositoryName.equals(mainRepositoryName)
? middlemanDirectoryForMainRepository
: OutputDirectory.MIDDLEMAN.getRoot(
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java
index e77b159..4bf9999 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java
@@ -18,8 +18,8 @@
import com.google.devtools.build.lib.actions.Action;
import com.google.devtools.build.lib.actions.ActionAnalysisMetadata;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.ParameterFile.ParameterFileType;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.RunfilesSupplier;
import com.google.devtools.build.lib.actions.extra.SpawnInfo;
import com.google.devtools.build.lib.analysis.CommandHelper;
@@ -94,7 +94,7 @@
this.ruleContext = ruleContext;
}
- Root newFileRoot() throws EvalException {
+ ArtifactRoot newFileRoot() throws EvalException {
return context.isForAspect()
? ruleContext.getConfiguration().getBinDirectory(ruleContext.getRule().getRepository())
: ruleContext.getBinOrGenfilesDirectory();
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
index 3dbb8d9..de2bd46 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
@@ -25,7 +25,7 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Ordering;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.ActionsProvider;
import com.google.devtools.build.lib.analysis.ConfigurationMakeVariableContext;
import com.google.devtools.build.lib.analysis.DefaultInfo;
@@ -708,16 +708,22 @@
return ImmutableList.copyOf(ruleContext.getFeatures());
}
- @SkylarkCallable(name = "bin_dir", structField = true,
- doc = "The root corresponding to bin directory.")
- public Root getBinDirectory() throws EvalException {
+ @SkylarkCallable(
+ name = "bin_dir",
+ structField = true,
+ doc = "The root corresponding to bin directory."
+ )
+ public ArtifactRoot getBinDirectory() throws EvalException {
checkMutable("bin_dir");
return getConfiguration().getBinDirectory(ruleContext.getRule().getRepository());
}
- @SkylarkCallable(name = "genfiles_dir", structField = true,
- doc = "The root corresponding to genfiles directory.")
- public Root getGenfilesDirectory() throws EvalException {
+ @SkylarkCallable(
+ name = "genfiles_dir",
+ structField = true,
+ doc = "The root corresponding to genfiles directory."
+ )
+ public ArtifactRoot getGenfilesDirectory() throws EvalException {
checkMutable("genfiles_dir");
return getConfiguration().getGenfilesDirectory(ruleContext.getRule().getRepository());
}
@@ -845,7 +851,7 @@
// Kept for compatibility with old code.
@SkylarkCallable(documented = false)
- public Artifact newFile(Root root, String filename) throws EvalException {
+ public Artifact newFile(ArtifactRoot root, String filename) throws EvalException {
checkMutable("new_file");
return ruleContext.getPackageRelativeArtifact(filename, root);
}
@@ -877,7 +883,8 @@
// Kept for compatibility with old code.
@SkylarkCallable(documented = false)
- public Artifact newFile(Root root, Artifact baseArtifact, String suffix) throws EvalException {
+ public Artifact newFile(ArtifactRoot root, Artifact baseArtifact, String suffix)
+ throws EvalException {
checkMutable("new_file");
PathFragment original = baseArtifact.getRootRelativePath();
PathFragment fragment = original.replaceName(original.getBaseName() + suffix);
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/TestActionBuilder.java b/src/main/java/com/google/devtools/build/lib/analysis/test/TestActionBuilder.java
index 81d6993..37cfbbe 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/test/TestActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/test/TestActionBuilder.java
@@ -21,7 +21,7 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.AnalysisEnvironment;
import com.google.devtools.build.lib.analysis.FileProvider;
import com.google.devtools.build.lib.analysis.FilesToRunProvider;
@@ -187,7 +187,7 @@
PathFragment targetName = PathFragment.create(ruleContext.getLabel().getName());
BuildConfiguration config = ruleContext.getConfiguration();
AnalysisEnvironment env = ruleContext.getAnalysisEnvironment();
- Root root = config.getTestLogsDirectory(ruleContext.getRule().getRepository());
+ ArtifactRoot root = config.getTestLogsDirectory(ruleContext.getRule().getRepository());
NestedSetBuilder<Artifact> inputsBuilder = NestedSetBuilder.stableOrder();
inputsBuilder.addTransitive(
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java b/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java
index e3e405b..1fd392d 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/BazelWorkspaceStatusModule.java
@@ -30,8 +30,8 @@
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactFactory;
import com.google.devtools.build.lib.actions.ArtifactOwner;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.ExecutionStrategy;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.BuildInfo;
import com.google.devtools.build.lib.analysis.BuildInfoEvent;
@@ -304,7 +304,7 @@
public WorkspaceStatusAction createWorkspaceStatusAction(
ArtifactFactory factory, ArtifactOwner artifactOwner, Supplier<UUID> buildId,
String workspaceName) {
- Root root = env.getDirectories().getBuildDataDirectory(workspaceName);
+ ArtifactRoot root = env.getDirectories().getBuildDataDirectory(workspaceName);
Artifact stableArtifact = factory.getDerivedArtifact(
PathFragment.create("stable-status.txt"), root, artifactOwner);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcIncLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcIncLibrary.java
index c1a40fc..a459e42 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcIncLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcIncLibrary.java
@@ -17,7 +17,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSortedMap;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.RuleConfiguredTargetBuilder;
import com.google.devtools.build.lib.analysis.RuleConfiguredTargetFactory;
@@ -85,7 +85,7 @@
// is actually a symlink into the source tree.
PathFragment includeDirectory = PathFragment.create("_")
.getRelative(ruleContext.getTarget().getName());
- Root configIncludeDirectory =
+ ArtifactRoot configIncludeDirectory =
ruleContext.getConfiguration().getIncludeDirectory(ruleContext.getRule().getRepository());
PathFragment includePath =
configIncludeDirectory
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppBuildInfo.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppBuildInfo.java
index 8e49f99..1c68580 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppBuildInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppBuildInfo.java
@@ -16,13 +16,12 @@
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.actions.Action;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoCollection;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -69,7 +68,7 @@
BuildConfiguration config, PathFragment headerName,
Collection<Artifact> inputs,
boolean writeVolatileInfo, boolean writeNonVolatileInfo, RepositoryName repositoryName) {
- Root outputPath = config.getIncludeDirectory(repositoryName);
+ ArtifactRoot outputPath = config.getIncludeDirectory(repositoryName);
final Artifact header =
buildInfoContext.getBuildInfoArtifact(headerName, outputPath,
writeVolatileInfo && !inputs.isEmpty()
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
index 738cc98..8edc2d9 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java
@@ -26,7 +26,7 @@
import com.google.common.collect.Iterables;
import com.google.common.io.ByteSource;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.AnalysisEnvironment;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.cmdline.Label;
@@ -172,14 +172,13 @@
private final Path fdoProfile;
/**
- * Temporary directory to which the coverage ZIP file is extracted to
- * (relative to the exec root), or {@code null} if FDO optimization is
- * disabled. This is used to create artifacts for the extracted files.
+ * Temporary directory to which the coverage ZIP file is extracted to (relative to the exec root),
+ * or {@code null} if FDO optimization is disabled. This is used to create artifacts for the
+ * extracted files.
*
- * <p>Note that this root is intentionally not registered with the artifact
- * factory.
+ * <p>Note that this root is intentionally not registered with the artifact factory.
*/
- private final Root fdoRoot;
+ private final ArtifactRoot fdoRoot;
/**
* The relative path of the FDO root to the exec root.
@@ -227,8 +226,14 @@
* @param fdoProfile path to the profile file passed to --fdo_optimize option
* @param lipoMode value of the --lipo_mode option
*/
- private FdoSupport(FdoMode fdoMode, LipoMode lipoMode, Root fdoRoot, PathFragment fdoRootExecPath,
- PathFragment fdoInstrument, Path fdoProfile, FdoZipContents fdoZipContents) {
+ private FdoSupport(
+ FdoMode fdoMode,
+ LipoMode lipoMode,
+ ArtifactRoot fdoRoot,
+ PathFragment fdoRootExecPath,
+ PathFragment fdoInstrument,
+ Path fdoProfile,
+ FdoZipContents fdoZipContents) {
this.fdoInstrument = fdoInstrument;
this.fdoProfile = fdoProfile;
this.fdoRoot = fdoRoot;
@@ -248,7 +253,7 @@
}
}
- public Root getFdoRoot() {
+ public ArtifactRoot getFdoRoot() {
return fdoRoot;
}
@@ -281,10 +286,10 @@
lipoMode = LipoMode.OFF;
}
- Root fdoRoot =
+ ArtifactRoot fdoRoot =
(fdoProfile == null)
? null
- : Root.asDerivedRoot(execRoot, execRoot.getRelative(productName + "-fdo"));
+ : ArtifactRoot.asDerivedRoot(execRoot, execRoot.getRelative(productName + "-fdo"));
PathFragment fdoRootExecPath = fdoProfile == null
? null
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java
index 7f14ee2..7d60680 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java
@@ -25,7 +25,7 @@
import com.google.devtools.build.lib.actions.ActionResult;
import com.google.devtools.build.lib.actions.Actions;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
@@ -149,7 +149,7 @@
Preconditions.checkArgument(!library.getRootRelativePath().getSegment(0).startsWith("_solib_"));
// Ignore libraries that are already represented by the symlinks.
- Root root = configuration.getBinDirectory(ruleContext.getRule().getRepository());
+ ArtifactRoot root = configuration.getBinDirectory(ruleContext.getRule().getRepository());
Artifact symlink = ruleContext.getShareableArtifact(symlinkName, root);
ruleContext.registerAction(
new SolibSymlinkAction(ruleContext.getActionOwner(), library, symlink));
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaBuildInfoFactory.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaBuildInfoFactory.java
index be7abfb..c372146 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaBuildInfoFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaBuildInfoFactory.java
@@ -17,7 +17,7 @@
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.actions.Action;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoCollection;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
@@ -126,7 +126,7 @@
boolean includeVolatile,
boolean includeNonVolatile,
RepositoryName repositoryName) {
- Root outputPath = config.getIncludeDirectory(repositoryName);
+ ArtifactRoot outputPath = config.getIncludeDirectory(repositoryName);
final Artifact output = context.getBuildInfoArtifact(propertyFileName, outputPath,
includeVolatile && !inputs.isEmpty() ? BuildInfoType.NO_REBUILD
: BuildInfoType.FORCE_REBUILD_IF_CHANGED);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
index 62bce38..7bc087b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
@@ -32,10 +32,10 @@
import com.google.devtools.build.lib.actions.ActionOwner;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactOwner;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.CommandLineExpansionException;
import com.google.devtools.build.lib.actions.ParameterFile;
import com.google.devtools.build.lib.actions.ResourceSet;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.RunfilesSupplier;
import com.google.devtools.build.lib.actions.extra.ExtraActionInfo;
import com.google.devtools.build.lib.actions.extra.JavaCompileInfo;
@@ -474,17 +474,15 @@
*/
public interface ArtifactFactory {
- /**
- * Create an artifact with the specified root-relative path under the specified root.
- */
- Artifact create(PathFragment rootRelativePath, Root root);
+ /** Create an artifact with the specified root-relative path under the specified root. */
+ Artifact create(PathFragment rootRelativePath, ArtifactRoot root);
}
@VisibleForTesting
static ArtifactFactory createArtifactFactory(final AnalysisEnvironment env) {
return new ArtifactFactory() {
@Override
- public Artifact create(PathFragment rootRelativePath, Root root) {
+ public Artifact create(PathFragment rootRelativePath, ArtifactRoot root) {
return env.getDerivedArtifact(rootRelativePath, root);
}
};
@@ -557,15 +555,17 @@
* Creates a Builder from an owner and a build configuration.
*/
public Builder(final RuleContext ruleContext, JavaSemantics semantics) {
- this(ruleContext.getActionOwner(),
+ this(
+ ruleContext.getActionOwner(),
ruleContext.getAnalysisEnvironment(),
new ArtifactFactory() {
@Override
- public Artifact create(PathFragment rootRelativePath, Root root) {
+ public Artifact create(PathFragment rootRelativePath, ArtifactRoot root) {
return ruleContext.getDerivedArtifact(rootRelativePath, root);
}
},
- ruleContext.getConfiguration(), semantics);
+ ruleContext.getConfiguration(),
+ semantics);
}
public JavaCompileAction build() {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java b/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java
index 55a8efe..7f6437e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java
@@ -19,7 +19,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.actions.SymlinkAction;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
@@ -175,7 +175,7 @@
CcToolchainProvider toolchain,
Artifact nativeDeps,
String libraryIdentifier,
- Root bindirIfShared,
+ ArtifactRoot bindirIfShared,
boolean useDynamicRuntime,
CppSemantics cppSemantics)
throws InterruptedException {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java b/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java
index 459de19..4619758 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java
@@ -17,7 +17,7 @@
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.cmdline.Label;
@@ -244,7 +244,7 @@
}
private Artifact scopedArtifact(PathFragment scopeRelative, boolean inGenfiles) {
- Root root =
+ ArtifactRoot root =
inGenfiles
? buildConfiguration.getGenfilesDirectory(ruleContext.getRule().getRepository())
: buildConfiguration.getBinDirectory(ruleContext.getRule().getRepository());
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCommon.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCommon.java
index 3d2d555..a09a9af 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCommon.java
@@ -20,7 +20,7 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.Runfiles;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
@@ -142,8 +142,8 @@
public static ImmutableList<Artifact> getGeneratedOutputs(RuleContext ruleContext,
ImmutableList<Artifact> protoSources, String extension, boolean pythonNames) {
ImmutableList.Builder<Artifact> outputsBuilder = new ImmutableList.Builder<>();
- Root genfiles = ruleContext.getConfiguration().getGenfilesDirectory(
- ruleContext.getRule().getRepository());
+ ArtifactRoot genfiles =
+ ruleContext.getConfiguration().getGenfilesDirectory(ruleContext.getRule().getRepository());
for (Artifact src : protoSources) {
PathFragment srcPath = src.getRootRelativePath();
if (pythonNames) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PythonUtils.java b/src/main/java/com/google/devtools/build/lib/rules/python/PythonUtils.java
index c44e46e..d76b55b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/python/PythonUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PythonUtils.java
@@ -15,7 +15,7 @@
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.FilesToRunProvider;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.Runfiles;
@@ -82,8 +82,8 @@
* subdirectory to avoid conflicts (eg. when the input file is generated).
*/
private static Artifact get2to3OutputArtifact(RuleContext ruleContext, Artifact input) {
- Root root = ruleContext.getConfiguration().getGenfilesDirectory(
- ruleContext.getRule().getRepository());
+ ArtifactRoot root =
+ ruleContext.getConfiguration().getGenfilesDirectory(ruleContext.getRule().getRepository());
PathFragment path = PathFragment.create("python3").getRelative(input.getRootRelativePath());
return ruleContext.getShareableArtifact(path, root);
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
index 4643235..52b9b26 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
@@ -29,10 +29,10 @@
import com.google.devtools.build.lib.actions.ActionLookupValue;
import com.google.devtools.build.lib.actions.AlreadyReportedActionExecutionException;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.MissingInputFileException;
import com.google.devtools.build.lib.actions.NotifyOnActionCacheHit;
import com.google.devtools.build.lib.actions.PackageRootResolver;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.causes.Cause;
import com.google.devtools.build.lib.causes.LabelCause;
import com.google.devtools.build.lib.clock.BlazeClock;
@@ -288,8 +288,8 @@
}
@Override
- public Map<PathFragment, Root> findPackageRootsForFiles(Iterable<PathFragment> execPaths)
- throws InterruptedException {
+ public Map<PathFragment, ArtifactRoot> findPackageRootsForFiles(
+ Iterable<PathFragment> execPaths) throws InterruptedException {
Preconditions.checkState(keysRequested.isEmpty(),
"resolver should only be called once: %s %s", keysRequested, execPaths);
// Create SkyKeys list based on execPaths.
@@ -318,7 +318,7 @@
return null;
}
- Map<PathFragment, Root> result = new HashMap<>();
+ Map<PathFragment, ArtifactRoot> result = new HashMap<>();
for (PathFragment path : execPaths) {
if (!depKeys.containsKey(path)) {
continue;
@@ -327,8 +327,9 @@
(ContainingPackageLookupValue) values.get(depKeys.get(path));
if (value.hasContainingPackage()) {
// We have found corresponding root for current execPath.
- result.put(path,
- Root.computeSourceRoot(
+ result.put(
+ path,
+ ArtifactRoot.computeSourceRoot(
value.getContainingPackageRoot(),
value.getContainingPackageName().getRepository()));
} else {
@@ -341,7 +342,7 @@
@Override
@Nullable
- public Map<PathFragment, Root> findPackageRoots(Iterable<PathFragment> execPaths)
+ public Map<PathFragment, ArtifactRoot> findPackageRoots(Iterable<PathFragment> execPaths)
throws InterruptedException {
// call sites for this implementation of PackageRootResolver shouldn't be passing in
// directories.
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionFunction.java
index c80875d..b8cbd4a 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionFunction.java
@@ -19,7 +19,7 @@
import com.google.devtools.build.lib.actions.ActionKeyContext;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactFactory;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoContext;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoKey;
@@ -70,15 +70,16 @@
nameValue.getName());
final ArtifactFactory factory = artifactFactory.get();
- BuildInfoContext context = new BuildInfoContext() {
- @Override
- public Artifact getBuildInfoArtifact(PathFragment rootRelativePath, Root root,
- BuildInfoType type) {
- return type == BuildInfoType.NO_REBUILD
- ? factory.getConstantMetadataArtifact(rootRelativePath, root, keyAndConfig)
- : factory.getDerivedArtifact(rootRelativePath, root, keyAndConfig);
- }
- };
+ BuildInfoContext context =
+ new BuildInfoContext() {
+ @Override
+ public Artifact getBuildInfoArtifact(
+ PathFragment rootRelativePath, ArtifactRoot root, BuildInfoType type) {
+ return type == BuildInfoType.NO_REBUILD
+ ? factory.getConstantMetadataArtifact(rootRelativePath, root, keyAndConfig)
+ : factory.getDerivedArtifact(rootRelativePath, root, keyAndConfig);
+ }
+ };
return new BuildInfoCollectionValue(
actionKeyContext,
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/MapAsPackageRoots.java b/src/main/java/com/google/devtools/build/lib/skyframe/MapAsPackageRoots.java
index f969c02..f4ac69f 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/MapAsPackageRoots.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/MapAsPackageRoots.java
@@ -15,8 +15,8 @@
package com.google.devtools.build.lib.skyframe;
import com.google.common.collect.ImmutableMap;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.PackageRoots;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.vfs.Path;
import java.util.HashMap;
@@ -41,12 +41,12 @@
@Override
public PackageRootLookup getPackageRootLookup() {
- Map<Path, Root> rootMap = new HashMap<>();
- Map<PackageIdentifier, Root> realPackageRoots = new HashMap<>();
+ Map<Path, ArtifactRoot> rootMap = new HashMap<>();
+ Map<PackageIdentifier, ArtifactRoot> realPackageRoots = new HashMap<>();
for (Map.Entry<PackageIdentifier, Path> entry : packageRootsMap.entrySet()) {
- Root root = rootMap.get(entry.getValue());
+ ArtifactRoot root = rootMap.get(entry.getValue());
if (root == null) {
- root = Root.asSourceRoot(entry.getValue());
+ root = ArtifactRoot.asSourceRoot(entry.getValue());
rootMap.put(entry.getValue(), root);
}
realPackageRoots.put(entry.getKey(), root);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageRootsNoSymlinkCreation.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageRootsNoSymlinkCreation.java
index d1ee84f..16f03e7 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageRootsNoSymlinkCreation.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageRootsNoSymlinkCreation.java
@@ -16,8 +16,8 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.PackageRoots;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.vfs.Path;
import java.util.Optional;
@@ -27,11 +27,11 @@
* whose {@link PackageRootLookup} returns the unique source root for any given package identifier.
*/
public class PackageRootsNoSymlinkCreation implements PackageRoots {
- private final Root sourceRoot;
+ private final ArtifactRoot sourceRoot;
@VisibleForTesting
public PackageRootsNoSymlinkCreation(Path sourcePath) {
- this.sourceRoot = Root.asSourceRoot(sourcePath);
+ this.sourceRoot = ArtifactRoot.asSourceRoot(sourcePath);
}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
index 429caf8..2038e11 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
@@ -48,11 +48,11 @@
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactFactory;
import com.google.devtools.build.lib.actions.ArtifactOwner;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.EnvironmentalExecException;
import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.actions.FileStateType;
import com.google.devtools.build.lib.actions.ResourceManager;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.AspectCollection;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ConfiguredAspect;
@@ -830,19 +830,19 @@
return ImmutableList.of(value.getStableArtifact(), value.getVolatileArtifact());
}
- public Map<PathFragment, Root> getArtifactRootsForFiles(
+ public Map<PathFragment, ArtifactRoot> getArtifactRootsForFiles(
final ExtendedEventHandler eventHandler, Iterable<PathFragment> execPaths)
throws InterruptedException {
return getArtifactRoots(eventHandler, execPaths, true);
}
- public Map<PathFragment, Root> getArtifactRoots(
+ public Map<PathFragment, ArtifactRoot> getArtifactRoots(
final ExtendedEventHandler eventHandler, Iterable<PathFragment> execPaths)
throws InterruptedException {
return getArtifactRoots(eventHandler, execPaths, false);
}
- private Map<PathFragment, Root> getArtifactRoots(
+ private Map<PathFragment, ArtifactRoot> getArtifactRoots(
final ExtendedEventHandler eventHandler, Iterable<PathFragment> execPaths, boolean forFiles)
throws InterruptedException {
final Map<PathFragment, SkyKey> packageKeys = new HashMap<>();
@@ -867,12 +867,13 @@
return new HashMap<>();
}
- Map<PathFragment, Root> roots = new HashMap<>();
+ Map<PathFragment, ArtifactRoot> roots = new HashMap<>();
for (PathFragment execPath : execPaths) {
ContainingPackageLookupValue value = result.get(packageKeys.get(execPath));
if (value.hasContainingPackage()) {
- roots.put(execPath,
- Root.computeSourceRoot(
+ roots.put(
+ execPath,
+ ArtifactRoot.computeSourceRoot(
value.getContainingPackageRoot(),
value.getContainingPackageName().getRepository()));
} else {
diff --git a/src/test/java/com/google/devtools/build/lib/actions/ActionCacheCheckerTest.java b/src/test/java/com/google/devtools/build/lib/actions/ActionCacheCheckerTest.java
index c6de334..8892fcf 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/ActionCacheCheckerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/ActionCacheCheckerTest.java
@@ -274,15 +274,16 @@
@Test
public void testMiddleman_DifferentFiles() throws Exception {
- Action action = new NullMiddlemanAction() {
- @Override
- public synchronized Iterable<Artifact> getInputs() {
- FileSystem fileSystem = getPrimaryOutput().getPath().getFileSystem();
- Path path = fileSystem.getPath("/input");
- Root root = Root.asSourceRoot(fileSystem.getPath("/"));
- return ImmutableList.of(new Artifact(path, root));
- }
- };
+ Action action =
+ new NullMiddlemanAction() {
+ @Override
+ public synchronized Iterable<Artifact> getInputs() {
+ FileSystem fileSystem = getPrimaryOutput().getPath().getFileSystem();
+ Path path = fileSystem.getPath("/input");
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(fileSystem.getPath("/"));
+ return ImmutableList.of(new Artifact(path, root));
+ }
+ };
runAction(action); // Not cached so recorded as different deps.
FileSystemUtils.writeContentAsLatin1(action.getPrimaryInput().getPath(), "modified");
runAction(action); // Cache miss because input files were modified.
diff --git a/src/test/java/com/google/devtools/build/lib/actions/ActionLookupValueTest.java b/src/test/java/com/google/devtools/build/lib/actions/ActionLookupValueTest.java
index 5ae6c37..e2ddd4f 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/ActionLookupValueTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/ActionLookupValueTest.java
@@ -58,7 +58,7 @@
public void testActionNotPresentAfterEvaluation() {
Path execRoot = fs.getPath("/execroot");
Path outputRootPath = execRoot.getRelative("blaze-out");
- Root root = Root.asDerivedRoot(execRoot, outputRootPath);
+ ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, outputRootPath);
Action normalAction = mock(Action.class);
Artifact normalArtifact = new Artifact(PathFragment.create("normal"), root);
when(normalAction.getOutputs()).thenReturn(ImmutableSet.of(normalArtifact));
diff --git a/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java b/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java
index 5c6005d..94b1a0f 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java
@@ -50,10 +50,10 @@
private Scratch scratch = new Scratch();
private Path execRoot;
- private Root clientRoot;
- private Root clientRoRoot;
- private Root alienRoot;
- private Root outRoot;
+ private ArtifactRoot clientRoot;
+ private ArtifactRoot clientRoRoot;
+ private ArtifactRoot alienRoot;
+ private ArtifactRoot outRoot;
private PathFragment fooPath;
private PackageIdentifier fooPackage;
@@ -73,10 +73,10 @@
@Before
public final void createFiles() throws Exception {
execRoot = scratch.dir("/output/workspace");
- clientRoot = Root.asSourceRoot(scratch.dir("/client/workspace"));
- clientRoRoot = Root.asSourceRoot(scratch.dir("/client/RO/workspace"));
- alienRoot = Root.asSourceRoot(scratch.dir("/client/workspace"));
- outRoot = Root.asDerivedRoot(execRoot, execRoot.getRelative("out-root/x/bin"));
+ clientRoot = ArtifactRoot.asSourceRoot(scratch.dir("/client/workspace"));
+ clientRoRoot = ArtifactRoot.asSourceRoot(scratch.dir("/client/RO/workspace"));
+ alienRoot = ArtifactRoot.asSourceRoot(scratch.dir("/client/workspace"));
+ outRoot = ArtifactRoot.asDerivedRoot(execRoot, execRoot.getRelative("out-root/x/bin"));
fooPath = PathFragment.create("foo");
fooPackage = PackageIdentifier.createInMainRepo(fooPath);
@@ -95,7 +95,7 @@
}
private void setupRoots() {
- Map<PackageIdentifier, Root> packageRootMap = new HashMap<>();
+ Map<PackageIdentifier, ArtifactRoot> packageRootMap = new HashMap<>();
packageRootMap.put(fooPackage, clientRoot);
packageRootMap.put(barPackage, clientRoRoot);
packageRootMap.put(alienPackage, alienRoot);
@@ -155,8 +155,8 @@
public void testResolveArtifactWithUpLevelFailsCleanly() throws Exception {
// We need a package in the root directory to make every exec path (even one with up-level
// references) be in a package.
- Map<PackageIdentifier, Root> packageRoots = ImmutableMap.of(
- PackageIdentifier.createInMainRepo(PathFragment.create("")), clientRoot);
+ Map<PackageIdentifier, ArtifactRoot> packageRoots =
+ ImmutableMap.of(PackageIdentifier.createInMainRepo(PathFragment.create("")), clientRoot);
artifactFactory.setPackageRoots(packageRoots::get);
PathFragment outsideWorkspace = PathFragment.create("../foo");
PathFragment insideWorkspace =
@@ -211,17 +211,18 @@
}
private static class MockPackageRootResolver implements PackageRootResolver {
- private Map<PathFragment, Root> packageRoots = Maps.newHashMap();
+ private Map<PathFragment, ArtifactRoot> packageRoots = Maps.newHashMap();
- public void setPackageRoots(Map<PackageIdentifier, Root> packageRoots) {
- for (Entry<PackageIdentifier, Root> packageRoot : packageRoots.entrySet()) {
+ public void setPackageRoots(Map<PackageIdentifier, ArtifactRoot> packageRoots) {
+ for (Entry<PackageIdentifier, ArtifactRoot> packageRoot : packageRoots.entrySet()) {
this.packageRoots.put(packageRoot.getKey().getPackageFragment(), packageRoot.getValue());
}
}
@Override
- public Map<PathFragment, Root> findPackageRootsForFiles(Iterable<PathFragment> execPaths) {
- Map<PathFragment, Root> result = new HashMap<>();
+ public Map<PathFragment, ArtifactRoot> findPackageRootsForFiles(
+ Iterable<PathFragment> execPaths) {
+ Map<PathFragment, ArtifactRoot> result = new HashMap<>();
for (PathFragment execPath : execPaths) {
for (PathFragment dir = execPath.getParentDirectory(); dir != null;
dir = dir.getParentDirectory()) {
@@ -238,7 +239,7 @@
@Override
@Nullable
- public Map<PathFragment, Root> findPackageRoots(Iterable<PathFragment> execPaths) {
+ public Map<PathFragment, ArtifactRoot> findPackageRoots(Iterable<PathFragment> execPaths) {
return null; // unused
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/actions/RootTest.java b/src/test/java/com/google/devtools/build/lib/actions/ArtifactRootTest.java
similarity index 79%
rename from src/test/java/com/google/devtools/build/lib/actions/RootTest.java
rename to src/test/java/com/google/devtools/build/lib/actions/ArtifactRootTest.java
index 36ede38..dfe4e07 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/RootTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/ArtifactRootTest.java
@@ -25,15 +25,15 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-/** Tests for {@link Root}. */
+/** Tests for {@link ArtifactRoot}. */
@RunWith(JUnit4.class)
-public class RootTest {
+public class ArtifactRootTest {
private Scratch scratch = new Scratch();
@Test
public void testAsSourceRoot() throws IOException {
Path sourceDir = scratch.dir("/source");
- Root root = Root.asSourceRoot(sourceDir);
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(sourceDir);
assertThat(root.isSourceRoot()).isTrue();
assertThat(root.getExecPath()).isEqualTo(PathFragment.EMPTY_FRAGMENT);
assertThat(root.getPath()).isEqualTo(sourceDir);
@@ -43,7 +43,7 @@
@Test
public void testBadAsSourceRoot() {
try {
- Root.asSourceRoot(null);
+ ArtifactRoot.asSourceRoot(null);
fail();
} catch (NullPointerException expected) {
}
@@ -53,7 +53,7 @@
public void testAsDerivedRoot() throws IOException {
Path execRoot = scratch.dir("/exec");
Path rootDir = scratch.dir("/exec/root");
- Root root = Root.asDerivedRoot(execRoot, rootDir);
+ ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, rootDir);
assertThat(root.isSourceRoot()).isFalse();
assertThat(root.getExecPath()).isEqualTo(PathFragment.create("root"));
assertThat(root.getPath()).isEqualTo(rootDir);
@@ -65,7 +65,7 @@
try {
Path execRoot = scratch.dir("/exec");
Path outsideDir = scratch.dir("/not_exec");
- Root.asDerivedRoot(execRoot, outsideDir);
+ ArtifactRoot.asDerivedRoot(execRoot, outsideDir);
fail();
} catch (IllegalArgumentException expected) {
}
@@ -75,7 +75,7 @@
public void testBadAsDerivedRootSameForBoth() throws IOException {
try {
Path execRoot = scratch.dir("/exec");
- Root.asDerivedRoot(execRoot, execRoot);
+ ArtifactRoot.asDerivedRoot(execRoot, execRoot);
fail();
} catch (IllegalArgumentException expected) {
}
@@ -85,7 +85,7 @@
public void testBadAsDerivedRootNullDir() throws IOException {
try {
Path execRoot = scratch.dir("/exec");
- Root.asDerivedRoot(execRoot, null);
+ ArtifactRoot.asDerivedRoot(execRoot, null);
fail();
} catch (NullPointerException expected) {
}
@@ -95,7 +95,7 @@
public void testBadAsDerivedRootNullExecRoot() throws IOException {
try {
Path execRoot = scratch.dir("/exec");
- Root.asDerivedRoot(null, execRoot);
+ ArtifactRoot.asDerivedRoot(null, execRoot);
fail();
} catch (NullPointerException expected) {
}
@@ -107,11 +107,11 @@
Path rootDir = scratch.dir("/exec/root");
Path otherRootDir = scratch.dir("/");
Path sourceDir = scratch.dir("/source");
- Root rootA = Root.asDerivedRoot(execRoot, rootDir);
- assertEqualsAndHashCode(true, rootA, Root.asDerivedRoot(execRoot, rootDir));
- assertEqualsAndHashCode(false, rootA, Root.asSourceRoot(sourceDir));
- assertEqualsAndHashCode(false, rootA, Root.asSourceRoot(rootDir));
- assertEqualsAndHashCode(false, rootA, Root.asDerivedRoot(otherRootDir, rootDir));
+ ArtifactRoot rootA = ArtifactRoot.asDerivedRoot(execRoot, rootDir);
+ assertEqualsAndHashCode(true, rootA, ArtifactRoot.asDerivedRoot(execRoot, rootDir));
+ assertEqualsAndHashCode(false, rootA, ArtifactRoot.asSourceRoot(sourceDir));
+ assertEqualsAndHashCode(false, rootA, ArtifactRoot.asSourceRoot(rootDir));
+ assertEqualsAndHashCode(false, rootA, ArtifactRoot.asDerivedRoot(otherRootDir, rootDir));
}
public void assertEqualsAndHashCode(boolean expected, Object a, Object b) {
diff --git a/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java b/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java
index dda385f..681b2a3 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/ArtifactTest.java
@@ -40,14 +40,14 @@
public class ArtifactTest {
private Scratch scratch;
private Path execDir;
- private Root rootDir;
+ private ArtifactRoot rootDir;
private final ActionKeyContext actionKeyContext = new ActionKeyContext();
@Before
public final void setRootDir() throws Exception {
scratch = new Scratch();
execDir = scratch.dir("/exec");
- rootDir = Root.asDerivedRoot(execDir, scratch.dir("/exec/root"));
+ rootDir = ArtifactRoot.asDerivedRoot(execDir, scratch.dir("/exec/root"));
}
@Test
@@ -55,7 +55,7 @@
Path f1 = scratch.file("/exec/dir/file.ext");
Path bogusDir = scratch.file("/exec/dir/bogus");
try {
- new Artifact(f1, Root.asDerivedRoot(execDir, bogusDir), f1.relativeTo(execDir));
+ new Artifact(f1, ArtifactRoot.asDerivedRoot(execDir, bogusDir), f1.relativeTo(execDir));
fail("Expected IllegalArgumentException constructing artifact with a bad root dir");
} catch (IllegalArgumentException expected) {}
}
@@ -97,7 +97,7 @@
@Test
public void testRootPrefixedExecPath_noRoot() throws IOException {
Path f1 = scratch.file("/exec/dir/file.ext");
- Artifact a1 = new Artifact(f1.relativeTo(execDir), Root.asSourceRoot(execDir));
+ Artifact a1 = new Artifact(f1.relativeTo(execDir), ArtifactRoot.asSourceRoot(execDir));
assertThat(Artifact.asRootPrefixedExecPath(a1)).isEqualTo(":dir/file.ext");
}
@@ -128,7 +128,7 @@
@Test
public void testGetFilename() throws Exception {
- Root root = Root.asSourceRoot(scratch.dir("/foo"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo"));
Artifact javaFile = new Artifact(scratch.file("/foo/Bar.java"), root);
Artifact generatedHeader = new Artifact(scratch.file("/foo/bar.proto.h"), root);
Artifact generatedCc = new Artifact(scratch.file("/foo/bar.proto.cc"), root);
@@ -141,7 +141,7 @@
@Test
public void testGetExtension() throws Exception {
- Root root = Root.asSourceRoot(scratch.dir("/foo"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo"));
Artifact javaFile = new Artifact(scratch.file("/foo/Bar.java"), root);
assertThat(javaFile.getExtension()).isEqualTo("java");
}
@@ -154,12 +154,14 @@
private List<Artifact> getFooBarArtifacts(MutableActionGraph actionGraph, boolean collapsedList)
throws Exception {
- Root root = Root.asSourceRoot(scratch.dir("/foo"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo"));
Artifact aHeader1 = new Artifact(scratch.file("/foo/bar1.h"), root);
Artifact aHeader2 = new Artifact(scratch.file("/foo/bar2.h"), root);
Artifact aHeader3 = new Artifact(scratch.file("/foo/bar3.h"), root);
- Artifact middleman = new Artifact(PathFragment.create("middleman"),
- Root.middlemanRoot(scratch.dir("/foo"), scratch.dir("/foo/out")));
+ Artifact middleman =
+ new Artifact(
+ PathFragment.create("middleman"),
+ ArtifactRoot.middlemanRoot(scratch.dir("/foo"), scratch.dir("/foo/out")));
actionGraph.registerAction(new MiddlemanAction(ActionsTestUtil.NULL_ACTION_OWNER,
ImmutableList.of(aHeader1, aHeader2, aHeader3), middleman, "desc",
MiddlemanType.AGGREGATING_MIDDLEMAN));
@@ -270,7 +272,7 @@
@Test
public void testRootRelativePathIsSameAsExecPath() throws Exception {
- Root root = Root.asSourceRoot(scratch.dir("/foo"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.dir("/foo"));
Artifact a = new Artifact(scratch.file("/foo/bar1.h"), root);
assertThat(a.getRootRelativePath()).isSameAs(a.getExecPath());
}
@@ -281,7 +283,7 @@
Artifact a =
new Artifact(
scratch.file("/a/b/c"),
- Root.asDerivedRoot(execRoot, scratch.dir("/a/b")),
+ ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a/b")),
PathFragment.create("b/c"));
assertThat(a.toDetailString()).isEqualTo("[[/a]b]c");
}
@@ -292,7 +294,7 @@
Path execRoot = scratch.getFileSystem().getPath("/");
new Artifact(
scratch.file("/a/b/c"),
- Root.asDerivedRoot(execRoot, scratch.dir("/a")),
+ ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a")),
PathFragment.create("c"));
fail();
} catch (IllegalArgumentException e) {
@@ -305,7 +307,8 @@
public void testSerializeToString() throws Exception {
Path execRoot = scratch.getFileSystem().getPath("/");
assertThat(
- new Artifact(scratch.file("/a/b/c"), Root.asDerivedRoot(execRoot, scratch.dir("/a")))
+ new Artifact(
+ scratch.file("/a/b/c"), ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/a")))
.serializeToString())
.isEqualTo("a/b/c /3");
}
@@ -314,7 +317,7 @@
public void testSerializeToStringWithExecPath() throws Exception {
Path execRoot = scratch.getFileSystem().getPath("/");
Path path = scratch.file("/aaa/bbb/ccc");
- Root root = Root.asDerivedRoot(execRoot, scratch.dir("/aaa/bbb"));
+ ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/aaa/bbb"));
PathFragment execPath = PathFragment.create("bbb/ccc");
assertThat(new Artifact(path, root, execPath).serializeToString()).isEqualTo("bbb/ccc /3");
@@ -326,7 +329,7 @@
assertThat(
new Artifact(
scratch.file("/aa/b/c"),
- Root.asDerivedRoot(execRoot, scratch.dir("/aa")),
+ ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/aa")),
PathFragment.create("b/c"),
new LabelArtifactOwner(Label.parseAbsoluteUnchecked("//foo:bar")))
.serializeToString())
@@ -343,7 +346,7 @@
@Test
public void testDirnameInExecutionDir() throws Exception {
Artifact artifact =
- new Artifact(scratch.file("/foo/bar.txt"), Root.asSourceRoot(scratch.dir("/foo")));
+ new Artifact(scratch.file("/foo/bar.txt"), ArtifactRoot.asSourceRoot(scratch.dir("/foo")));
assertThat(artifact.getDirname()).isEqualTo(".");
}
@@ -360,26 +363,30 @@
@Test
public void testIsSourceArtifact() throws Exception {
assertThat(
- new Artifact(scratch.file("/src/foo.cc"), Root.asSourceRoot(scratch.dir("/")),
- PathFragment.create("src/foo.cc"))
- .isSourceArtifact())
+ new Artifact(
+ scratch.file("/src/foo.cc"),
+ ArtifactRoot.asSourceRoot(scratch.dir("/")),
+ PathFragment.create("src/foo.cc"))
+ .isSourceArtifact())
.isTrue();
assertThat(
- new Artifact(scratch.file("/genfiles/aaa/bar.out"),
- Root.asDerivedRoot(scratch.dir("/genfiles"), scratch.dir("/genfiles/aaa")))
- .isSourceArtifact())
+ new Artifact(
+ scratch.file("/genfiles/aaa/bar.out"),
+ ArtifactRoot.asDerivedRoot(
+ scratch.dir("/genfiles"), scratch.dir("/genfiles/aaa")))
+ .isSourceArtifact())
.isFalse();
-
}
@Test
public void testGetRoot() throws Exception {
Path execRoot = scratch.getFileSystem().getPath("/");
- Root root = Root.asDerivedRoot(execRoot, scratch.dir("/newRoot"));
+ ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/newRoot"));
assertThat(new Artifact(scratch.file("/newRoot/foo"), root).getRoot()).isEqualTo(root);
}
private Artifact createDirNameArtifact() throws Exception {
- return new Artifact(scratch.file("/aaa/bbb/ccc/ddd"), Root.asSourceRoot(scratch.dir("/")));
+ return new Artifact(
+ scratch.file("/aaa/bbb/ccc/ddd"), ArtifactRoot.asSourceRoot(scratch.dir("/")));
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplierTest.java b/src/test/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplierTest.java
index e799800..dc6f752 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplierTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/CompositeRunfilesSupplierTest.java
@@ -40,13 +40,13 @@
private RunfilesSupplier mockSecond;
private Path execRoot;
- private Root rootDir;
+ private ArtifactRoot rootDir;
@Before
public final void createMocks() throws IOException {
Scratch scratch = new Scratch();
execRoot = scratch.getFileSystem().getPath("/");
- rootDir = Root.asDerivedRoot(execRoot, scratch.dir("/fake/root/dont/matter"));
+ rootDir = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/fake/root/dont/matter"));
mockFirst = mock(RunfilesSupplier.class);
mockSecond = mock(RunfilesSupplier.class);
@@ -131,7 +131,7 @@
shared, firstSharedMappings);
}
- private static Map<PathFragment, Artifact> mkMappings(Root rootDir, String... paths) {
+ private static Map<PathFragment, Artifact> mkMappings(ArtifactRoot rootDir, String... paths) {
ImmutableMap.Builder<PathFragment, Artifact> builder = ImmutableMap.builder();
for (String path : paths) {
builder.put(PathFragment.create(path), mkArtifact(rootDir, path));
@@ -139,11 +139,11 @@
return builder.build();
}
- private static Artifact mkArtifact(Root rootDir, String path) {
+ private static Artifact mkArtifact(ArtifactRoot rootDir, String path) {
return new Artifact(PathFragment.create(path), rootDir);
}
- private static List<Artifact> mkArtifacts(Root rootDir, String... paths) {
+ private static List<Artifact> mkArtifacts(ArtifactRoot rootDir, String... paths) {
ImmutableList.Builder<Artifact> builder = ImmutableList.builder();
for (String path : paths) {
builder.add(mkArtifact(rootDir, path));
diff --git a/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java b/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java
index a907739..5227dba 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/CustomCommandLineTest.java
@@ -44,14 +44,14 @@
public class CustomCommandLineTest {
private Scratch scratch;
- private Root rootDir;
+ private ArtifactRoot rootDir;
private Artifact artifact1;
private Artifact artifact2;
@Before
public void createArtifacts() throws Exception {
scratch = new Scratch();
- rootDir = Root.asSourceRoot(scratch.dir("/exec/root"));
+ rootDir = ArtifactRoot.asSourceRoot(scratch.dir("/exec/root"));
artifact1 = new Artifact(scratch.file("/exec/root/dir/file1.txt"), rootDir);
artifact2 = new Artifact(scratch.file("/exec/root/dir/file2.txt"), rootDir);
}
diff --git a/src/test/java/com/google/devtools/build/lib/actions/ExecutableSymlinkActionTest.java b/src/test/java/com/google/devtools/build/lib/actions/ExecutableSymlinkActionTest.java
index 391ccf5..28da727 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/ExecutableSymlinkActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/ExecutableSymlinkActionTest.java
@@ -35,8 +35,8 @@
@RunWith(JUnit4.class)
public class ExecutableSymlinkActionTest {
private Scratch scratch = new Scratch();
- private Root inputRoot;
- private Root outputRoot;
+ private ArtifactRoot inputRoot;
+ private ArtifactRoot outputRoot;
TestFileOutErr outErr;
private Executor executor;
private final ActionKeyContext actionKeyContext = new ActionKeyContext();
@@ -45,8 +45,8 @@
public final void createExecutor() throws Exception {
final Path inputDir = scratch.dir("/in");
Path execRoot = scratch.getFileSystem().getPath("/");
- inputRoot = Root.asDerivedRoot(execRoot, inputDir);
- outputRoot = Root.asDerivedRoot(execRoot, scratch.dir("/out"));
+ inputRoot = ArtifactRoot.asDerivedRoot(execRoot, inputDir);
+ outputRoot = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/out"));
outErr = new TestFileOutErr();
executor = new DummyExecutor(scratch.getFileSystem(), inputDir);
}
diff --git a/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java b/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java
index 5b39c35..c1eac8e 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java
@@ -42,8 +42,10 @@
@Before
public final void setUp() throws Exception {
errorMessage = "An error just happened.";
- anOutput = new Artifact(scratch.file("/out/foo"),
- Root.asDerivedRoot(scratch.dir("/"), scratch.dir("/out")));
+ anOutput =
+ new Artifact(
+ scratch.file("/out/foo"),
+ ArtifactRoot.asDerivedRoot(scratch.dir("/"), scratch.dir("/out")));
outputs = ImmutableList.of(anOutput);
failAction = new FailAction(NULL_ACTION_OWNER, outputs, errorMessage);
actionGraph.registerAction(failAction);
diff --git a/src/test/java/com/google/devtools/build/lib/actions/MapBasedActionGraphTest.java b/src/test/java/com/google/devtools/build/lib/actions/MapBasedActionGraphTest.java
index 7d4a752..5de14d9 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/MapBasedActionGraphTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/MapBasedActionGraphTest.java
@@ -45,13 +45,13 @@
Path execRoot = fileSystem.getPath("/");
Path root = fileSystem.getPath("/root");
Path path = root.getRelative("foo");
- Artifact output = new Artifact(path, Root.asDerivedRoot(execRoot, root));
+ Artifact output = new Artifact(path, ArtifactRoot.asDerivedRoot(execRoot, root));
Action action = new TestAction(TestAction.NO_EFFECT,
ImmutableSet.<Artifact>of(), ImmutableSet.of(output));
actionGraph.registerAction(action);
actionGraph.unregisterAction(action);
path = root.getRelative("bar");
- output = new Artifact(path, Root.asDerivedRoot(execRoot, root));
+ output = new Artifact(path, ArtifactRoot.asDerivedRoot(execRoot, root));
Action action2 = new TestAction(TestAction.NO_EFFECT,
ImmutableSet.<Artifact>of(), ImmutableSet.of(output));
actionGraph.registerAction(action);
@@ -65,7 +65,7 @@
Path execRoot = fileSystem.getPath("/");
Path root = fileSystem.getPath("/root");
Path path = root.getRelative("/root/foo");
- Artifact output = new Artifact(path, Root.asDerivedRoot(execRoot, root));
+ Artifact output = new Artifact(path, ArtifactRoot.asDerivedRoot(execRoot, root));
Action action = new TestAction(TestAction.NO_EFFECT,
ImmutableSet.<Artifact>of(), ImmutableSet.of(output));
actionGraph.registerAction(action);
@@ -94,7 +94,7 @@
Path execRoot = fileSystem.getPath("/");
Path root = fileSystem.getPath("/root");
Path path = root.getRelative("foo");
- output = new Artifact(path, Root.asDerivedRoot(execRoot, root));
+ output = new Artifact(path, ArtifactRoot.asDerivedRoot(execRoot, root));
allActions.add(new TestAction(
TestAction.NO_EFFECT, ImmutableSet.<Artifact>of(), ImmutableSet.of(output)));
}
diff --git a/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java b/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java
index ecd3fc3..c3f8e0f 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java
@@ -42,11 +42,11 @@
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
import com.google.devtools.build.lib.actions.ArtifactOwner;
import com.google.devtools.build.lib.actions.ArtifactResolver;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.actions.MutableActionGraph;
import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException;
import com.google.devtools.build.lib.actions.PackageRootResolver;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.cache.Md5Digest;
import com.google.devtools.build.lib.actions.cache.Metadata;
import com.google.devtools.build.lib.actions.cache.MetadataHandler;
@@ -243,9 +243,10 @@
}
}
- public static final Artifact DUMMY_ARTIFACT = new Artifact(
- PathFragment.create("dummy"),
- Root.asSourceRoot(new InMemoryFileSystem().getRootDirectory()));
+ public static final Artifact DUMMY_ARTIFACT =
+ new Artifact(
+ PathFragment.create("dummy"),
+ ArtifactRoot.asSourceRoot(new InMemoryFileSystem().getRootDirectory()));
public static final ActionOwner NULL_ACTION_OWNER =
ActionOwner.create(
@@ -673,12 +674,12 @@
public static class FakeArtifactResolverBase implements ArtifactResolver {
@Override
public Artifact getSourceArtifact(
- PathFragment execPath, Root root, ArtifactOwner owner) {
+ PathFragment execPath, ArtifactRoot root, ArtifactOwner owner) {
throw new UnsupportedOperationException();
}
@Override
- public Artifact getSourceArtifact(PathFragment execPath, Root root) {
+ public Artifact getSourceArtifact(PathFragment execPath, ArtifactRoot root) {
throw new UnsupportedOperationException();
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/LocationFunctionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/LocationFunctionTest.java
index 676255f..f1de38e 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/LocationFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/LocationFunctionTest.java
@@ -19,7 +19,7 @@
import com.google.common.base.Suppliers;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.LocationExpander.LocationFunction;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.vfs.FileSystem;
@@ -47,9 +47,10 @@
private Artifact makeArtifact(String path) {
if (path.startsWith("/exec/out")) {
return new Artifact(
- fs.getPath(path), Root.asDerivedRoot(fs.getPath("/exec"), fs.getPath("/exec/out")));
+ fs.getPath(path),
+ ArtifactRoot.asDerivedRoot(fs.getPath("/exec"), fs.getPath("/exec/out")));
} else {
- return new Artifact(fs.getPath(path), Root.asSourceRoot(fs.getPath("/exec")));
+ return new Artifact(fs.getPath(path), ArtifactRoot.asSourceRoot(fs.getPath("/exec")));
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImplTest.java b/src/test/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImplTest.java
index 3967b0e..952d013 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImplTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImplTest.java
@@ -19,7 +19,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.RunfilesSupplier;
import com.google.devtools.build.lib.testutil.Scratch;
import com.google.devtools.build.lib.vfs.Path;
@@ -36,17 +36,18 @@
public class RunfilesSupplierImplTest {
private Path execRoot;
- private Root rootDir;
- private Root middlemanRoot;
+ private ArtifactRoot rootDir;
+ private ArtifactRoot middlemanRoot;
@Before
public final void setRoot() throws IOException {
Scratch scratch = new Scratch();
execRoot = scratch.getFileSystem().getPath("/");
- rootDir = Root.asDerivedRoot(execRoot, scratch.dir("/fake/root/dont/matter"));
+ rootDir = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/fake/root/dont/matter"));
Path middlemanExecPath = scratch.dir("/still/fake/root/dont/matter");
- middlemanRoot = Root.middlemanRoot(middlemanExecPath, middlemanExecPath.getChild("subdir"));
+ middlemanRoot =
+ ArtifactRoot.middlemanRoot(middlemanExecPath, middlemanExecPath.getChild("subdir"));
}
@Test
@@ -90,7 +91,7 @@
return new Runfiles.Builder("TESTING", false).addArtifacts(artifacts).build();
}
- private static List<Artifact> mkArtifacts(Root rootDir, String... paths) {
+ private static List<Artifact> mkArtifacts(ArtifactRoot rootDir, String... paths) {
ImmutableList.Builder<Artifact> builder = ImmutableList.builder();
for (String path : paths) {
builder.add(new Artifact(PathFragment.create(path), rootDir));
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/RunfilesTest.java b/src/test/java/com/google/devtools/build/lib/analysis/RunfilesTest.java
index 5a16caa..ec184e8 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/RunfilesTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/RunfilesTest.java
@@ -21,7 +21,7 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.events.EventKind;
import com.google.devtools.build.lib.testutil.FoundationTestCase;
@@ -51,7 +51,7 @@
public void testFilterListForObscuringSymlinksCatchesBadObscurer() throws Exception {
Map<PathFragment, Artifact> obscuringMap = new HashMap<>();
PathFragment pathA = PathFragment.create("a");
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
Artifact artifactA = new Artifact(PathFragment.create("a"), root);
obscuringMap.put(pathA, artifactA);
obscuringMap.put(PathFragment.create("a/b"), new Artifact(PathFragment.create("c/b"),
@@ -65,7 +65,7 @@
public void testFilterListForObscuringSymlinksCatchesBadGrandParentObscurer() throws Exception {
Map<PathFragment, Artifact> obscuringMap = new HashMap<>();
PathFragment pathA = PathFragment.create("a");
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
Artifact artifactA = new Artifact(PathFragment.create("a"),
root);
obscuringMap.put(pathA, artifactA);
@@ -80,7 +80,7 @@
public void testFilterListForObscuringSymlinksCatchesBadObscurerNoListener() throws Exception {
Map<PathFragment, Artifact> obscuringMap = new HashMap<>();
PathFragment pathA = PathFragment.create("a");
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
Artifact artifactA = new Artifact(PathFragment.create("a"),
root);
obscuringMap.put(pathA, artifactA);
@@ -94,7 +94,7 @@
public void testFilterListForObscuringSymlinksIgnoresOkObscurer() throws Exception {
Map<PathFragment, Artifact> obscuringMap = new HashMap<>();
PathFragment pathA = PathFragment.create("a");
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
Artifact artifactA = new Artifact(PathFragment.create("a"),
root);
obscuringMap.put(pathA, artifactA);
@@ -110,7 +110,7 @@
public void testFilterListForObscuringSymlinksNoObscurers() throws Exception {
Map<PathFragment, Artifact> obscuringMap = new HashMap<>();
PathFragment pathA = PathFragment.create("a");
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
Artifact artifactA = new Artifact(PathFragment.create("a"),
root);
obscuringMap.put(pathA, artifactA);
@@ -142,7 +142,7 @@
@Test
public void testPutCatchesConflict() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
PathFragment pathA = PathFragment.create("a");
Artifact artifactB = new Artifact(PathFragment.create("b"), root);
Artifact artifactC = new Artifact(PathFragment.create("c"), root);
@@ -159,7 +159,7 @@
@Test
public void testPutReportsError() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
PathFragment pathA = PathFragment.create("a");
Artifact artifactB = new Artifact(PathFragment.create("b"), root);
Artifact artifactC = new Artifact(PathFragment.create("c"), root);
@@ -177,7 +177,7 @@
@Test
public void testPutCatchesConflictBetweenNullAndNotNull() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
PathFragment pathA = PathFragment.create("a");
Artifact artifactB = new Artifact(PathFragment.create("b"), root);
Map<PathFragment, Artifact> map = new LinkedHashMap<>();
@@ -192,7 +192,7 @@
@Test
public void testPutCatchesConflictBetweenNotNullAndNull() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
PathFragment pathA = PathFragment.create("a");
Artifact artifactB = new Artifact(PathFragment.create("b"), root);
Map<PathFragment, Artifact> map = new LinkedHashMap<>();
@@ -208,7 +208,7 @@
@Test
public void testPutIgnoresConflict() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
PathFragment pathA = PathFragment.create("a");
Artifact artifactB = new Artifact(PathFragment.create("b"), root);
Artifact artifactC = new Artifact(PathFragment.create("c"), root);
@@ -224,7 +224,7 @@
@Test
public void testPutIgnoresConflictNoListener() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
PathFragment pathA = PathFragment.create("a");
Artifact artifactB = new Artifact(PathFragment.create("b"), root);
Artifact artifactC = new Artifact(PathFragment.create("c"), root);
@@ -240,7 +240,7 @@
@Test
public void testPutIgnoresSameArtifact() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
PathFragment pathA = PathFragment.create("a");
Artifact artifactB = new Artifact(PathFragment.create("b"), root);
Artifact artifactB2 = new Artifact(PathFragment.create("b"), root);
@@ -271,7 +271,7 @@
@Test
public void testPutNoConflicts() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
PathFragment pathA = PathFragment.create("a");
PathFragment pathB = PathFragment.create("b");
PathFragment pathC = PathFragment.create("c");
@@ -325,7 +325,7 @@
@Test
public void testLegacyRunfilesStructure() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
PathFragment workspaceName = PathFragment.create("wsname");
PathFragment pathB = PathFragment.create("external/repo/b");
Artifact artifactB = new Artifact(pathB, root);
@@ -346,7 +346,7 @@
@Test
public void testRunfileAdded() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
PathFragment workspaceName = PathFragment.create("wsname");
PathFragment pathB = PathFragment.create("external/repo/b");
Artifact artifactB = new Artifact(pathB, root);
@@ -369,7 +369,7 @@
// TODO(kchodorow): remove this once the default workspace name is always set.
@Test
public void testConflictWithExternal() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
PathFragment pathB = PathFragment.create("repo/b");
PathFragment externalPathB = Label.EXTERNAL_PACKAGE_NAME.getRelative(pathB);
Artifact artifactB = new Artifact(pathB, root);
@@ -393,7 +393,7 @@
@Test
public void testMergeWithSymlinks() {
- Root root = Root.asSourceRoot(scratch.resolve("/workspace"));
+ ArtifactRoot root = ArtifactRoot.asSourceRoot(scratch.resolve("/workspace"));
Artifact artifactA = new Artifact(PathFragment.create("a/target"), root);
Artifact artifactB = new Artifact(PathFragment.create("b/target"), root);
PathFragment sympathA = PathFragment.create("a/symlink");
@@ -412,7 +412,8 @@
@Test
public void testOnlyExtraMiddlemenNotConsideredEmpty() {
- Root root = Root.middlemanRoot(scratch.resolve("execroot"), scratch.resolve("execroot/out"));
+ ArtifactRoot root =
+ ArtifactRoot.middlemanRoot(scratch.resolve("execroot"), scratch.resolve("execroot/out"));
Artifact mm = new Artifact(PathFragment.create("a-middleman"), root);
Runfiles runfiles = new Runfiles.Builder("TESTING").addLegacyExtraMiddleman(mm).build();
assertThat(runfiles.isEmpty()).isFalse();
@@ -420,7 +421,8 @@
@Test
public void testMergingExtraMiddlemen() {
- Root root = Root.middlemanRoot(scratch.resolve("execroot"), scratch.resolve("execroot/out"));
+ ArtifactRoot root =
+ ArtifactRoot.middlemanRoot(scratch.resolve("execroot"), scratch.resolve("execroot/out"));
Artifact mm1 = new Artifact(PathFragment.create("middleman-1"), root);
Artifact mm2 = new Artifact(PathFragment.create("middleman-2"), root);
Runfiles runfiles1 = new Runfiles.Builder("TESTING").addLegacyExtraMiddleman(mm1).build();
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/TopLevelArtifactHelperTest.java b/src/test/java/com/google/devtools/build/lib/analysis/TopLevelArtifactHelperTest.java
index 9609bed..141982d 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/TopLevelArtifactHelperTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/TopLevelArtifactHelperTest.java
@@ -23,7 +23,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedSet;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsInOutputGroup;
import com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
@@ -45,14 +45,14 @@
private OutputGroupInfo groupProvider;
private Path path;
- private Root root;
+ private ArtifactRoot root;
private int artifactIdx;
@Before
public final void setRootDir() throws Exception {
Scratch scratch = new Scratch();
Path execRoot = scratch.getFileSystem().getPath("/");
- root = Root.asDerivedRoot(execRoot, scratch.dir("/blaze-out"));
+ root = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/blaze-out"));
path = scratch.dir("/blaze-out/foo");
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/actions/ParamFileWriteActionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/actions/ParamFileWriteActionTest.java
index 1a541ff..ed382c4 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/actions/ParamFileWriteActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/actions/ParamFileWriteActionTest.java
@@ -28,9 +28,9 @@
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifactType;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
import com.google.devtools.build.lib.actions.ArtifactOwner;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.actions.ParameterFile.ParameterFileType;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.analysis.util.ActionTester;
import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
@@ -50,14 +50,14 @@
/** Tests for ParamFileWriteAction. */
@RunWith(JUnit4.class)
public class ParamFileWriteActionTest extends BuildViewTestCase {
- private Root rootDir;
+ private ArtifactRoot rootDir;
private Artifact outputArtifact;
private Artifact treeArtifact;
@Before
public void createArtifacts() throws Exception {
Path execRoot = scratch.getFileSystem().getPath("/exec");
- rootDir = Root.asDerivedRoot(execRoot, scratch.dir("/exec/out"));
+ rootDir = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/exec/out"));
outputArtifact = getBinArtifactWithNoOwner("destination.txt");
FileSystemUtils.createDirectoryAndParents(outputArtifact.getPath().getParentDirectory());
treeArtifact = createTreeArtifact("artifact/myTreeFileArtifact");
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/actions/PopulateTreeArtifactActionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/actions/PopulateTreeArtifactActionTest.java
index 96f5afe..5a54a9e0 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/actions/PopulateTreeArtifactActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/actions/PopulateTreeArtifactActionTest.java
@@ -31,9 +31,9 @@
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifactType;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
import com.google.devtools.build.lib.actions.ArtifactOwner;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.BaseSpawn;
import com.google.devtools.build.lib.actions.Executor;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.Spawn;
import com.google.devtools.build.lib.actions.SpawnActionContext;
import com.google.devtools.build.lib.actions.cache.Md5Digest;
@@ -106,12 +106,12 @@
}
};
- private Root root;
+ private ArtifactRoot root;
@Before
public void setRootDir() throws Exception {
Path execRoot = scratch.getFileSystem().getPath("/exec");
- root = Root.asDerivedRoot(execRoot, scratch.dir("/exec/out"));
+ root = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/exec/out"));
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTemplateTest.java b/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTemplateTest.java
index b325e3b..a13091d 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTemplateTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTemplateTest.java
@@ -24,7 +24,7 @@
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifactType;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
import com.google.devtools.build.lib.actions.ArtifactOwner;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.analysis.actions.SpawnActionTemplate.OutputPathMapper;
import com.google.devtools.build.lib.testutil.Scratch;
@@ -48,13 +48,13 @@
}
};
- private Root root;
+ private ArtifactRoot root;
@Before
public void setRootDir() throws Exception {
Scratch scratch = new Scratch();
Path execRoot = scratch.getFileSystem().getPath("/");
- root = Root.asDerivedRoot(execRoot, scratch.dir("/exec/root"));
+ root = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/exec/root"));
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/actions/TemplateExpansionActionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/actions/TemplateExpansionActionTest.java
index 2528e3b..3f6e62d 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/actions/TemplateExpansionActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/actions/TemplateExpansionActionTest.java
@@ -24,8 +24,8 @@
import com.google.devtools.build.lib.actions.ActionInputPrefetcher;
import com.google.devtools.build.lib.actions.ActionKeyContext;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.Executor;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ServerDirectories;
import com.google.devtools.build.lib.analysis.actions.TemplateExpansionAction.Substitution;
@@ -52,7 +52,7 @@
private static final String TEMPLATE = Joiner.on('\n').join("key=%key%", "value=%value%");
private static final String SPECIAL_CHARS = "Š©±½_strøget";
- private Root outputRoot;
+ private ArtifactRoot outputRoot;
private Artifact inputArtifact;
private Artifact outputArtifact;
private Path output;
@@ -77,8 +77,9 @@
}
private void createArtifacts(String template) throws Exception {
- Root workspace = Root.asSourceRoot(scratch.dir("/workspace"));
- outputRoot = Root.asDerivedRoot(scratch.dir("/workspace"), scratch.dir("/workspace/out"));
+ ArtifactRoot workspace = ArtifactRoot.asSourceRoot(scratch.dir("/workspace"));
+ outputRoot =
+ ArtifactRoot.asDerivedRoot(scratch.dir("/workspace"), scratch.dir("/workspace/out"));
Path input = scratch.overwriteFile("/workspace/input.txt", StandardCharsets.UTF_8, template);
inputArtifact = new Artifact(input, workspace);
output = scratch.resolve("/workspace/out/destination.txt");
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestUtil.java b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestUtil.java
index 8e3f755..1a5c6ea 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestUtil.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestUtil.java
@@ -29,11 +29,11 @@
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactFactory;
import com.google.devtools.build.lib.actions.ArtifactOwner;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.ExecutionStrategy;
import com.google.devtools.build.lib.actions.MiddlemanFactory;
import com.google.devtools.build.lib.actions.MutableActionGraph;
import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.analysis.AnalysisEnvironment;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
@@ -120,22 +120,22 @@
}
@Override
- public Artifact getDerivedArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getDerivedArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return original.getDerivedArtifact(rootRelativePath, root);
}
@Override
- public Artifact getConstantMetadataArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getConstantMetadataArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return original.getConstantMetadataArtifact(rootRelativePath, root);
}
@Override
- public Artifact getTreeArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getTreeArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return null;
}
@Override
- public Artifact getFilesetArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getFilesetArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return original.getFilesetArtifact(rootRelativePath, root);
}
@@ -326,12 +326,12 @@
}
@Override
- public Artifact getConstantMetadataArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getConstantMetadataArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return null;
}
@Override
- public Artifact getTreeArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getTreeArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return null;
}
@@ -366,12 +366,12 @@
}
@Override
- public Artifact getFilesetArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getFilesetArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return null;
}
@Override
- public Artifact getDerivedArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getDerivedArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return null;
}
@@ -462,7 +462,7 @@
Set<String> files = new LinkedHashSet<>();
for (Artifact artifact : artifacts) {
- Root root = artifact.getRoot();
+ ArtifactRoot root = artifact.getRoot();
if (root.isSourceRoot()) {
files.add("src " + artifact.getRootRelativePath());
} else {
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
index 457d184..a448942 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
@@ -36,13 +36,13 @@
import com.google.devtools.build.lib.actions.ActionKeyContext;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactOwner;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.CommandLineExpansionException;
import com.google.devtools.build.lib.actions.MapBasedActionGraph;
import com.google.devtools.build.lib.actions.MiddlemanFactory;
import com.google.devtools.build.lib.actions.MutableActionGraph;
import com.google.devtools.build.lib.actions.ResourceManager;
import com.google.devtools.build.lib.actions.ResourceSet;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.analysis.AnalysisEnvironment;
import com.google.devtools.build.lib.analysis.AnalysisUtils;
@@ -970,12 +970,12 @@
.isSameAs(getGeneratingActionForLabel(labelA));
}
- protected Artifact getSourceArtifact(PathFragment rootRelativePath, Root root) {
+ protected Artifact getSourceArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return view.getArtifactFactory().getSourceArtifact(rootRelativePath, root);
}
protected Artifact getSourceArtifact(String name) {
- return getSourceArtifact(PathFragment.create(name), Root.asSourceRoot(rootDirectory));
+ return getSourceArtifact(PathFragment.create(name), ArtifactRoot.asSourceRoot(rootDirectory));
}
/**
@@ -985,7 +985,7 @@
* #getBinArtifactWithNoOwner} or {@link #getGenfilesArtifactWithNoOwner} should be used instead.
*/
protected Artifact getDerivedArtifact(
- PathFragment rootRelativePath, Root root, ArtifactOwner owner) {
+ PathFragment rootRelativePath, ArtifactRoot root, ArtifactOwner owner) {
return view.getArtifactFactory().getDerivedArtifact(rootRelativePath, root, owner);
}
@@ -993,10 +993,10 @@
* Gets a derived Artifact for testing with path of the form
* root/owner.getPackageFragment()/packageRelativePath.
*
- * @see #getDerivedArtifact(PathFragment, Root, ArtifactOwner)
+ * @see #getDerivedArtifact(PathFragment, ArtifactRoot, ArtifactOwner)
*/
- private Artifact getPackageRelativeDerivedArtifact(String packageRelativePath, Root root,
- ArtifactOwner owner) {
+ private Artifact getPackageRelativeDerivedArtifact(
+ String packageRelativePath, ArtifactRoot root, ArtifactOwner owner) {
return getDerivedArtifact(
owner.getLabel().getPackageFragment().getRelative(packageRelativePath),
root, owner);
@@ -1708,12 +1708,12 @@
}
@Override
- public Artifact getConstantMetadataArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getConstantMetadataArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
throw new UnsupportedOperationException();
}
@Override
- public Artifact getTreeArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getTreeArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
throw new UnsupportedOperationException();
}
@@ -1748,12 +1748,12 @@
}
@Override
- public Artifact getFilesetArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getFilesetArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
throw new UnsupportedOperationException();
}
@Override
- public Artifact getDerivedArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getDerivedArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
throw new UnsupportedOperationException();
}
@@ -1925,7 +1925,7 @@
Rule associatedRule = target.getTarget().getAssociatedRule();
RepositoryName repository = associatedRule.getRepository();
- Root root;
+ ArtifactRoot root;
if (associatedRule.hasBinaryOutput()) {
root = configuration.getBinDirectory(repository);
} else {
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java
index c142337..7953c33 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java
@@ -20,7 +20,7 @@
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.ActionKeyContext;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider;
import com.google.devtools.build.lib.analysis.ServerDirectories;
@@ -201,7 +201,7 @@
public void assertConfigurationsHaveUniqueOutputDirectories(
BuildConfigurationCollection configCollection) throws Exception {
- Map<Root, BuildConfiguration> outputPaths = new HashMap<>();
+ Map<ArtifactRoot, BuildConfiguration> outputPaths = new HashMap<>();
for (BuildConfiguration config : configCollection.getTargetConfigurations()) {
if (config.isActionsEnabled()) {
BuildConfiguration otherConfig = outputPaths.get(
diff --git a/src/test/java/com/google/devtools/build/lib/exec/FilesetManifestTest.java b/src/test/java/com/google/devtools/build/lib/exec/FilesetManifestTest.java
index 4099d2e..a71ba03 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/FilesetManifestTest.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/FilesetManifestTest.java
@@ -20,7 +20,7 @@
import static org.junit.Assert.fail;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.vfs.FileSystem;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
@@ -58,7 +58,7 @@
// See AnalysisUtils for the mapping from "foo" to "_foo/MANIFEST".
scratchFile("/root/_foo/MANIFEST");
- Artifact artifact = new Artifact(fs.getPath("/root/foo"), Root.asSourceRoot(execRoot));
+ Artifact artifact = new Artifact(fs.getPath("/root/foo"), ArtifactRoot.asSourceRoot(execRoot));
FilesetManifest manifest =
FilesetManifest.parseManifestFile(artifact, execRoot, "workspace", IGNORE);
assertThat(manifest.getEntries()).isEmpty();
@@ -72,7 +72,8 @@
"workspace/bar /dir/file",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
FilesetManifest manifest =
FilesetManifest.parseManifestFile(artifact, execRoot, "workspace", IGNORE);
@@ -90,7 +91,8 @@
"workspace/baz /dir/file",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
FilesetManifest manifest =
FilesetManifest.parseManifestFile(artifact, execRoot, "workspace", IGNORE);
@@ -108,7 +110,8 @@
"workspace/bar /some",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
FilesetManifest manifest =
FilesetManifest.parseManifestFile(artifact, execRoot, "workspace", IGNORE);
@@ -125,7 +128,8 @@
"workspace/bar ", // <-- Note the trailing whitespace!
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
FilesetManifest manifest =
FilesetManifest.parseManifestFile(artifact, execRoot, "workspace", IGNORE);
@@ -140,7 +144,8 @@
"notworkspace/bar /foo/bar",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
try {
FilesetManifest.parseManifestFile(artifact, execRoot, "workspace", IGNORE);
@@ -162,7 +167,8 @@
"workspace/foo /foo/bar",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
try {
FilesetManifest.parseManifestFile(artifact, execRoot, "workspace", ERROR);
@@ -182,7 +188,8 @@
"workspace/foo /foo/bar",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
FilesetManifest manifest =
FilesetManifest.parseManifestFile(artifact, execRoot, "workspace", IGNORE);
@@ -200,7 +207,8 @@
"workspace/foo /foo/bar",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
FilesetManifest manifest =
FilesetManifest.parseManifestFile(artifact, execRoot, "workspace", RESOLVE);
@@ -218,7 +226,8 @@
"workspace/bar foo",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
try {
FilesetManifest.parseManifestFile(artifact, execRoot, "workspace", RESOLVE);
@@ -242,7 +251,8 @@
"workspace/bar /baz",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
FilesetManifest manifest =
FilesetManifest.parseManifestFile(artifact, execRoot, "workspace", IGNORE);
diff --git a/src/test/java/com/google/devtools/build/lib/exec/SpawnInputExpanderTest.java b/src/test/java/com/google/devtools/build/lib/exec/SpawnInputExpanderTest.java
index 71359fd..9e14fac 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/SpawnInputExpanderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/SpawnInputExpanderTest.java
@@ -20,8 +20,8 @@
import com.google.devtools.build.lib.actions.ActionInput;
import com.google.devtools.build.lib.actions.ActionInputHelper;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.EmptyRunfilesSupplier;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.RunfilesSupplier;
import com.google.devtools.build.lib.analysis.Runfiles;
import com.google.devtools.build.lib.analysis.RunfilesSupplierImpl;
@@ -76,7 +76,7 @@
@Test
public void testRunfilesSingleFile() throws Exception {
Artifact artifact =
- new Artifact(fs.getPath("/root/dir/file"), Root.asSourceRoot(fs.getPath("/root")));
+ new Artifact(fs.getPath("/root/dir/file"), ArtifactRoot.asSourceRoot(fs.getPath("/root")));
Runfiles runfiles = new Runfiles.Builder("workspace").addArtifact(artifact).build();
RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache mockCache = new FakeActionInputFileCache();
@@ -91,7 +91,7 @@
@Test
public void testRunfilesDirectoryStrict() throws Exception {
Artifact artifact =
- new Artifact(fs.getPath("/root/dir/file"), Root.asSourceRoot(fs.getPath("/root")));
+ new Artifact(fs.getPath("/root/dir/file"), ArtifactRoot.asSourceRoot(fs.getPath("/root")));
Runfiles runfiles = new Runfiles.Builder("workspace").addArtifact(artifact).build();
RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache mockCache = new FakeActionInputFileCache();
@@ -108,7 +108,7 @@
@Test
public void testRunfilesDirectoryNonStrict() throws Exception {
Artifact artifact =
- new Artifact(fs.getPath("/root/dir/file"), Root.asSourceRoot(fs.getPath("/root")));
+ new Artifact(fs.getPath("/root/dir/file"), ArtifactRoot.asSourceRoot(fs.getPath("/root")));
Runfiles runfiles = new Runfiles.Builder("workspace").addArtifact(artifact).build();
RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache mockCache = new FakeActionInputFileCache();
@@ -124,9 +124,9 @@
@Test
public void testRunfilesTwoFiles() throws Exception {
Artifact artifact1 =
- new Artifact(fs.getPath("/root/dir/file"), Root.asSourceRoot(fs.getPath("/root")));
+ new Artifact(fs.getPath("/root/dir/file"), ArtifactRoot.asSourceRoot(fs.getPath("/root")));
Artifact artifact2 =
- new Artifact(fs.getPath("/root/dir/baz"), Root.asSourceRoot(fs.getPath("/root")));
+ new Artifact(fs.getPath("/root/dir/baz"), ArtifactRoot.asSourceRoot(fs.getPath("/root")));
Runfiles runfiles = new Runfiles.Builder("workspace")
.addArtifact(artifact1)
.addArtifact(artifact2)
@@ -147,7 +147,7 @@
@Test
public void testRunfilesSymlink() throws Exception {
Artifact artifact =
- new Artifact(fs.getPath("/root/dir/file"), Root.asSourceRoot(fs.getPath("/root")));
+ new Artifact(fs.getPath("/root/dir/file"), ArtifactRoot.asSourceRoot(fs.getPath("/root")));
Runfiles runfiles = new Runfiles.Builder("workspace")
.addSymlink(PathFragment.create("symlink"), artifact).build();
RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
@@ -163,7 +163,7 @@
@Test
public void testRunfilesRootSymlink() throws Exception {
Artifact artifact =
- new Artifact(fs.getPath("/root/dir/file"), Root.asSourceRoot(fs.getPath("/root")));
+ new Artifact(fs.getPath("/root/dir/file"), ArtifactRoot.asSourceRoot(fs.getPath("/root")));
Runfiles runfiles = new Runfiles.Builder("workspace")
.addRootSymlink(PathFragment.create("symlink"), artifact).build();
RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
@@ -185,7 +185,8 @@
// See AnalysisUtils for the mapping from "foo" to "_foo/MANIFEST".
scratchFile("/root/out/_foo/MANIFEST");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
expander.parseFilesetManifest(inputMappings, artifact, "workspace");
assertThat(inputMappings).isEmpty();
@@ -199,7 +200,8 @@
"workspace/bar /dir/file",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
expander.parseFilesetManifest(inputMappings, artifact, "workspace");
assertThat(inputMappings).hasSize(1);
@@ -217,7 +219,8 @@
"workspace/baz /dir/file",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
expander.parseFilesetManifest(inputMappings, artifact, "workspace");
assertThat(inputMappings).hasSize(2);
@@ -235,7 +238,8 @@
"workspace/bar /some",
"<some digest>");
- Root outputRoot = Root.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
+ ArtifactRoot outputRoot =
+ ArtifactRoot.asDerivedRoot(fs.getPath("/root"), fs.getPath("/root/out"));
Artifact artifact = new Artifact(fs.getPath("/root/out/foo"), outputRoot);
expander.parseFilesetManifest(inputMappings, artifact, "workspace");
assertThat(inputMappings).hasSize(1);
diff --git a/src/test/java/com/google/devtools/build/lib/remote/TreeNodeRepositoryTest.java b/src/test/java/com/google/devtools/build/lib/remote/TreeNodeRepositoryTest.java
index 8c4f35e..48953ce 100644
--- a/src/test/java/com/google/devtools/build/lib/remote/TreeNodeRepositoryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/remote/TreeNodeRepositoryTest.java
@@ -20,7 +20,7 @@
import com.google.devtools.build.lib.actions.ActionInputFileCache;
import com.google.devtools.build.lib.actions.ActionInputHelper;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.clock.BlazeClock;
import com.google.devtools.build.lib.exec.SingleBuildFileCache;
import com.google.devtools.build.lib.remote.TreeNodeRepository.TreeNode;
@@ -46,14 +46,14 @@
private Scratch scratch;
private DigestUtil digestUtil;
private Path execRoot;
- private Root rootDir;
+ private ArtifactRoot rootDir;
@Before
public final void setRootDir() throws Exception {
digestUtil = new DigestUtil(HashFunction.SHA256);
scratch = new Scratch(new InMemoryFileSystem(BlazeClock.instance(), HashFunction.SHA256));
execRoot = scratch.getFileSystem().getPath("/exec/root");
- rootDir = Root.asSourceRoot(scratch.dir("/exec/root"));
+ rootDir = ArtifactRoot.asSourceRoot(scratch.dir("/exec/root"));
}
private TreeNodeRepository createTestTreeNodeRepository() {
diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/ResourceTestBase.java b/src/test/java/com/google/devtools/build/lib/rules/android/ResourceTestBase.java
index f86a574..37bcf0d 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/android/ResourceTestBase.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/android/ResourceTestBase.java
@@ -21,7 +21,7 @@
import com.google.common.collect.Multimap;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactOwner;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.packages.AbstractRuleErrorConsumer;
@@ -156,13 +156,13 @@
public FakeRuleErrorConsumer errorConsumer;
public FileSystem fileSystem;
- public Root root;
+ public ArtifactRoot root;
@Before
public void setup() {
errorConsumer = new FakeRuleErrorConsumer();
fileSystem = new InMemoryFileSystem();
- root = Root.asSourceRoot(fileSystem.getRootDirectory());
+ root = ArtifactRoot.asSourceRoot(fileSystem.getRootDirectory());
}
@After
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileCommandLineTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileCommandLineTest.java
index 99aa8a7..1e9b36d 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileCommandLineTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileCommandLineTest.java
@@ -18,7 +18,7 @@
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.FeatureConfiguration;
import com.google.devtools.build.lib.rules.cpp.CompileCommandLine.Builder;
@@ -42,7 +42,7 @@
private Artifact scratchArtifact(String s) {
Path execRoot = outputBase.getRelative("exec");
Path outputRoot = execRoot.getRelative("root");
- Root root = Root.asDerivedRoot(execRoot, outputRoot);
+ ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, outputRoot);
try {
return new Artifact(scratch.overwriteFile(outputRoot.getRelative(s).toString()), root);
} catch (IOException e) {
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java
index 6107747..703c3ff 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java
@@ -30,8 +30,8 @@
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifactType;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
import com.google.devtools.build.lib.actions.ArtifactOwner;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.ResourceSet;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.RuleContext;
@@ -82,7 +82,7 @@
}
@Override
- public Artifact getDerivedArtifact(PathFragment rootRelativePath, Root root) {
+ public Artifact getDerivedArtifact(PathFragment rootRelativePath, ArtifactRoot root) {
return CppLinkActionTest.this.getDerivedArtifact(
rootRelativePath, root, ActionsTestUtil.NULL_ARTIFACT_OWNER);
}
@@ -533,7 +533,7 @@
private Artifact scratchArtifact(String s) {
Path execRoot = outputBase.getRelative("exec");
Path outputRoot = execRoot.getRelative("out");
- Root root = Root.asDerivedRoot(execRoot, outputRoot);
+ ArtifactRoot root = ArtifactRoot.asDerivedRoot(execRoot, outputRoot);
try {
return new Artifact(scratch.overwriteFile(outputRoot.getRelative(s).toString()), root);
} catch (IOException e) {
@@ -673,7 +673,7 @@
Path path = execRoot.getRelative(execPath);
return new SpecialArtifact(
path,
- Root.asDerivedRoot(execRoot, execRoot.getRelative("out")),
+ ArtifactRoot.asDerivedRoot(execRoot, execRoot.getRelative("out")),
execPath,
ArtifactOwner.NULL_OWNER,
SpecialArtifactType.TREE);
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkActionTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkActionTest.java
index b7ea510..273d986 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CreateIncSymlinkActionTest.java
@@ -20,7 +20,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.actions.ActionKeyContext;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.testutil.FoundationTestCase;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -39,7 +39,7 @@
@Test
public void testDifferentOrderSameActionKey() throws Exception {
- Root root = Root.asDerivedRoot(rootDirectory, rootDirectory.getRelative("out"));
+ ArtifactRoot root = ArtifactRoot.asDerivedRoot(rootDirectory, rootDirectory.getRelative("out"));
Artifact a = new Artifact(PathFragment.create("a"), root);
Artifact b = new Artifact(PathFragment.create("b"), root);
Artifact c = new Artifact(PathFragment.create("c"), root);
@@ -59,7 +59,7 @@
@Test
public void testDifferentTargetsDifferentActionKey() throws Exception {
- Root root = Root.asDerivedRoot(rootDirectory, rootDirectory.getRelative("out"));
+ ArtifactRoot root = ArtifactRoot.asDerivedRoot(rootDirectory, rootDirectory.getRelative("out"));
Artifact a = new Artifact(PathFragment.create("a"), root);
Artifact b = new Artifact(PathFragment.create("b"), root);
CreateIncSymlinkAction action1 = new CreateIncSymlinkAction(NULL_ACTION_OWNER,
@@ -75,7 +75,7 @@
@Test
public void testDifferentSymlinksDifferentActionKey() throws Exception {
- Root root = Root.asDerivedRoot(rootDirectory, rootDirectory.getRelative("out"));
+ ArtifactRoot root = ArtifactRoot.asDerivedRoot(rootDirectory, rootDirectory.getRelative("out"));
Artifact a = new Artifact(PathFragment.create("a"), root);
Artifact b = new Artifact(PathFragment.create("b"), root);
CreateIncSymlinkAction action1 = new CreateIncSymlinkAction(NULL_ACTION_OWNER,
@@ -93,7 +93,7 @@
public void testExecute() throws Exception {
Path outputDir = rootDirectory.getRelative("out");
outputDir.createDirectory();
- Root root = Root.asDerivedRoot(rootDirectory, outputDir);
+ ArtifactRoot root = ArtifactRoot.asDerivedRoot(rootDirectory, outputDir);
Path symlink = rootDirectory.getRelative("out/a");
Artifact a = new Artifact(symlink, root);
Artifact b = new Artifact(PathFragment.create("b"), root);
@@ -110,7 +110,7 @@
public void testFileRemoved() throws Exception {
Path outputDir = rootDirectory.getRelative("out");
outputDir.createDirectory();
- Root root = Root.asDerivedRoot(rootDirectory, outputDir);
+ ArtifactRoot root = ArtifactRoot.asDerivedRoot(rootDirectory, outputDir);
Path symlink = rootDirectory.getRelative("out/subdir/a");
Artifact a = new Artifact(symlink, root);
Artifact b = new Artifact(PathFragment.create("b"), root);
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/J2ObjcSourceTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/J2ObjcSourceTest.java
index 043476e..0486cd3 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/J2ObjcSourceTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/J2ObjcSourceTest.java
@@ -17,7 +17,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.testing.EqualsTester;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.testutil.Scratch;
import com.google.devtools.build.lib.vfs.Path;
@@ -32,13 +32,13 @@
*/
@RunWith(JUnit4.class)
public class J2ObjcSourceTest {
- private Root rootDir;
+ private ArtifactRoot rootDir;
@Before
public final void setRootDir() throws Exception {
Scratch scratch = new Scratch();
Path execRoot = scratch.getFileSystem().getPath("/exec");
- rootDir = Root.asDerivedRoot(execRoot, scratch.dir("/exec/root"));
+ rootDir = ArtifactRoot.asDerivedRoot(execRoot, scratch.dir("/exec/root"));
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java b/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java
index 44cc3f8..08d6f9c 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilderTest.java
@@ -23,7 +23,7 @@
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.util.LabelArtifactOwner;
import com.google.devtools.build.lib.analysis.FilesToRunProvider;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
@@ -45,9 +45,9 @@
public class ProtoCompileActionBuilderTest {
private static final InMemoryFileSystem FILE_SYSTEM = new InMemoryFileSystem();
- private final Root root = Root.asSourceRoot(FILE_SYSTEM.getPath("/"));
- private final Root derivedRoot =
- Root.asDerivedRoot(FILE_SYSTEM.getPath("/"), FILE_SYSTEM.getPath("/out"));
+ private final ArtifactRoot root = ArtifactRoot.asSourceRoot(FILE_SYSTEM.getPath("/"));
+ private final ArtifactRoot derivedRoot =
+ ArtifactRoot.asDerivedRoot(FILE_SYSTEM.getPath("/"), FILE_SYSTEM.getPath("/out"));
@Test
public void commandLine_basic() throws Exception {
diff --git a/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java b/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java
index 81b4328..b522705 100644
--- a/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java
@@ -26,8 +26,8 @@
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.EventReportingArtifacts;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ServerDirectories;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
@@ -520,7 +520,7 @@
private Artifact makeArtifact(String pathString) {
Path path = outputBase.getRelative(PathFragment.create(pathString));
- return new Artifact(path, Root.asSourceRoot(outputBase));
+ return new Artifact(path, ArtifactRoot.asSourceRoot(outputBase));
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/runtime/ExperimentalStateTrackerTest.java b/src/test/java/com/google/devtools/build/lib/runtime/ExperimentalStateTrackerTest.java
index b9133f3..b7db0b3 100644
--- a/src/test/java/com/google/devtools/build/lib/runtime/ExperimentalStateTrackerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/runtime/ExperimentalStateTrackerTest.java
@@ -31,7 +31,7 @@
import com.google.devtools.build.lib.actions.ActionStartedEvent;
import com.google.devtools.build.lib.actions.ActionStatusMessage;
import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.bazel.repository.downloader.DownloadProgressEvent;
import com.google.devtools.build.lib.buildeventstream.AnnounceBuildEventTransportsEvent;
@@ -68,7 +68,7 @@
private Action mockAction(String progressMessage, String primaryOutput) {
Path path = outputBase.getRelative(PathFragment.create(primaryOutput));
- Artifact artifact = new Artifact(path, Root.asSourceRoot(outputBase));
+ Artifact artifact = new Artifact(path, ArtifactRoot.asSourceRoot(outputBase));
Action action = Mockito.mock(Action.class);
when(action.getProgressMessage()).thenReturn(progressMessage);
@@ -473,7 +473,7 @@
ManualClock clock = new ManualClock();
Path path = outputBase.getRelative(PathFragment.create(primaryOutput));
- Artifact artifact = new Artifact(path, Root.asSourceRoot(outputBase));
+ Artifact artifact = new Artifact(path, ArtifactRoot.asSourceRoot(outputBase));
ActionExecutionMetadata actionMetadata = Mockito.mock(ActionExecutionMetadata.class);
when(actionMetadata.getOwner()).thenReturn(Mockito.mock(ActionOwner.class));
when(actionMetadata.getPrimaryOutput()).thenReturn(artifact);
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunctionTest.java
index 8e55e34..f122174 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionFunctionTest.java
@@ -30,8 +30,8 @@
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
import com.google.devtools.build.lib.actions.ArtifactOwner;
import com.google.devtools.build.lib.actions.ArtifactPrefixConflictException;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.analysis.actions.CustomCommandLine;
import com.google.devtools.build.lib.analysis.actions.SpawnActionTemplate;
@@ -209,7 +209,7 @@
Path fullPath = rootDirectory.getRelative(execPath);
return new SpecialArtifact(
fullPath,
- Root.asDerivedRoot(rootDirectory, rootDirectory.getRelative("out")),
+ ArtifactRoot.asDerivedRoot(rootDirectory, rootDirectory.getRelative("out")),
execPath,
ArtifactOwner.NULL_OWNER,
SpecialArtifactType.TREE);
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java
index aba2931..339ad4e 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java
@@ -31,8 +31,8 @@
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact;
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifactType;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.MissingInputFileException;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.actions.util.TestAction.DummyAction;
import com.google.devtools.build.lib.events.NullEventHandler;
@@ -245,7 +245,7 @@
}
private Artifact createSourceArtifact(String path) {
- return new Artifact(PathFragment.create(path), Root.asSourceRoot(root));
+ return new Artifact(PathFragment.create(path), ArtifactRoot.asSourceRoot(root));
}
private Artifact createDerivedArtifact(String path) {
@@ -253,13 +253,17 @@
Path fullPath = root.getRelative(execPath);
Artifact output =
new Artifact(
- fullPath, Root.asDerivedRoot(root, root.getRelative("out")), execPath, ALL_OWNER);
+ fullPath,
+ ArtifactRoot.asDerivedRoot(root, root.getRelative("out")),
+ execPath,
+ ALL_OWNER);
actions.add(new DummyAction(ImmutableList.<Artifact>of(), output));
return output;
}
private Artifact createMiddlemanArtifact(String path) {
- Root middlemanRoot = Root.middlemanRoot(middlemanPath, middlemanPath.getRelative("out"));
+ ArtifactRoot middlemanRoot =
+ ArtifactRoot.middlemanRoot(middlemanPath, middlemanPath.getRelative("out"));
Path fullPath = middlemanRoot.getPath().getRelative(path);
return new Artifact(
fullPath, middlemanRoot, fullPath.relativeTo(middlemanRoot.getExecRoot()), ALL_OWNER);
@@ -276,7 +280,7 @@
Path fullPath = root.getRelative(execPath);
return new SpecialArtifact(
fullPath,
- Root.asDerivedRoot(root, root.getRelative("out")),
+ ArtifactRoot.asDerivedRoot(root, root.getRelative("out")),
execPath,
ALL_OWNER,
SpecialArtifactType.TREE);
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java
index 90ed181..2671226 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java
@@ -25,11 +25,11 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.FilesetOutputSymlink;
import com.google.devtools.build.lib.actions.FilesetTraversalParams;
import com.google.devtools.build.lib.actions.FilesetTraversalParams.PackageBoundaryMode;
import com.google.devtools.build.lib.actions.FilesetTraversalParamsFactory;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ServerDirectories;
import com.google.devtools.build.lib.cmdline.Label;
@@ -129,7 +129,7 @@
}
private Artifact getSourceArtifact(String path) throws Exception {
- return new Artifact(PathFragment.create(path), Root.asSourceRoot(rootDirectory));
+ return new Artifact(PathFragment.create(path), ArtifactRoot.asSourceRoot(rootDirectory));
}
private Artifact createSourceArtifact(String path) throws Exception {
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java
index 5005910..01ed4fd 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/FilesystemValueCheckerTest.java
@@ -29,7 +29,7 @@
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifactType;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
import com.google.devtools.build.lib.actions.ArtifactOwner;
-import com.google.devtools.build.lib.actions.Root;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.util.TestAction;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ServerDirectories;
@@ -608,14 +608,14 @@
Path outputPath = fs.getPath("/bin");
outputPath.createDirectory();
return new Artifact(
- outputPath.getRelative(relPath), Root.asDerivedRoot(fs.getPath("/"), outputPath));
+ outputPath.getRelative(relPath), ArtifactRoot.asDerivedRoot(fs.getPath("/"), outputPath));
}
private Artifact createTreeArtifact(String relPath) throws IOException {
Path outputDir = fs.getPath("/bin");
Path outputPath = outputDir.getRelative(relPath);
outputDir.createDirectory();
- Root derivedRoot = Root.asDerivedRoot(fs.getPath("/"), outputDir);
+ ArtifactRoot derivedRoot = ArtifactRoot.asDerivedRoot(fs.getPath("/"), outputDir);
return new SpecialArtifact(outputPath, derivedRoot,
derivedRoot.getExecPath().getRelative(outputPath.relativeTo(derivedRoot.getPath())),
ArtifactOwner.NULL_OWNER, SpecialArtifactType.TREE);
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java
index bb54b99..1779162 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java
@@ -28,8 +28,8 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.FilesetTraversalParams.PackageBoundaryMode;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider;
import com.google.devtools.build.lib.analysis.ServerDirectories;
@@ -150,12 +150,13 @@
}
private Artifact sourceArtifact(String path) {
- return new Artifact(PathFragment.create(path), Root.asSourceRoot(rootDirectory));
+ return new Artifact(PathFragment.create(path), ArtifactRoot.asSourceRoot(rootDirectory));
}
private Artifact sourceArtifactUnderPackagePath(String path, String packagePath) {
return new Artifact(
- PathFragment.create(path), Root.asSourceRoot(rootDirectory.getRelative(packagePath)));
+ PathFragment.create(path),
+ ArtifactRoot.asSourceRoot(rootDirectory.getRelative(packagePath)));
}
private Artifact derivedArtifact(String path) {
@@ -164,7 +165,7 @@
Artifact output =
new Artifact(
fullPath,
- Root.asDerivedRoot(rootDirectory, rootDirectory.getRelative("out")),
+ ArtifactRoot.asDerivedRoot(rootDirectory, rootDirectory.getRelative("out")),
execPath);
return output;
}
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTestCase.java b/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTestCase.java
index 8e569fc..e5a2ade 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/TimestampBuilderTestCase.java
@@ -40,11 +40,11 @@
import com.google.devtools.build.lib.actions.ActionLookupValue;
import com.google.devtools.build.lib.actions.ActionResult;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.BuildFailedException;
import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.actions.ResourceManager;
import com.google.devtools.build.lib.actions.ResourceSet;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.TestExecException;
import com.google.devtools.build.lib.actions.cache.ActionCache;
import com.google.devtools.build.lib.actions.cache.Protos.ActionCacheStatistics;
@@ -327,7 +327,7 @@
Artifact createSourceArtifact(FileSystem fs, String name) {
Path root = fs.getPath(TestUtils.tmpDir());
- return new Artifact(PathFragment.create(name), Root.asSourceRoot(root));
+ return new Artifact(PathFragment.create(name), ArtifactRoot.asSourceRoot(root));
}
protected Artifact createDerivedArtifact(String name) {
@@ -340,7 +340,7 @@
Path path = execRoot.getRelative(execPath);
return new Artifact(
path,
- Root.asDerivedRoot(execRoot, execRoot.getRelative("out")),
+ ArtifactRoot.asDerivedRoot(execRoot, execRoot.getRelative("out")),
execPath,
ACTION_LOOKUP_KEY);
}
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java
index 3846003..1a9063b 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactBuildTest.java
@@ -40,8 +40,8 @@
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact;
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifactType;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.BuildFailedException;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.cache.MetadataHandler;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.actions.util.TestAction;
@@ -1183,7 +1183,7 @@
Path path = execRoot.getRelative(execPath);
return new SpecialArtifact(
path,
- Root.asDerivedRoot(execRoot, execRoot.getRelative("out")),
+ ArtifactRoot.asDerivedRoot(execRoot, execRoot.getRelative("out")),
execPath,
ACTION_LOOKUP_KEY,
SpecialArtifactType.TREE);
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactMetadataTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactMetadataTest.java
index 0f346d6..3c32a9d 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactMetadataTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactMetadataTest.java
@@ -32,8 +32,8 @@
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact;
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifactType;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
+import com.google.devtools.build.lib.actions.ArtifactRoot;
import com.google.devtools.build.lib.actions.MissingInputFileException;
-import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.cache.DigestUtils;
import com.google.devtools.build.lib.actions.cache.Metadata;
import com.google.devtools.build.lib.actions.util.TestAction.DummyAction;
@@ -207,7 +207,10 @@
Path fullPath = root.getRelative(execPath);
Artifact output =
new SpecialArtifact(
- fullPath, Root.asDerivedRoot(root, root.getRelative("out")), execPath, ALL_OWNER,
+ fullPath,
+ ArtifactRoot.asDerivedRoot(root, root.getRelative("out")),
+ execPath,
+ ALL_OWNER,
SpecialArtifactType.TREE);
actions.add(new DummyAction(ImmutableList.<Artifact>of(), output));
FileSystemUtils.createDirectoryAndParents(fullPath);