Merge "Make apex.overrides overridable by override_apex."
This commit is contained in:
commit
dcee89cad6
|
@ -155,11 +155,6 @@ func (b *OverridableModuleBase) setOverridesProperty(overridesProperty *[]string
|
|||
|
||||
// Overrides a base module with the given OverrideModule.
|
||||
func (b *OverridableModuleBase) override(ctx BaseModuleContext, o OverrideModule) {
|
||||
// Adds the base module to the overrides property, if exists, of the overriding module. See the
|
||||
// comment on OverridableModuleBase.overridesProperty for details.
|
||||
if b.overridesProperty != nil {
|
||||
*b.overridesProperty = append(*b.overridesProperty, ctx.ModuleName())
|
||||
}
|
||||
for _, p := range b.overridableProperties {
|
||||
for _, op := range o.getOverridingProperties() {
|
||||
if proptools.TypeEqual(p, op) {
|
||||
|
@ -174,6 +169,11 @@ func (b *OverridableModuleBase) override(ctx BaseModuleContext, o OverrideModule
|
|||
}
|
||||
}
|
||||
}
|
||||
// Adds the base module to the overrides property, if exists, of the overriding module. See the
|
||||
// comment on OverridableModuleBase.overridesProperty for details.
|
||||
if b.overridesProperty != nil {
|
||||
*b.overridesProperty = append(*b.overridesProperty, ctx.ModuleName())
|
||||
}
|
||||
b.properties.OverriddenBy = o.Name()
|
||||
}
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
|
|||
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", a.installDir.ToMakePath().String())
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", name+apexType.suffix())
|
||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable())
|
||||
fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES :=", strings.Join(a.properties.Overrides, " "))
|
||||
fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES :=", strings.Join(a.overridableProperties.Overrides, " "))
|
||||
if len(moduleNames) > 0 {
|
||||
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(moduleNames, " "))
|
||||
}
|
||||
|
|
16
apex/apex.go
16
apex/apex.go
|
@ -333,13 +333,6 @@ type apexBundleProperties struct {
|
|||
// also built with the SDKs specified here.
|
||||
Uses_sdks []string
|
||||
|
||||
// Names of modules to be overridden. Listed modules can only be other binaries
|
||||
// (in Make or Soong).
|
||||
// This does not completely prevent installation of the overridden binaries, but if both
|
||||
// binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed
|
||||
// from PRODUCT_PACKAGES.
|
||||
Overrides []string
|
||||
|
||||
// Whenever apex_payload.img of the APEX should include dm-verity hashtree.
|
||||
// Should be only used in tests#.
|
||||
Test_only_no_hashtree *bool
|
||||
|
@ -376,6 +369,13 @@ type apexTargetBundleProperties struct {
|
|||
type overridableProperties struct {
|
||||
// List of APKs to package inside APEX
|
||||
Apps []string
|
||||
|
||||
// Names of modules to be overridden. Listed modules can only be other binaries
|
||||
// (in Make or Soong).
|
||||
// This does not completely prevent installation of the overridden binaries, but if both
|
||||
// binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed
|
||||
// from PRODUCT_PACKAGES.
|
||||
Overrides []string
|
||||
}
|
||||
|
||||
type apexPackaging int
|
||||
|
@ -1267,7 +1267,7 @@ func newApexBundle() *apexBundle {
|
|||
android.InitAndroidMultiTargetsArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
|
||||
android.InitDefaultableModule(module)
|
||||
android.InitSdkAwareModule(module)
|
||||
android.InitOverridableModule(module, &module.properties.Overrides)
|
||||
android.InitOverridableModule(module, &module.overridableProperties.Overrides)
|
||||
return module
|
||||
}
|
||||
|
||||
|
|
|
@ -3146,12 +3146,14 @@ func TestOverrideApex(t *testing.T) {
|
|||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
apps: ["app"],
|
||||
overrides: ["oldapex"],
|
||||
}
|
||||
|
||||
override_apex {
|
||||
name: "override_myapex",
|
||||
base: "myapex",
|
||||
apps: ["override_app"],
|
||||
overrides: ["unknownapex"],
|
||||
}
|
||||
|
||||
apex_key {
|
||||
|
@ -3204,6 +3206,7 @@ func TestOverrideApex(t *testing.T) {
|
|||
ensureContains(t, androidMk, "LOCAL_MODULE := override_app.override_myapex")
|
||||
ensureContains(t, androidMk, "LOCAL_MODULE := apex_manifest.pb.override_myapex")
|
||||
ensureContains(t, androidMk, "LOCAL_MODULE_STEM := override_myapex.apex")
|
||||
ensureContains(t, androidMk, "LOCAL_OVERRIDES_MODULES := unknownapex myapex")
|
||||
ensureNotContains(t, androidMk, "LOCAL_MODULE := app.myapex")
|
||||
ensureNotContains(t, androidMk, "LOCAL_MODULE := override_app.myapex")
|
||||
ensureNotContains(t, androidMk, "LOCAL_MODULE := apex_manifest.pb.myapex")
|
||||
|
|
Loading…
Reference in New Issue