Skip to content

Commit 7c92cfc

Browse files
benjaminpcopybara-github
authored andcommitted
Ignore empty virtual artifacts when spawn-logging inputs.
Fixes bazelbuild#12816. Closes bazelbuild#12819. PiperOrigin-RevId: 355800567
1 parent bebbace commit 7c92cfc

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/main/java/com/google/devtools/build/lib/exec/SpawnLogContext.java

+3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ public void logSpawn(
9191
try {
9292
for (Map.Entry<PathFragment, ActionInput> e : inputMap.entrySet()) {
9393
ActionInput input = e.getValue();
94+
if (input instanceof VirtualActionInput.EmptyActionInput) {
95+
continue;
96+
}
9497
Path inputPath = execRoot.getRelative(input.getExecPathString());
9598
if (inputPath.isDirectory()) {
9699
listDirectoryContents(inputPath, builder::addInputs, metadataProvider);

src/test/shell/bazel/bazel_execlog_test.sh

+20
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,26 @@ EOF
119119
wc output || fail "no output produced"
120120
}
121121

122+
function test_empty_file_in_runfiles() {
123+
mkdir d
124+
touch d/main.py
125+
cat > BUILD <<'EOF'
126+
py_binary(
127+
name = "py_tool",
128+
main = "d/main.py",
129+
srcs = ["d/main.py"],
130+
)
131+
genrule(
132+
name = "rule",
133+
outs = ["out.txt"],
134+
tools = [":py_tool"],
135+
cmd = "echo hello > $(location out.txt)"
136+
)
137+
EOF
138+
bazel build //:rule --experimental_execution_log_file output 2>&1 >> $TEST_log || fail "could not build"
139+
[[ -e output ]] || fail "no output produced"
140+
}
141+
122142
function test_negating_flags() {
123143
cat > BUILD <<'EOF'
124144
genrule(

0 commit comments

Comments
 (0)