Skip to content

Commit 9c22032

Browse files
Googlercopybara-github
Googler
authored andcommitted
Update logic for --nobuild_runfile_manifests allowance in RunCommand.
PiperOrigin-RevId: 750989674 Change-Id: I1a51017fb5e24fab34d968855a6906872312aabf
1 parent 383be5c commit 9c22032

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,12 @@ private static BuiltTargets getBuiltTargets(
455455
configuration = result.getBuildConfiguration();
456456
}
457457

458-
// When virtual paths are enabled, assume runfiles staging is handled elsewhere.
458+
// When --nobuild_runfile_manifests is enabled, either virtual roots are also enabled (in which
459+
// case we assume runfiles staging is handled elsewhere) or the output service is responsible
460+
// for staging runfiles.
459461
if (!configuration.buildRunfileManifests()
460-
&& env.getDirectories().getVirtualSourceRoot() == null) {
462+
&& env.getDirectories().getVirtualSourceRoot() == null
463+
&& !env.getOutputService().stagesTopLevelRunfiles()) {
461464
throw new RunCommandException(
462465
reportAndCreateFailureResult(
463466
env,
@@ -945,8 +948,10 @@ private static Path ensureRunfilesBuilt(
945948
workingDir = workingDir.getRelative(runfilesSupport.getRunfiles().getPrefix());
946949
}
947950

948-
// When virtual paths are enabled, assume runfiles staging is handled elsewhere.
949-
if (env.getDirectories().getVirtualSourceRoot() != null) {
951+
// Return early if runfiles staging is handled elsewhere (i.e. either if virtual roots are
952+
// enabled or if it's managed by the output service).
953+
if (env.getDirectories().getVirtualSourceRoot() != null
954+
|| env.getOutputService().stagesTopLevelRunfiles()) {
950955
return workingDir.devirtualize();
951956
}
952957

src/main/java/com/google/devtools/build/lib/vfs/OutputService.java

+4
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,8 @@ default BulkDeleter bulkDeleter() {
264264
default XattrProvider getXattrProvider(XattrProvider delegate) {
265265
return delegate;
266266
}
267+
268+
default boolean stagesTopLevelRunfiles() {
269+
return false;
270+
}
267271
}

0 commit comments

Comments
 (0)