Use Artifact#getRunfilesPath to expand rootpath and rootpaths vars if --nolegacy_external_runfiles is specified.
PiperOrigin-RevId: 342051423
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 8bb793a..7284784 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
@@ -164,6 +164,7 @@
private final Label root;
private final boolean multiple;
private boolean execPaths;
+ private boolean legacyExternalRunfiles;
private final Map<Label, Collection<Artifact>> labelMap = new HashMap<>();
LocationFunctionBuilder(String rootLabel, boolean multiple) {
@@ -172,7 +173,8 @@
}
public LocationFunction build() {
- return new LocationFunction(root, Suppliers.ofInstance(labelMap), execPaths, multiple);
+ return new LocationFunction(
+ root, Suppliers.ofInstance(labelMap), execPaths, legacyExternalRunfiles, multiple);
}
public LocationFunctionBuilder setExecPaths(boolean execPaths) {
@@ -180,6 +182,11 @@
return this;
}
+ public LocationFunctionBuilder setLegacyExternalRunfiles(boolean legacyExternalRunfiles) {
+ this.legacyExternalRunfiles = legacyExternalRunfiles;
+ return this;
+ }
+
public LocationFunctionBuilder add(String label, String... paths) {
labelMap.put(
Label.parseAbsoluteUnchecked(label),