From 51084ff6cfa9fbf79224bc70b1957c80a205890a Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Tue, 5 May 2020 19:19:22 +0100 Subject: Add //visibility:override to allow control over inheritance Visibility rules can be 'inherited' in one of two ways. Either from defaults or from a module that called ctx.CreateModule(...). Previously, in both cases the inheriting module could only append additional visibility rules to the end of the inherited rules. That made it impossible to restrict the visibility by removing or ignore inherited rules. The //visibility:override rectifies that by allowing the inheriting module to ignore all the rules that they would have inherited. It can only go at the beginning of a list of rules specified in a module but after defaults are applied it can end up in the middle of a list of rules. In that case it behaves as if all the rules up to and including the //visibility:override rule were discarded. It can be used with //visibility:private to override //visibility:public and vice versa. Bug: 155787200 Test: m nothing Change-Id: I8a9c9c5a1bdceaee387c08864ae2b34629e0d46f --- android/module.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'android/module.go') diff --git a/android/module.go b/android/module.go index e431adaf4..71c9893d8 100644 --- a/android/module.go +++ b/android/module.go @@ -331,6 +331,8 @@ type commonProperties struct { // ["//visibility:public"]: Anyone can use this module. // ["//visibility:private"]: Only rules in the module's package (not its subpackages) can use // this module. + // ["//visibility:override"]: Discards any rules inherited from defaults or a creating module. + // Can only be used at the beginning of a list of visibility rules. // ["//some/package:__pkg__", "//other/package:__pkg__"]: Only modules in some/package and // other/package (defined in some/package/*.bp and other/package/*.bp) have access to // this module. Note that sub-packages do not have access to the rule; for example, -- cgit v1.2.3-59-g8ed1b