Fulfill a `TODO` to rename `RunfilesSupplierImpl` to `SingleRunfilesSupplier` and allow overriding the directory name.
PiperOrigin-RevId: 355054996
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BUILD b/src/main/java/com/google/devtools/build/lib/analysis/BUILD
index 1cc968c..220d4d5 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BUILD
@@ -206,10 +206,10 @@
"RuleErrorConsumer.java",
"Runfiles.java",
"RunfilesProvider.java",
- "RunfilesSupplierImpl.java",
"RunfilesSupport.java",
"ShToolchain.java",
"ShellConfiguration.java",
+ "SingleRunfilesSupplier.java",
"SourceManifestAction.java",
"StarlarkProviderValidationUtil.java",
"TargetAndConfiguration.java",
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/FilesToRunProvider.java b/src/main/java/com/google/devtools/build/lib/analysis/FilesToRunProvider.java
index 44223de..42f5a3c 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/FilesToRunProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/FilesToRunProvider.java
@@ -94,7 +94,7 @@
/** Return a {@link RunfilesSupplier} encapsulating runfiles for this tool. */
public RunfilesSupplier getRunfilesSupplier() {
if (runfilesSupport != null) {
- return RunfilesSupplierImpl.create(runfilesSupport);
+ return SingleRunfilesSupplier.create(runfilesSupport);
} else {
return EmptyRunfilesSupplier.INSTANCE;
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImpl.java b/src/main/java/com/google/devtools/build/lib/analysis/SingleRunfilesSupplier.java
similarity index 82%
rename from src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImpl.java
rename to src/main/java/com/google/devtools/build/lib/analysis/SingleRunfilesSupplier.java
index 730f26f..52c5385 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImpl.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/SingleRunfilesSupplier.java
@@ -29,9 +29,8 @@
import javax.annotation.Nullable;
/** {@link RunfilesSupplier} implementation wrapping a single {@link Runfiles} directory mapping. */
-// TODO(bazel-team): Consider renaming to SingleRunfilesSupplierImpl.
@AutoCodec
-public class RunfilesSupplierImpl implements RunfilesSupplier {
+public class SingleRunfilesSupplier implements RunfilesSupplier {
private final PathFragment runfilesDir;
private final Runfiles runfiles;
@Nullable private final Artifact manifest;
@@ -46,12 +45,12 @@
* @param buildRunfileLinks whether runfile symlinks are created during build
* @param runfileLinksEnabled whether it's allowed to create runfile symlinks
*/
- public RunfilesSupplierImpl(
+ public SingleRunfilesSupplier(
PathFragment runfilesDir,
Runfiles runfiles,
boolean buildRunfileLinks,
boolean runfileLinksEnabled) {
- this(runfilesDir, runfiles, /* manifest= */ null, buildRunfileLinks, runfileLinksEnabled);
+ this(runfilesDir, runfiles, /*manifest=*/ null, buildRunfileLinks, runfileLinksEnabled);
}
/**
@@ -66,7 +65,7 @@
* @param runfileLinksEnabled whether it's allowed to create runfile symlinks
*/
@AutoCodec.Instantiator
- public RunfilesSupplierImpl(
+ public SingleRunfilesSupplier(
PathFragment runfilesDir,
Runfiles runfiles,
@Nullable Artifact manifest,
@@ -82,18 +81,18 @@
/** Use this constructor in tests only. */
@VisibleForTesting
- public RunfilesSupplierImpl(PathFragment runfilesDir, Runfiles runfiles) {
+ public SingleRunfilesSupplier(PathFragment runfilesDir, Runfiles runfiles) {
this(
runfilesDir,
runfiles,
- /* manifest= */ null,
- /* buildRunfileLinks= */ false,
- /* runfileLinksEnabled= */ false);
+ /*manifest=*/ null,
+ /*buildRunfileLinks=*/ false,
+ /*runfileLinksEnabled=*/ false);
}
/** Creates a runfiles supplier */
- public static RunfilesSupplier create(RunfilesSupport runfilesSupport) {
- return new RunfilesSupplierImpl(
+ public static SingleRunfilesSupplier create(RunfilesSupport runfilesSupport) {
+ return new SingleRunfilesSupplier(
runfilesSupport.getRunfilesDirectoryExecPath(),
runfilesSupport.getRunfiles(),
runfilesSupport.isBuildRunfileLinks(),
@@ -106,7 +105,7 @@
Runfiles runfiles,
@Nullable Artifact manifest,
BuildConfiguration configuration) {
- return new RunfilesSupplierImpl(
+ return new SingleRunfilesSupplier(
runfilesDir,
runfiles,
manifest,
@@ -132,7 +131,7 @@
@Override
public ImmutableList<Artifact> getManifests() {
- return manifest != null ? ImmutableList.of(manifest) : ImmutableList.<Artifact>of();
+ return manifest != null ? ImmutableList.of(manifest) : ImmutableList.of();
}
@Override
@@ -144,4 +143,15 @@
public boolean isRunfileLinksEnabled(PathFragment runfilesDir) {
return runfileLinksEnabled && this.runfilesDir.equals(runfilesDir);
}
+
+ /**
+ * Returns a {@link SingleRunfilesSupplier} identical to this one, but with the given runfiles
+ * directory.
+ */
+ public SingleRunfilesSupplier withOverriddenRunfilesDir(PathFragment newRunfilesDir) {
+ return newRunfilesDir.equals(runfilesDir)
+ ? this
+ : new SingleRunfilesSupplier(
+ newRunfilesDir, runfiles, manifest, buildRunfileLinks, runfileLinksEnabled);
+ }
}
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 8ba63b2..d7c20a4 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
@@ -30,9 +30,9 @@
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.Runfiles;
import com.google.devtools.build.lib.analysis.RunfilesProvider;
-import com.google.devtools.build.lib.analysis.RunfilesSupplierImpl;
import com.google.devtools.build.lib.analysis.RunfilesSupport;
import com.google.devtools.build.lib.analysis.ShToolchain;
+import com.google.devtools.build.lib.analysis.SingleRunfilesSupplier;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import com.google.devtools.build.lib.analysis.actions.LazyWriteNestedSetOfPairAction;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
@@ -72,7 +72,7 @@
private ExecutionInfo executionRequirements;
private InstrumentedFilesInfo instrumentedFiles;
private int explicitShardCount;
- private Map<String, String> extraEnv;
+ private final Map<String, String> extraEnv;
public TestActionBuilder(RuleContext ruleContext) {
this.ruleContext = ruleContext;
@@ -368,18 +368,18 @@
boolean cancelConcurrentTests =
testConfiguration.runsPerTestDetectsFlakes()
&& testConfiguration.cancelConcurrentTests();
- RunfilesSupplier testRunfilesSupplier;
+ SingleRunfilesSupplier testRunfilesSupplier;
if (isPersistentTestRunner()) {
// Create a RunfilesSupplier from the persistent test runner's runfiles. Pass only the
// test runner's runfiles to avoid using a different worker for every test run.
testRunfilesSupplier =
- new RunfilesSupplierImpl(
- /* runfilesDir= */ persistentTestRunnerRunfiles.getSuffix(),
- /* runfiles= */ persistentTestRunnerRunfiles,
- /* buildRunfileLinks= */ false,
- /* runfileLinksEnabled= */ false);
+ new SingleRunfilesSupplier(
+ /*runfilesDir=*/ persistentTestRunnerRunfiles.getSuffix(),
+ /*runfiles=*/ persistentTestRunnerRunfiles,
+ /*buildRunfileLinks=*/ false,
+ /*runfileLinksEnabled=*/ false);
} else {
- testRunfilesSupplier = RunfilesSupplierImpl.create(runfilesSupport);
+ testRunfilesSupplier = SingleRunfilesSupplier.create(runfilesSupport);
}
ImmutableList.Builder<Artifact> tools = new ImmutableList.Builder<>();
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java b/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java
index c444175..13579eb 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java
@@ -48,6 +48,7 @@
import com.google.devtools.build.lib.actions.SpawnExecutedEvent;
import com.google.devtools.build.lib.actions.SpawnResult;
import com.google.devtools.build.lib.actions.TestExecException;
+import com.google.devtools.build.lib.analysis.SingleRunfilesSupplier;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.config.RunUnder;
import com.google.devtools.build.lib.analysis.test.TestActionContext.FailedAttemptResult;
@@ -171,7 +172,7 @@
TestRunnerAction(
ActionOwner owner,
NestedSet<Artifact> inputs,
- RunfilesSupplier runfilesSupplier,
+ SingleRunfilesSupplier runfilesSupplier,
Artifact testSetupScript, // Must be in inputs
Artifact testXmlGeneratorScript, // Must be in inputs
@Nullable Artifact collectCoverageScript, // Must be in inputs, if not null
@@ -410,6 +411,10 @@
return unconditionalExecution;
}
+ @Override // Tighten return type.
+ public SingleRunfilesSupplier getRunfilesSupplier() {
+ return (SingleRunfilesSupplier) super.getRunfilesSupplier();
+ }
@Override
public boolean isVolatile() {
diff --git a/src/test/java/com/google/devtools/build/lib/actions/BaseSpawnTest.java b/src/test/java/com/google/devtools/build/lib/actions/BaseSpawnTest.java
index a27a2e9..f711dfc 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/BaseSpawnTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/BaseSpawnTest.java
@@ -19,7 +19,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.analysis.Runfiles;
-import com.google.devtools.build.lib.analysis.RunfilesSupplierImpl;
+import com.google.devtools.build.lib.analysis.SingleRunfilesSupplier;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.util.Map;
import org.junit.Test;
@@ -42,9 +42,10 @@
public void testGetEnvironmentAddsRunfilesWhenOnlyOneSuppliedViaRunfilesSupplier() {
Map<String, String> baseEnviron = ImmutableMap.of("HELLO", "world");
final String runfilesDir = "runfilesdir";
- BaseSpawn underTest = minimalBaseSpawn(
- baseEnviron,
- new RunfilesSupplierImpl(PathFragment.create(runfilesDir), Runfiles.EMPTY));
+ BaseSpawn underTest =
+ minimalBaseSpawn(
+ baseEnviron,
+ new SingleRunfilesSupplier(PathFragment.create(runfilesDir), Runfiles.EMPTY));
Map<String, String> expected = ImmutableMap.<String, String>builder()
.putAll(baseEnviron)
@@ -62,8 +63,8 @@
minimalBaseSpawn(
baseEnviron,
CompositeRunfilesSupplier.of(
- new RunfilesSupplierImpl(PathFragment.create("rfdir1"), Runfiles.EMPTY),
- new RunfilesSupplierImpl(PathFragment.create("rfdir2"), Runfiles.EMPTY)));
+ new SingleRunfilesSupplier(PathFragment.create("rfdir1"), Runfiles.EMPTY),
+ new SingleRunfilesSupplier(PathFragment.create("rfdir2"), Runfiles.EMPTY)));
assertThat(underTest.getEnvironment()).isEqualTo(baseEnviron);
}
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
deleted file mode 100644
index 87d419e..0000000
--- a/src/test/java/com/google/devtools/build/lib/analysis/RunfilesSupplierImplTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2015 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.devtools.build.lib.analysis;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import com.google.common.collect.ImmutableList;
-import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.ArtifactRoot;
-import com.google.devtools.build.lib.actions.ArtifactRoot.RootType;
-import com.google.devtools.build.lib.actions.RunfilesSupplier;
-import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
-import com.google.devtools.build.lib.testutil.Scratch;
-import com.google.devtools.build.lib.vfs.Path;
-import com.google.devtools.build.lib.vfs.PathFragment;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-/** Tests for RunfilesSupplierImpl */
-@RunWith(JUnit4.class)
-public class RunfilesSupplierImplTest {
- private ArtifactRoot rootDir;
-
- @Before
- public final void setRoot() {
- Scratch scratch = new Scratch();
- Path execRoot = scratch.getFileSystem().getPath("/");
- rootDir =
- ArtifactRoot.asDerivedRoot(execRoot, RootType.Output, "fake", "root", "dont", "matter");
- }
-
- @Test
- public void testGetArtifactsWithSingleMapping() {
- List<Artifact> artifacts = mkArtifacts(rootDir, "thing1", "thing2");
-
- RunfilesSupplierImpl underTest =
- new RunfilesSupplierImpl(PathFragment.create("notimportant"), mkRunfiles(artifacts));
-
- assertThat(underTest.getArtifacts().toList()).containsExactlyElementsIn(artifacts);
- }
-
- @Test
- public void testGetManifestsWhenNone() {
- RunfilesSupplier underTest =
- new RunfilesSupplierImpl(PathFragment.create("ignored"), Runfiles.EMPTY);
- assertThat(underTest.getManifests()).isEmpty();
- }
-
- @Test
- public void testGetManifestsWhenSupplied() {
- Artifact manifest = ActionsTestUtil.createArtifact(rootDir, "manifest");
- RunfilesSupplier underTest =
- new RunfilesSupplierImpl(
- PathFragment.create("ignored"),
- Runfiles.EMPTY,
- manifest,
- /* buildRunfileLinks= */ false,
- /* runfileLinksEnabled= */ false);
- assertThat(underTest.getManifests()).containsExactly(manifest);
- }
-
- private static Runfiles mkRunfiles(Iterable<Artifact> artifacts) {
- return new Runfiles.Builder("TESTING", false).addArtifacts(artifacts).build();
- }
-
- private static List<Artifact> mkArtifacts(ArtifactRoot rootDir, String... paths) {
- ImmutableList.Builder<Artifact> builder = ImmutableList.builder();
- for (String path : paths) {
- builder.add(ActionsTestUtil.createArtifact(rootDir, path));
- }
- return builder.build();
- }
-}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/SingleRunfilesSupplierTest.java b/src/test/java/com/google/devtools/build/lib/analysis/SingleRunfilesSupplierTest.java
new file mode 100644
index 0000000..e1ddefa
--- /dev/null
+++ b/src/test/java/com/google/devtools/build/lib/analysis/SingleRunfilesSupplierTest.java
@@ -0,0 +1,121 @@
+// Copyright 2015 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.devtools.build.lib.analysis;
+
+import static com.google.common.truth.Truth.assertThat;
+
+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.ArtifactRoot;
+import com.google.devtools.build.lib.actions.ArtifactRoot.RootType;
+import com.google.devtools.build.lib.actions.RunfilesSupplier;
+import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
+import com.google.devtools.build.lib.vfs.DigestHashFunction;
+import com.google.devtools.build.lib.vfs.PathFragment;
+import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem;
+import java.util.List;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Tests for {@link SingleRunfilesSupplier}. */
+@RunWith(JUnit4.class)
+public final class SingleRunfilesSupplierTest {
+
+ private final ArtifactRoot rootDir =
+ ArtifactRoot.asDerivedRoot(
+ new InMemoryFileSystem(DigestHashFunction.SHA256).getPath("/"),
+ RootType.Output,
+ "fake",
+ "root",
+ "dont",
+ "matter");
+
+ @Test
+ public void testGetArtifactsWithSingleMapping() {
+ List<Artifact> artifacts = mkArtifacts(rootDir, "thing1", "thing2");
+
+ SingleRunfilesSupplier underTest =
+ new SingleRunfilesSupplier(PathFragment.create("notimportant"), mkRunfiles(artifacts));
+
+ assertThat(underTest.getArtifacts().toList()).containsExactlyElementsIn(artifacts);
+ }
+
+ @Test
+ public void testGetManifestsWhenNone() {
+ RunfilesSupplier underTest =
+ new SingleRunfilesSupplier(PathFragment.create("ignored"), Runfiles.EMPTY);
+ assertThat(underTest.getManifests()).isEmpty();
+ }
+
+ @Test
+ public void testGetManifestsWhenSupplied() {
+ Artifact manifest = ActionsTestUtil.createArtifact(rootDir, "manifest");
+ RunfilesSupplier underTest =
+ new SingleRunfilesSupplier(
+ PathFragment.create("ignored"),
+ Runfiles.EMPTY,
+ manifest,
+ /*buildRunfileLinks=*/ false,
+ /*runfileLinksEnabled=*/ false);
+ assertThat(underTest.getManifests()).containsExactly(manifest);
+ }
+
+ @Test
+ public void withOverriddenRunfilesDir() {
+ SingleRunfilesSupplier original =
+ new SingleRunfilesSupplier(
+ PathFragment.create("old"),
+ Runfiles.EMPTY,
+ ActionsTestUtil.createArtifact(rootDir, "manifest"),
+ /*buildRunfileLinks=*/ false,
+ /*runfileLinksEnabled=*/ false);
+ PathFragment newDir = PathFragment.create("new");
+
+ RunfilesSupplier overridden = original.withOverriddenRunfilesDir(newDir);
+
+ assertThat(overridden.getRunfilesDirs()).containsExactly(newDir);
+ assertThat(overridden.getMappings())
+ .containsExactly(newDir, Iterables.getOnlyElement(original.getMappings().values()));
+ assertThat(overridden.getArtifacts()).isEqualTo(original.getArtifacts());
+ assertThat(overridden.getManifests()).isEqualTo(original.getManifests());
+ }
+
+ @Test
+ public void withOverriddenRunfilesDir_noChange_sameObject() {
+ PathFragment dir = PathFragment.create("dir");
+ SingleRunfilesSupplier original =
+ new SingleRunfilesSupplier(
+ dir,
+ Runfiles.EMPTY,
+ ActionsTestUtil.createArtifact(rootDir, "manifest"),
+ /*buildRunfileLinks=*/ false,
+ /*runfileLinksEnabled=*/ false);
+ assertThat(original.withOverriddenRunfilesDir(dir)).isSameInstanceAs(original);
+ }
+
+ private static Runfiles mkRunfiles(Iterable<Artifact> artifacts) {
+ return new Runfiles.Builder("TESTING", false).addArtifacts(artifacts).build();
+ }
+
+ private static ImmutableList<Artifact> mkArtifacts(ArtifactRoot rootDir, String... paths) {
+ ImmutableList.Builder<Artifact> builder = ImmutableList.builder();
+ for (String path : paths) {
+ builder.add(ActionsTestUtil.createArtifact(rootDir, path));
+ }
+ return builder.build();
+ }
+}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTest.java
index d36de5a..a14be6d 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/actions/SpawnActionTest.java
@@ -40,7 +40,7 @@
import com.google.devtools.build.lib.actions.extra.SpawnInfo;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.analysis.Runfiles;
-import com.google.devtools.build.lib.analysis.RunfilesSupplierImpl;
+import com.google.devtools.build.lib.analysis.SingleRunfilesSupplier;
import com.google.devtools.build.lib.analysis.util.ActionTester;
import com.google.devtools.build.lib.analysis.util.ActionTester.ActionCombinationFactory;
import com.google.devtools.build.lib.analysis.util.AnalysisTestUtil;
@@ -344,7 +344,7 @@
builder()
.addInput(manifest)
.addRunfilesSupplier(
- new RunfilesSupplierImpl(
+ new SingleRunfilesSupplier(
PathFragment.create("destination"),
Runfiles.EMPTY,
manifest,
@@ -570,7 +570,7 @@
}
private static RunfilesSupplier runfilesSupplier(Artifact manifest, PathFragment dir) {
- return new RunfilesSupplierImpl(
+ return new SingleRunfilesSupplier(
dir,
Runfiles.EMPTY,
manifest,
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 05827f4..fcf2568 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
@@ -39,7 +39,7 @@
import com.google.devtools.build.lib.actions.cache.VirtualActionInput;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.analysis.Runfiles;
-import com.google.devtools.build.lib.analysis.RunfilesSupplierImpl;
+import com.google.devtools.build.lib.analysis.SingleRunfilesSupplier;
import com.google.devtools.build.lib.exec.util.FakeActionInputFileCache;
import com.google.devtools.build.lib.exec.util.SpawnBuilder;
import com.google.devtools.build.lib.vfs.DigestHashFunction;
@@ -88,7 +88,8 @@
ArtifactRoot.asSourceRoot(Root.fromPath(fs.getPath("/root"))),
fs.getPath("/root/dir/file"));
Runfiles runfiles = new Runfiles.Builder("workspace").addArtifact(artifact).build();
- RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
+ RunfilesSupplier supplier =
+ new SingleRunfilesSupplier(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache mockCache = new FakeActionInputFileCache();
mockCache.put(
artifact,
@@ -105,7 +106,8 @@
public void testRunfilesWithFileset() throws Exception {
Artifact artifact = createFilesetArtifact("foo/biz/fs_out");
Runfiles runfiles = new Runfiles.Builder("workspace").addArtifact(artifact).build();
- RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
+ RunfilesSupplier supplier =
+ new SingleRunfilesSupplier(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache mockCache = new FakeActionInputFileCache();
mockCache.put(
artifact,
@@ -144,7 +146,8 @@
ArtifactRoot.asSourceRoot(Root.fromPath(fs.getPath("/root"))),
fs.getPath("/root/dir/file"));
Runfiles runfiles = new Runfiles.Builder("workspace").addArtifact(artifact).build();
- RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
+ RunfilesSupplier supplier =
+ new SingleRunfilesSupplier(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache mockCache = new FakeActionInputFileCache();
mockCache.put(artifact, FileArtifactValue.createForDirectoryWithMtime(-1));
@@ -164,7 +167,8 @@
ArtifactRoot.asSourceRoot(Root.fromPath(fs.getPath("/root"))),
fs.getPath("/root/dir/file"));
Runfiles runfiles = new Runfiles.Builder("workspace").addArtifact(artifact).build();
- RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
+ RunfilesSupplier supplier =
+ new SingleRunfilesSupplier(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache mockCache = new FakeActionInputFileCache();
mockCache.put(artifact, FileArtifactValue.createForDirectoryWithMtime(-1));
@@ -187,7 +191,8 @@
fs.getPath("/root/dir/baz"));
Runfiles runfiles =
new Runfiles.Builder("workspace").addArtifact(artifact1).addArtifact(artifact2).build();
- RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
+ RunfilesSupplier supplier =
+ new SingleRunfilesSupplier(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache mockCache = new FakeActionInputFileCache();
mockCache.put(
artifact1,
@@ -216,7 +221,8 @@
new Runfiles.Builder("workspace")
.addSymlink(PathFragment.create("symlink"), artifact)
.build();
- RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
+ RunfilesSupplier supplier =
+ new SingleRunfilesSupplier(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache mockCache = new FakeActionInputFileCache();
mockCache.put(
artifact,
@@ -239,7 +245,8 @@
new Runfiles.Builder("workspace")
.addRootSymlink(PathFragment.create("symlink"), artifact)
.build();
- RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
+ RunfilesSupplier supplier =
+ new SingleRunfilesSupplier(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache mockCache = new FakeActionInputFileCache();
mockCache.put(
artifact,
@@ -272,7 +279,8 @@
output.addAll(Arrays.asList(file1, file2));
}
};
- RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
+ RunfilesSupplier supplier =
+ new SingleRunfilesSupplier(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache fakeCache = new FakeActionInputFileCache();
fakeCache.put(file1, FileArtifactValue.createForTesting(file1));
fakeCache.put(file2, FileArtifactValue.createForTesting(file2));
@@ -304,7 +312,8 @@
output.addAll(Arrays.asList(file1, file2));
}
};
- RunfilesSupplier supplier = new RunfilesSupplierImpl(PathFragment.create("runfiles"), runfiles);
+ RunfilesSupplier supplier =
+ new SingleRunfilesSupplier(PathFragment.create("runfiles"), runfiles);
FakeActionInputFileCache fakeCache = new FakeActionInputFileCache();
fakeCache.put(file1, FileArtifactValue.createForTesting(file1));
fakeCache.put(file2, FileArtifactValue.createForTesting(file2));
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/LtoBackendActionTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/LtoBackendActionTest.java
index be3b751..d7e7c14 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/LtoBackendActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/LtoBackendActionTest.java
@@ -28,7 +28,7 @@
import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.analysis.Runfiles;
-import com.google.devtools.build.lib.analysis.RunfilesSupplierImpl;
+import com.google.devtools.build.lib.analysis.SingleRunfilesSupplier;
import com.google.devtools.build.lib.analysis.util.ActionTester;
import com.google.devtools.build.lib.analysis.util.ActionTester.ActionCombinationFactory;
import com.google.devtools.build.lib.analysis.util.AnalysisTestUtil;
@@ -210,7 +210,7 @@
if (attributesToFlip.contains(KeyAttributes.RUNFILES_SUPPLIER)) {
builder.addRunfilesSupplier(
- new RunfilesSupplierImpl(
+ new SingleRunfilesSupplier(
PathFragment.create("a"),
Runfiles.EMPTY,
artifactA,
@@ -218,7 +218,7 @@
/* runfileLinksEnabled= */ false));
} else {
builder.addRunfilesSupplier(
- new RunfilesSupplierImpl(
+ new SingleRunfilesSupplier(
PathFragment.create("a"),
Runfiles.EMPTY,
artifactB,