Internal change.
PiperOrigin-RevId: 579886283
Change-Id: I0212202d3135ead4050032bc883c48b0ca1a925a
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java
index 5253d77..9dbc860 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java
@@ -203,12 +203,6 @@
return ImmutableMap.of();
}
- /**
- * Returns whether all artifacts output by the action are {@linkplain FileArtifactValue#isRemote
- * remote}.
- */
- public abstract boolean isEntirelyRemote();
-
public ImmutableList<FilesetOutputSymlink> getOutputSymlinks() {
return ImmutableList.of();
}
@@ -368,11 +362,6 @@
public final ImmutableMap<Artifact, FileArtifactValue> getAllFileValues() {
return ImmutableMap.of(artifact, value);
}
-
- @Override
- public final boolean isEntirelyRemote() {
- return value.isRemote();
- }
}
/**
@@ -427,16 +416,6 @@
public final ImmutableMap<Artifact, FileArtifactValue> getAllFileValues() {
return artifactData;
}
-
- @Override
- public boolean isEntirelyRemote() {
- for (FileArtifactValue fileArtifactValue : artifactData.values()) {
- if (!fileArtifactValue.isRemote()) {
- return false;
- }
- }
- return true;
- }
}
/** The result of an action that outputs a single tree artifact and no other files. */
@@ -465,11 +444,6 @@
public ImmutableMap<Artifact, FileArtifactValue> getAllFileValues() {
return ImmutableMap.of();
}
-
- @Override
- public boolean isEntirelyRemote() {
- return treeValue.isEntirelyRemote();
- }
}
/**
@@ -497,15 +471,5 @@
public ImmutableMap<Artifact, TreeArtifactValue> getAllTreeArtifactValues() {
return treeArtifactData;
}
-
- @Override
- public boolean isEntirelyRemote() {
- for (TreeArtifactValue treeArtifactValue : treeArtifactData.values()) {
- if (!treeArtifactValue.isEntirelyRemote()) {
- return false;
- }
- }
- return super.isEntirelyRemote();
- }
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BUILD b/src/main/java/com/google/devtools/build/lib/skyframe/BUILD
index d97df1e..f3e4565 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/BUILD
@@ -462,6 +462,7 @@
"//src/main/java/com/google/devtools/build/lib/util",
"//src/main/java/com/google/devtools/build/lib/util:hash_codes",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
+ "//third_party:error_prone_annotations",
"//third_party:guava",
"//third_party:jsr305",
],
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 a5b6ab2..9fdc6bc 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
@@ -2011,9 +2011,7 @@
if (packageValue != null) { // Null for errors e.g. "no such package"
Optional<Root> sourceRoot = packageValue.getPackage().getSourceRoot();
if (sourceRoot.isPresent()) {
- roots.put(
- (PackageIdentifier) key,
- maybeTransformSourceRootForExecrootSymlinkCreation(sourceRoot.get()));
+ roots.put((PackageIdentifier) key, sourceRoot.get());
}
}
}
@@ -2021,12 +2019,6 @@
return ImmutableMap.copyOf(roots);
}
- /** Returns a possibly transformed source root of a package for execroot symlink creation. */
- @ForOverride
- protected Root maybeTransformSourceRootForExecrootSymlinkCreation(Root sourceRoot) {
- return sourceRoot;
- }
-
public void clearSyscallCache() {
syscallCache.clear();
}
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ActionExecutionValueTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ActionExecutionValueTest.java
index bbbe03e..a63ab58 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/ActionExecutionValueTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/ActionExecutionValueTest.java
@@ -13,7 +13,6 @@
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
-import static com.google.common.truth.Truth.assertThat;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -37,15 +36,9 @@
import com.google.devtools.build.lib.skyframe.serialization.testutils.SerializationDepsUtils;
import com.google.devtools.build.lib.skyframe.serialization.testutils.SerializationTester;
import com.google.devtools.build.lib.testutil.Scratch;
-import com.google.devtools.build.lib.vfs.DigestHashFunction;
import com.google.devtools.build.lib.vfs.FileSystem;
-import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.Root.RootCodecDependencies;
-import com.google.devtools.build.lib.vfs.Symlinks;
-import com.google.devtools.build.lib.vfs.SyscallCache;
-import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem;
-import java.io.IOException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -71,8 +64,6 @@
private static final ArtifactRoot OUTPUT_ROOT =
ArtifactRoot.asDerivedRoot(new Scratch().resolve("/execroot"), RootType.Output, "out");
- private final Scratch scratch =
- new Scratch(new InMemoryFileSystem(DigestHashFunction.SHA256), "/root");
@Test
public void equality() {
@@ -186,122 +177,6 @@
.runTests();
}
- @Test
- public void isEntirelyRemote() throws IOException {
- Path file1 = scratch.file("/file1");
- FileArtifactValue value1Local =
- FileArtifactValue.createFromStat(file1, file1.stat(Symlinks.FOLLOW), SyscallCache.NO_CACHE);
-
- // Remote artifact.
- ActionExecutionValue actionExecutionValue1 =
- createWithArtifactData(ImmutableMap.of(output("file1"), VALUE_1_REMOTE));
-
- assertThat(actionExecutionValue1.isEntirelyRemote()).isTrue();
-
- // Local artifact.
- ActionExecutionValue actionExecutionValue2 =
- createWithArtifactData(ImmutableMap.of(output("file1"), value1Local));
-
- assertThat(actionExecutionValue2.isEntirelyRemote()).isFalse();
-
- // Local and remote artifacts.
- ActionExecutionValue actionExecutionValue3 =
- createWithArtifactData(
- ImmutableMap.of(output("file1"), value1Local, output("file2"), VALUE_2_REMOTE));
-
- assertThat(actionExecutionValue3.isEntirelyRemote()).isFalse();
-
- SpecialArtifact tree1 = tree("tree1");
- TreeArtifactValue tree1Value1Remote =
- TreeArtifactValue.newBuilder(tree1)
- .putChild(TreeFileArtifact.createTreeOutput(tree1, "file1"), VALUE_1_REMOTE)
- .build();
-
- // Remote tree artifact.
- ActionExecutionValue actionExecutionValue4 =
- createWithTreeArtifactData(ImmutableMap.of(tree1, tree1Value1Remote));
-
- assertThat(actionExecutionValue4.isEntirelyRemote()).isTrue();
-
- SpecialArtifact tree2 = tree("tree2");
- Path file2 = scratch.file("/file2");
- FileArtifactValue value2Local =
- FileArtifactValue.createFromStat(file2, file2.stat(Symlinks.FOLLOW), SyscallCache.NO_CACHE);
- TreeArtifactValue tree2Value2Local =
- TreeArtifactValue.newBuilder(tree2)
- .putChild(TreeFileArtifact.createTreeOutput(tree2, "file2"), value2Local)
- .build();
-
- // Local tree artifact.
- ActionExecutionValue actionExecutionValue5 =
- createWithTreeArtifactData(ImmutableMap.of(tree2, tree2Value2Local));
-
- assertThat(actionExecutionValue5.isEntirelyRemote()).isFalse();
-
- // Local and remote tree artifacts.
- ActionExecutionValue actionExecutionValue6 =
- createWithTreeArtifactData(
- ImmutableMap.of(tree2, tree2Value2Local, tree1, tree1Value1Remote));
-
- assertThat(actionExecutionValue6.isEntirelyRemote()).isFalse();
-
- // Remote artifact and local tree artifact.
- ActionExecutionValue actionExecutionValue7 =
- createWithArtifactAndTreeArtifactData(
- ImmutableMap.of(output("file1"), VALUE_1_REMOTE),
- ImmutableMap.of(tree2, tree2Value2Local));
-
- assertThat(actionExecutionValue7.isEntirelyRemote()).isFalse();
-
- // Local artifact and remote tree artifact.
- ActionExecutionValue actionExecutionValue8 =
- createWithArtifactAndTreeArtifactData(
- ImmutableMap.of(output("file2"), value2Local),
- ImmutableMap.of(tree1, tree1Value1Remote));
-
- assertThat(actionExecutionValue8.isEntirelyRemote()).isFalse();
-
- // Local artifact and tree artifact.
- ActionExecutionValue actionExecutionValue9 =
- createWithArtifactAndTreeArtifactData(
- ImmutableMap.of(output("file1"), value1Local),
- ImmutableMap.of(tree2, tree2Value2Local));
-
- assertThat(actionExecutionValue9.isEntirelyRemote()).isFalse();
-
- // Remote artifact and tree artifact.
- ActionExecutionValue actionExecutionValue10 =
- createWithArtifactAndTreeArtifactData(
- ImmutableMap.of(output("file2"), VALUE_2_REMOTE),
- ImmutableMap.of(tree1, tree1Value1Remote));
-
- assertThat(actionExecutionValue10.isEntirelyRemote()).isTrue();
-
- // Empty tree artifact.
- ActionExecutionValue actionExecutionValue11 =
- createWithTreeArtifactData(ImmutableMap.of(tree1, TreeArtifactValue.empty()));
-
- assertThat(actionExecutionValue11.isEntirelyRemote()).isFalse();
-
- // Discovered modules.
- ActionExecutionValue actionExecutionValue12 =
- createWithDiscoveredModules(NestedSetBuilder.create(Order.STABLE_ORDER, output("file1")));
-
- assertThat(actionExecutionValue12.isEntirelyRemote()).isTrue();
-
- FilesetOutputSymlink symlink1 =
- FilesetOutputSymlink.createForTesting(
- PathFragment.create("name1"),
- PathFragment.create("target1"),
- PathFragment.create("execPath1"));
-
- // Fileset.
- ActionExecutionValue actionExecutionValue13 =
- createWithOutputSymlinks(ImmutableList.of(symlink1));
-
- assertThat(actionExecutionValue13.isEntirelyRemote()).isTrue();
- }
-
private static ActionExecutionValue createWithArtifactData(
ImmutableMap<Artifact, FileArtifactValue> artifactData) {
return ActionExecutionValue.createFromOutputMetadataStore(
@@ -320,16 +195,6 @@
/* discoveredModules= */ NestedSetBuilder.emptySet(Order.STABLE_ORDER));
}
- private static ActionExecutionValue createWithArtifactAndTreeArtifactData(
- ImmutableMap<Artifact, FileArtifactValue> artifactData,
- ImmutableMap<Artifact, TreeArtifactValue> treeArtifactData) {
- return ActionExecutionValue.createFromOutputMetadataStore(
- artifactData,
- treeArtifactData,
- /* outputSymlinks= */ ImmutableList.of(),
- /* discoveredModules= */ NestedSetBuilder.emptySet(Order.STABLE_ORDER));
- }
-
private static ActionExecutionValue createWithOutputSymlinks(
ImmutableList<FilesetOutputSymlink> outputSymlinks) {
return ActionExecutionValue.createFromOutputMetadataStore(