diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionInputMapHelper.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionInputMapHelper.java index f024131f12f511..471f77c910da18 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionInputMapHelper.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionInputMapHelper.java @@ -25,6 +25,7 @@ import com.google.devtools.build.lib.actions.Artifact.ArchivedTreeArtifact; import com.google.devtools.build.lib.actions.Artifact.DerivedArtifact; import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact; +import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact; import com.google.devtools.build.lib.actions.FileArtifactValue; import com.google.devtools.build.lib.actions.FilesetOutputSymlink; import com.google.devtools.build.lib.analysis.actions.SymlinkAction; @@ -120,16 +121,31 @@ static void addToMap( /*depOwner=*/ key); consumer.accumulate(treeArtifactValue); } else if (value instanceof ActionExecutionValue) { - FileArtifactValue metadata = ((ActionExecutionValue) value).getExistingFileArtifactValue(key); - inputMap.put(key, metadata, key); - if (key.isFileset()) { - ImmutableList filesets = getFilesets(env, (SpecialArtifact) key); - if (filesets != null) { - topLevelFilesets.put(key, filesets); - consumer.accumulate(filesets); - } + if (key instanceof TreeFileArtifact) { + SpecialArtifact treeArtifact = key.getParent(); + TreeArtifactValue treeArtifactValue = ((ActionExecutionValue) value) + .getTreeArtifactValue(treeArtifact); + expandTreeArtifactAndPopulateArtifactData( + treeArtifact, + treeArtifactValue, + expandedArtifacts, + archivedTreeArtifacts, + inputMap, + /*depOwner=*/ key); + consumer.accumulate(treeArtifactValue); } else { - consumer.accumulate(metadata); + FileArtifactValue metadata = ((ActionExecutionValue) value).getExistingFileArtifactValue( + key); + inputMap.put(key, metadata, key); + if (key.isFileset()) { + ImmutableList filesets = getFilesets(env, (SpecialArtifact) key); + if (filesets != null) { + topLevelFilesets.put(key, filesets); + consumer.accumulate(filesets); + } + } else { + consumer.accumulate(metadata); + } } } else { Preconditions.checkArgument(value instanceof FileArtifactValue, "Unexpected value %s", value); diff --git a/src/test/shell/bazel/remote/build_without_the_bytes_test.sh b/src/test/shell/bazel/remote/build_without_the_bytes_test.sh index 477a2f0bd8335f..3680f845c1846f 100755 --- a/src/test/shell/bazel/remote/build_without_the_bytes_test.sh +++ b/src/test/shell/bazel/remote/build_without_the_bytes_test.sh @@ -70,14 +70,7 @@ else declare -r EXE_EXT="" fi -function test_cc_tree() { - if [[ "$PLATFORM" == "darwin" ]]; then - # TODO(b/37355380): This test is disabled due to RemoteWorker not supporting - # setting SDKROOT and DEVELOPER_DIR appropriately, as is required of - # action executors in order to select the appropriate Xcode toolchain. - return 0 - fi - +function setup_cc_tree() { mkdir -p a cat > a/BUILD <& "$TEST_log" \ - || fail "Failed to build //a:tree_cc with minimal downloads" + || fail "Failed to build //a:tree_cc with remote executor and minimal downloads" +} + +function test_cc_tree_remote_cache() { + if [[ "$PLATFORM" == "darwin" ]]; then + # TODO(b/37355380): This test is disabled due to RemoteWorker not supporting + # setting SDKROOT and DEVELOPER_DIR appropriately, as is required of + # action executors in order to select the appropriate Xcode toolchain. + return 0 + fi + + setup_cc_tree + + bazel build \ + --remote_cache=grpc://localhost:${worker_port} \ + --remote_download_minimal \ + //a:tree_cc >& "$TEST_log" \ + || fail "Failed to build //a:tree_cc with remote cache and minimal downloads" } function test_cc_include_scanning_and_minimal_downloads() {