Skip to content

Commit

Permalink
Remote: Make `--incompatible_remote_build_event_upload_respect_no_cac…
Browse files Browse the repository at this point in the history
…he` working with alias.

Fixes #14456.

Closes #14461.

PiperOrigin-RevId: 417637635
  • Loading branch information
coeuvre authored and copybara-github committed Dec 21, 2021
1 parent 13112c0 commit 3ea7028
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,9 @@ private void parseNoCacheOutputs(AnalysisResult analysisResult) {
}

for (ConfiguredTarget configuredTarget : analysisResult.getTargetsToBuild()) {
// This will either dereference an alias chain, or return the final ConfiguredTarget.
configuredTarget = configuredTarget.getActual();

if (configuredTarget instanceof RuleConfiguredTarget) {
RuleConfiguredTarget ruleConfiguredTarget = (RuleConfiguredTarget) configuredTarget;
for (ActionAnalysisMetadata action : ruleConfiguredTarget.getActions()) {
Expand Down
27 changes: 27 additions & 0 deletions src/test/shell/bazel/remote/remote_execution_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3354,6 +3354,33 @@ EOF
expect_log "command.profile.gz.*bytestream://" || fail "should upload profile data"
}

function test_uploader_alias_action_respect_no_cache() {
mkdir -p a
cat > a/BUILD <<EOF
genrule(
name = 'foo',
outs = ["foo.txt"],
cmd = "echo \"foo bar\" > \$@",
tags = ["no-cache"],
)
alias(
name = 'foo-alias',
actual = '//a:foo',
)
EOF

bazel build \
--remote_cache=grpc://localhost:${worker_port} \
--incompatible_remote_build_event_upload_respect_no_cache \
--build_event_json_file=bep.json \
//a:foo-alias >& $TEST_log || fail "Failed to build"

cat bep.json > $TEST_log
expect_not_log "a:foo.*bytestream://"
expect_log "command.profile.gz.*bytestream://"
}

function test_uploader_respect_no_cache_trees() {
mkdir -p a
cat > a/output_dir.bzl <<'EOF'
Expand Down

0 comments on commit 3ea7028

Please sign in to comment.