From 2239ae6541d7ff95a0a3a1f329ada4c0b13e1ab1 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Mon, 27 Jan 2025 15:32:11 -0800 Subject: Move required out of common properties Properties in commonProperties are inherited when creating a new module: https://cs.android.com/android/platform/superproject/main/+/main:build/soong/android/hooks.go;l=144;drc=b0aabb1f6559d6ae439adeb0691a0124527536cb This is problematic with required and the autogenerated rro modules. The autogenerated rro modules are created from an app module, so it will copy the app's required modules. The autogenerated rro modules are installed to different partitions from the origional app, so if you have an app that depends on another app, the second app will not be installed into two different partitions because we filter by partition, but the odex/vdex files will be installed from two different sources to the system_other image and conflict. Bug: 392702675 Test: m nothing on the failing product Change-Id: Icbe228a92187bea850908b79571b209475ede77a --- android/module.go | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'android/module.go') diff --git a/android/module.go b/android/module.go index 75b550ac8..3cc16cee1 100644 --- a/android/module.go +++ b/android/module.go @@ -257,6 +257,8 @@ type nameProperties struct { Name *string } +// Properties common to all modules inheriting from ModuleBase. These properties are automatically +// inherited by sub-modules created with ctx.CreateModule() type commonProperties struct { // emit build rules for this module // @@ -409,15 +411,6 @@ type commonProperties struct { // VINTF manifest fragments to be installed if this module is installed Vintf_fragments proptools.Configurable[[]string] `android:"path"` - // names of other modules to install if this module is installed - Required proptools.Configurable[[]string] `android:"arch_variant"` - - // names of other modules to install on host if this module is installed - Host_required []string `android:"arch_variant"` - - // names of other modules to install on target if this module is installed - Target_required []string `android:"arch_variant"` - // The OsType of artifacts that this module variant is responsible for creating. // // Set by osMutator @@ -518,6 +511,19 @@ type commonProperties struct { Overrides []string } +// Properties common to all modules inheriting from ModuleBase. Unlike commonProperties, these +// properties are NOT automatically inherited by sub-modules created with ctx.CreateModule() +type baseProperties struct { + // names of other modules to install if this module is installed + Required proptools.Configurable[[]string] `android:"arch_variant"` + + // names of other modules to install on host if this module is installed + Host_required []string `android:"arch_variant"` + + // names of other modules to install on target if this module is installed + Target_required []string `android:"arch_variant"` +} + type distProperties struct { // configuration to distribute output files from this module to the distribution // directory (default: $OUT/dist, configurable with $DIST_DIR) @@ -716,6 +722,7 @@ func InitAndroidModule(m Module) { m.AddProperties( &base.nameProperties, &base.commonProperties, + &base.baseProperties, &base.distProperties) initProductVariableModule(m) @@ -834,6 +841,7 @@ type ModuleBase struct { nameProperties nameProperties commonProperties commonProperties + baseProperties baseProperties distProperties distProperties variableProperties interface{} hostAndDeviceProperties hostAndDeviceProperties @@ -1619,15 +1627,15 @@ func (m *ModuleBase) InRecovery() bool { } func (m *ModuleBase) RequiredModuleNames(ctx ConfigurableEvaluatorContext) []string { - return m.base().commonProperties.Required.GetOrDefault(m.ConfigurableEvaluator(ctx), nil) + return m.base().baseProperties.Required.GetOrDefault(m.ConfigurableEvaluator(ctx), nil) } func (m *ModuleBase) HostRequiredModuleNames() []string { - return m.base().commonProperties.Host_required + return m.base().baseProperties.Host_required } func (m *ModuleBase) TargetRequiredModuleNames() []string { - return m.base().commonProperties.Target_required + return m.base().baseProperties.Target_required } func (m *ModuleBase) VintfFragmentModuleNames(ctx ConfigurableEvaluatorContext) []string { @@ -2135,9 +2143,9 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) var targetRequired, hostRequired []string if ctx.Host() { - targetRequired = m.commonProperties.Target_required + targetRequired = m.baseProperties.Target_required } else { - hostRequired = m.commonProperties.Host_required + hostRequired = m.baseProperties.Host_required } var data []string -- cgit v1.2.3-59-g8ed1b