From 6a3f3fb880bfa0e119b5327c96bd50726d56c5d5 Mon Sep 17 00:00:00 2001 From: twerth Date: Tue, 8 Dec 2020 08:41:13 -0800 Subject: [PATCH] Automated rollback of commit d27e443d5ae0fcb57e1a6a2377410eaa01ef5491. PiperOrigin-RevId: 346333542 --- .../starlark/StarlarkActionFactory.java | 6 -- .../bazel/remote/remote_execution_test.sh | 57 ------------------- 2 files changed, 63 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkActionFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkActionFactory.java index 840fd97d60567c..31266ec9550829 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkActionFactory.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkActionFactory.java @@ -613,12 +613,6 @@ private void registerStarlarkAction( for (RunfilesSupplier supplier : Sequence.cast(inputManifestsUnchecked, RunfilesSupplier.class, "runfiles suppliers")) { builder.addRunfilesSupplier(supplier); - // Normally these artifacts will be added directly to the inputs, but we're gentle if the - // user fails to do so. Unfortunately, because ctx.resolve_command currently flattens - // tools' runfiles (see TODO in StarlarkRuleContext#resolveCommand), this will lead to - // duplicate traversal/memory usage for this nested set if the user does add the inputs and - // those inputs include the runfiles. - builder.addTransitiveInputs(supplier.getArtifacts()); } } diff --git a/src/test/shell/bazel/remote/remote_execution_test.sh b/src/test/shell/bazel/remote/remote_execution_test.sh index a44ab5205051bb..440a23939da82c 100755 --- a/src/test/shell/bazel/remote/remote_execution_test.sh +++ b/src/test/shell/bazel/remote/remote_execution_test.sh @@ -2358,61 +2358,4 @@ end_of_record" assert_equals "$expected_result" "$(cat bazel-testlogs/java/factorial/fact-test/coverage.dat)" } -function test_runfiles_input_mismatch() { - case "$PLATFORM" in - darwin|freebsd|linux|openbsd) - ;; - *) - return 0 - ;; - esac - - mkdir -p foo - cat > foo/runfiles.bzl <<'EOF' -def _tool_impl(ctx): - file = ctx.files._data[0] - data_file_path = '$0.runfiles/' + ctx.workspace_name + '/' + file.path - my_runfiles = ctx.runfiles(files = [file]) - ctx.actions.write( - output = ctx.outputs.executable, - content = '#!/bin/bash\ncat %s > $1' % data_file_path, - is_executable = True, - ) - return [DefaultInfo(runfiles = my_runfiles)] - -tool = rule( - implementation = _tool_impl, - executable = True, - attrs = {'_data': attr.label(allow_files = True, default = ':foo.txt')}, -) - -def _tool_user_impl(ctx): - my_out = ctx.actions.declare_file(ctx.attr.name + '_out') - tool = ctx.executable.tool - ins, _, manifests = ctx.resolve_command(tools = [ctx.attr.tool]) - ctx.actions.run_shell( - outputs = [my_out], - # No inputs mentioned, but runfiles present. - input_manifests = manifests, - command = '%s %s' % (tool.path, my_out.path), - ) - return [DefaultInfo(files = depset([my_out]))] - -tool_user = rule( - implementation = _tool_user_impl, - attrs = { - 'tool': attr.label(mandatory = True, executable = True, cfg = 'exec'), - }, -) -EOF - cat >foo/BUILD <<'EOF' -load(':runfiles.bzl', 'tool_user', 'tool') -tool_user(name = 'user', tool = ':tool') -tool(name = 'tool') -EOF - touch foo/foo.txt - bazel build --remote_executor=grpc://localhost:${worker_port} //foo:user \ - &> "$TEST_log" || fail "Expected success" -} - run_suite "Remote execution and remote cache tests"