diff options
| author | 2020-05-13 22:11:40 +0100 | |
|---|---|---|
| committer | 2020-05-16 12:07:03 +0100 | |
| commit | adb189529a79e50bafb11c67bb502525a05a2583 (patch) | |
| tree | 9dca8d31a16de55351cd64ea9a905ca2eebbdb30 /android/visibility.go | |
| parent | f8533bc6369b960e891e5edaa62b997dce95e9d4 (diff) | |
Fix special case when appending a visibility rule to //visibility:private.
Test: m nothing
Bug: 151303681
Merged-In: Ibe7e953219e4660c653063e87cb08407a2cb513d
Change-Id: Ibe7e953219e4660c653063e87cb08407a2cb513d
(cherry picked from commit 64aeaaddef14cf83a6ffeca5c683a989c07fda7d)
Diffstat (limited to 'android/visibility.go')
| -rw-r--r-- | android/visibility.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/android/visibility.go b/android/visibility.go index 5aa7f3f67..68da1c475 100644 --- a/android/visibility.go +++ b/android/visibility.go @@ -500,6 +500,17 @@ func EffectiveVisibilityRules(ctx BaseModuleContext, module Module) []string { // without checking the visibility rules. Here we need to add that visibility // explicitly. if rule != nil && !rule.matches(qualified) { + if len(rule) == 1 { + if _, ok := rule[0].(privateRule); ok { + // If the rule is //visibility:private we can't append another + // visibility to it. Semantically we need to convert it to a package + // visibility rule for the location where the result is used, but since + // modules are implicitly visible within the package we get the same + // result without any rule at all, so just make it an empty list to be + // appended below. + rule = compositeRule{} + } + } rule = append(rule, packageRule{dir}) } |