Skip to content

Commit

Permalink
Automated rollback of commit d27e443.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 346333542
  • Loading branch information
meisterT authored and copybara-github committed Dec 8, 2020
1 parent 3becef2 commit 6a3f3fb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down
57 changes: 0 additions & 57 deletions src/test/shell/bazel/remote/remote_execution_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 6a3f3fb

Please sign in to comment.