Skip to content

Commit

Permalink
Ignore empty virtual artifacts when spawn-logging inputs.
Browse files Browse the repository at this point in the history
Fixes bazelbuild#12816.

Closes bazelbuild#12819.

PiperOrigin-RevId: 355800567
  • Loading branch information
benjaminp authored and copybara-github committed Feb 5, 2021
1 parent bebbace commit 7c92cfc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public void logSpawn(
try {
for (Map.Entry<PathFragment, ActionInput> e : inputMap.entrySet()) {
ActionInput input = e.getValue();
if (input instanceof VirtualActionInput.EmptyActionInput) {
continue;
}
Path inputPath = execRoot.getRelative(input.getExecPathString());
if (inputPath.isDirectory()) {
listDirectoryContents(inputPath, builder::addInputs, metadataProvider);
Expand Down
20 changes: 20 additions & 0 deletions src/test/shell/bazel/bazel_execlog_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,26 @@ EOF
wc output || fail "no output produced"
}

function test_empty_file_in_runfiles() {
mkdir d
touch d/main.py
cat > BUILD <<'EOF'
py_binary(
name = "py_tool",
main = "d/main.py",
srcs = ["d/main.py"],
)
genrule(
name = "rule",
outs = ["out.txt"],
tools = [":py_tool"],
cmd = "echo hello > $(location out.txt)"
)
EOF
bazel build //:rule --experimental_execution_log_file output 2>&1 >> $TEST_log || fail "could not build"
[[ -e output ]] || fail "no output produced"
}

function test_negating_flags() {
cat > BUILD <<'EOF'
genrule(
Expand Down

0 comments on commit 7c92cfc

Please sign in to comment.