From 259c67d9dd0b173fb4cc5830d29ce6004e67ff84 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 23 May 2018 03:53:01 -0700 Subject: RepositoryResolvedEvent: only record the explicitly set original attributes Prune down the list of attributes to the explicitly set ones when reporting the original attributes. The attribute list also contains attributes implicitly added from default values, but the original attributes are intended to record the original way the rule was invoked from the WORKSPACE file. Change-Id: I918656159850a52e9afc9f045701b0ea065f4125 PiperOrigin-RevId: 197702283 --- src/test/shell/bazel/workspace_resolved_test.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/test/shell') diff --git a/src/test/shell/bazel/workspace_resolved_test.sh b/src/test/shell/bazel/workspace_resolved_test.sh index 01a33dd501..d4de82e107 100755 --- a/src/test/shell/bazel/workspace_resolved_test.sh +++ b/src/test/shell/bazel/workspace_resolved_test.sh @@ -56,6 +56,7 @@ EOF # Verify that bazel can read the generated repo.bzl file and that it contains # the expected information cd .. + echo; cat repo.bzl; echo; echo mkdir analysisrepo mv repo.bzl analysisrepo cd analysisrepo @@ -69,12 +70,19 @@ load("//:repo.bzl", "resolved") cmd = "echo %s > $@" % entry["repositories"][0]["attributes"]["extra_arg"], ) for entry in resolved if entry["original_rule_class"] == "//:rule.bzl%trivial_rule" ] + +[ genrule( + name = "origcount", + outs = ["origcount.txt"], + cmd = "echo %s > $@" % len(entry["original_attributes"]) + ) for entry in resolved if entry["original_rule_class"] == "//:rule.bzl%trivial_rule" +] EOF - cat BUILD - bazel build //:out || fail "Expected success" + bazel build :out :origcount || fail "Expected success" grep "foobar" `bazel info bazel-genfiles`/out.txt \ || fail "Did not find the expected value" - + [ $(cat `bazel info bazel-genfiles`/origcount.txt) -eq 2 ] \ + || fail "Not the correct number of original attributes" } run_suite "workspace_resolved_test tests" -- cgit v1.2.3