From 9773250e10a5132ef3e679e4eede9ef344ba3d70 Mon Sep 17 00:00:00 2001 From: Googler Date: Wed, 13 Sep 2023 09:12:23 -0700 Subject: [PATCH] Add test for aspect-on-aspect where the main aspect can propagate to its base aspects dependencies but not the other way around PiperOrigin-RevId: 565069551 Change-Id: I593d7568b0759dcb28e4d75f33da92b456b6d7b6 --- src/test/shell/integration/aspect_test.sh | 106 ++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/src/test/shell/integration/aspect_test.sh b/src/test/shell/integration/aspect_test.sh index 961a3f5c9e8805..d1257a4570f6e6 100755 --- a/src/test/shell/integration/aspect_test.sh +++ b/src/test/shell/integration/aspect_test.sh @@ -1492,4 +1492,110 @@ EOF expect_log "no such package 'missing'" } +function test_aspect_on_aspect_propagate_to_underlying_aspect_dep() { + local package="test" + mkdir -p "${package}" + + cat > "${package}/defs.bzl" < "${package}/tool.sh" < "${package}/BUILD" < $TEST_log || fail "Build failed" + + expect_log "aspect_b on target @//test:t3" + expect_log "aspect_b on target @//test:t2" + # the underlying aspect (aspect_b) cannot propagate to the dependencies of + # its main aspect (aspect_a) + expect_not_log "aspect_b on target @//test:tool" + # the main aspect (aspect_a) can propagate to its underlying aspects + # dependencies + expect_log "aspect_a on target @//test:tool_b" + expect_log "aspect_a on target @//test:t3" + expect_log "aspect_a on target @//test:t3 can see: aspect_b on target @//test:t3" + expect_log "aspect_a on target @//test:t3 can see: aspect_a on target @//test:tool_b" + expect_log "aspect_a on target @//test:t2" + expect_log "aspect_a on target @//test:t2 can see: aspect_b on target @//test:t2" + expect_log "aspect_a on target @//test:t2 can see: aspect_a on target @//test:tool_b" + expect_log "aspect_a on target @//test:t2 can see: aspect_a on target @//test:t3" +} + run_suite "Tests for aspects"