platform_build_soong/android
Paul Duffin 63c6e183d5 Refactor visibility to support visibility on defaults modules
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
2019-07-25 11:31:42 +01:00
..
android_test.go Share buildDir for android/soong/android tests 2019-06-10 15:51:06 -07:00
androidmk.go Merge "Make relative path for native_bridge binaries configurable" 2019-07-16 09:17:35 +00:00
androidmk_test.go soong: Fix AndroidMk with *Required properties 2019-07-16 02:28:29 +09:00
apex.go Fix data race and ordering consistency in apex modules 2019-06-03 15:52:27 -07:00
api_levels.go Consolidate baseContext, BaseContext, and BaseModuleContext 2019-06-06 20:01:31 -07:00
arch.go Make relative path for native_bridge binaries configurable 2019-07-15 20:04:07 +02:00
arch_test.go Optimize filterArchStruct when nothing is filtered 2019-01-25 21:26:53 +00:00
config.go Add USE_RBE support to soong. 2019-07-17 18:46:47 +00:00
config_test.go Fix go vet issues 2018-07-22 21:18:45 -07:00
defaults.go Refactor visibility to support visibility on defaults modules 2019-07-25 11:31:42 +01:00
defaults_test.go Add test for missing defaults modules with AllowMissingDependencies 2019-06-10 15:51:06 -07:00
defs.go Fix package path of android/soong/android pctx 2019-04-04 03:59:34 +00:00
env.go Allow debugging with SOONG_DELVE=<listen addr> 2019-07-03 16:33:31 -07:00
expand.go Fix android.Expand and ninja escaping 2019-07-11 14:52:17 -07:00
expand_test.go Fix android.Expand and ninja escaping 2019-07-11 14:52:17 -07:00
filegroup.go Replace ctx.ExpandSources with android.PathsForModuleSrc 2019-03-20 19:36:13 +00:00
hooks.go Add a String() method to android.Module 2019-07-03 15:37:11 -07:00
makevars.go Allow Singletons to export Make variables 2019-02-19 12:45:14 -08:00
module.go Refactor visibility to support visibility on defaults modules 2019-07-25 11:31:42 +01:00
module_test.go Support tagged module references 2019-06-04 10:22:51 -07:00
mutator.go Add a String() method to android.Module 2019-07-03 15:37:11 -07:00
mutator_test.go Add a String() method to android.Module 2019-07-03 15:37:11 -07:00
namespace.go Give Blueprint modules access to all namespaces 2019-06-14 11:26:09 -07:00
namespace_test.go Give Blueprint modules access to all namespaces 2019-06-14 11:26:09 -07:00
neverallow.go Prevent runtime module paths being used in include_dirs 2019-07-19 19:36:25 +01:00
neverallow_test.go Prevent runtime module paths being used in include_dirs 2019-07-19 19:36:25 +01:00
notices.go Fix a bug in generateNoticeRule. 2019-07-15 11:03:22 -07:00
onceper.go Convert droidstubs to android.RuleBuilder 2019-07-18 14:28:14 -07:00
onceper_test.go Prevent hangs in OncePer when the callback panics 2019-05-14 18:40:13 +00:00
override_module.go OverridableModuleBase shouldn't embed ModuleBase. 2019-06-19 11:22:25 -07:00
package.go Refactor visibility to support visibility on defaults modules 2019-07-25 11:31:42 +01:00
package_ctx.go Allow '$' in some paths 2018-09-13 18:27:50 +00:00
package_test.go Remove ioutil.TempDir from each android/soong/android test 2019-07-03 20:27:11 +00:00
path_properties.go Dedup path properties across property structs 2019-07-16 09:52:23 -07:00
path_properties_test.go Dedup path properties across property structs 2019-07-16 09:52:23 -07:00
paths.go Rename product_services to system_ext 2019-07-09 08:57:05 +00:00
paths_test.go Rename product_services to system_ext 2019-07-09 08:57:05 +00:00
prebuilt.go Don't use prebuilt_apex when TARGET_FLATTEN_APEX is set to true 2019-07-11 18:40:48 +09:00
prebuilt_etc.go Soong: Define a new Soong module named prebuilt_firmware. 2019-06-03 15:40:22 -07:00
prebuilt_etc_test.go Share buildDir for android/soong/android tests 2019-06-10 15:51:06 -07:00
prebuilt_test.go Share buildDir for android/soong/android tests 2019-06-10 15:51:06 -07:00
proto.go Add RuleBuilder helper functions for built and prebuilt tools 2019-07-11 13:05:19 -07:00
register.go Support testing Rules in Modules and Rules and Builds in Singletons 2019-03-05 03:17:26 +00:00
rule_builder.go Convert droiddoc modules to android.RuleBuilder 2019-07-18 14:28:17 -07:00
rule_builder_test.go Add rspfile support to RuleBuilder 2019-07-16 11:12:04 -07:00
sh_binary.go Add sh_test_host. 2019-07-08 14:53:52 -07:00
sh_binary_test.go Add sh_test_host. 2019-07-08 14:53:52 -07:00
singleton.go Support testing Rules in Modules and Rules and Builds in Singletons 2019-03-05 03:17:26 +00:00
testing.go Fix some typos in Soong. 2019-07-23 17:29:57 +01:00
util.go soong: Fix AndroidMk with *Required properties 2019-07-16 02:28:29 +09:00
util_test.go Add CopyOf utility method 2019-02-19 11:19:09 -08:00
variable.go Add USE_RBE support to soong. 2019-07-17 18:46:47 +00:00
variable_test.go Support %s in product variable properties 2017-05-05 18:22:30 -07:00
visibility.go Refactor visibility to support visibility on defaults modules 2019-07-25 11:31:42 +01:00
visibility_test.go Inherit default_visibility from parent package 2019-06-27 13:24:59 +01:00
vts_config.go Soong: update the synopsis of vts_config module. 2019-03-14 12:05:02 -07:00
vts_config_test.go Share buildDir for android/soong/android tests 2019-06-10 15:51:06 -07:00
writedocs.go Split up Soong build doc. 2019-02-20 15:43:06 -08:00