63c6e183d5
Existing modules, either general one or package ones have a single visibility property, called visibility in general, and default_visibility on package, that controls access to that module, or in the case of package sets the default visibility of all modules in that package. The property is checked and gathered during the similarly named phases of visibility processing. The defaults module will be different as it will have two properties. The first, visibility, will not affect the visibility of the module, it only affects the visibility of modules that 'extend' the defaults. So, it will need checking but not parsing. The second property, defaults_visibility, will affect the visibility of the module and so will need both checking and parsing. The current implementation does not handle those cases because: 1) It does not differentiate between the property that affects the module and those that do not. It checks and gathers all of them with the last property gathered overriding the rules for the previous properties. 2) It relies on overriding methods in MethodBase in order to change the default behavior for the package module. That works because packageModule embeds ModuleBase but will not work for DefaultsModuleBase as it does not embed ModuleBase and instead is embedded alongside it so attempting to override a method in MethodBase leads to ambiguity. This change addresses the issues as follows: 1) It adds a new visibility() []string method to get access to the primary visibility rules, i.e. the ones that affect the module. 2) It adds two fields, 'visibilityPropertyInfo []visibilityProperty' to provide information about all the properties that need checking, and 'primaryVisibilityProperty visibilityProperty' to specify the property that affects the module. The PackageFactory() and InitAndroidModule(Module) functions are modified to initialize the fields. The override of the visibilityProperties() method for packageModule is removed and the default implementations of visibilityProperties() and visibility() on ModuleBase return information from the two new fields. The InitDefaultsModule is updated to also initialize the two new fields. It uses nil for primaryVisibilityProperty for now but that will be changed to return defaults_visibility. It also uses the commonProperties structure created for the defaults directly instead of having to search for it through properties(). Changed the visibilityProperty to take a pointer to the property that can be used to retrieve the value rather than a lambda function. Bug: 130796911 Test: m nothing Change-Id: Icadd470a5f692a48ec61de02bf3dfde3e2eea2ef |
||
---|---|---|
.. | ||
android_test.go | ||
androidmk.go | ||
androidmk_test.go | ||
apex.go | ||
api_levels.go | ||
arch.go | ||
arch_test.go | ||
config.go | ||
config_test.go | ||
defaults.go | ||
defaults_test.go | ||
defs.go | ||
env.go | ||
expand.go | ||
expand_test.go | ||
filegroup.go | ||
hooks.go | ||
makevars.go | ||
module.go | ||
module_test.go | ||
mutator.go | ||
mutator_test.go | ||
namespace.go | ||
namespace_test.go | ||
neverallow.go | ||
neverallow_test.go | ||
notices.go | ||
onceper.go | ||
onceper_test.go | ||
override_module.go | ||
package.go | ||
package_ctx.go | ||
package_test.go | ||
path_properties.go | ||
path_properties_test.go | ||
paths.go | ||
paths_test.go | ||
prebuilt.go | ||
prebuilt_etc.go | ||
prebuilt_etc_test.go | ||
prebuilt_test.go | ||
proto.go | ||
register.go | ||
rule_builder.go | ||
rule_builder_test.go | ||
sh_binary.go | ||
sh_binary_test.go | ||
singleton.go | ||
testing.go | ||
util.go | ||
util_test.go | ||
variable.go | ||
variable_test.go | ||
visibility.go | ||
visibility_test.go | ||
vts_config.go | ||
vts_config_test.go | ||
writedocs.go |