Merge "Allows prebuilts in override_apex."
This commit is contained in:
commit
e267bc8f74
3 changed files with 39 additions and 23 deletions
|
@ -295,7 +295,7 @@ func performOverrideMutator(ctx BottomUpMutatorContext) {
|
|||
}
|
||||
|
||||
func overridableModuleDepsMutator(ctx BottomUpMutatorContext) {
|
||||
if b, ok := ctx.Module().(OverridableModule); ok {
|
||||
if b, ok := ctx.Module().(OverridableModule); ok && b.Enabled() {
|
||||
b.OverridablePropertiesDepsMutator(ctx)
|
||||
}
|
||||
}
|
||||
|
|
45
apex/apex.go
45
apex/apex.go
|
@ -111,9 +111,6 @@ type apexBundleProperties struct {
|
|||
// List of java libraries that are embedded inside this APEX bundle.
|
||||
Java_libs []string
|
||||
|
||||
// List of prebuilt files that are embedded inside this APEX bundle.
|
||||
Prebuilts []string
|
||||
|
||||
// List of platform_compat_config files that are embedded inside this APEX bundle.
|
||||
Compat_configs []string
|
||||
|
||||
|
@ -291,6 +288,9 @@ type overridableProperties struct {
|
|||
// List of APKs that are embedded inside this APEX.
|
||||
Apps []string
|
||||
|
||||
// List of prebuilt files that are embedded inside this APEX bundle.
|
||||
Prebuilts []string
|
||||
|
||||
// List of runtime resource overlays (RROs) that are embedded inside this APEX.
|
||||
Rros []string
|
||||
|
||||
|
@ -684,7 +684,6 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||
// each target os/architectures, appropriate dependencies are selected by their
|
||||
// target.<os>.multilib.<type> groups and are added as (direct) dependencies.
|
||||
targets := ctx.MultiTargets()
|
||||
config := ctx.DeviceConfig()
|
||||
imageVariation := a.getImageVariation(ctx)
|
||||
|
||||
a.combineProperties(ctx)
|
||||
|
@ -758,23 +757,6 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||
}
|
||||
}
|
||||
|
||||
if prebuilts := a.properties.Prebuilts; len(prebuilts) > 0 {
|
||||
// For prebuilt_etc, use the first variant (64 on 64/32bit device, 32 on 32bit device)
|
||||
// regardless of the TARGET_PREFER_* setting. See b/144532908
|
||||
archForPrebuiltEtc := config.Arches()[0]
|
||||
for _, arch := range config.Arches() {
|
||||
// Prefer 64-bit arch if there is any
|
||||
if arch.ArchType.Multilib == "lib64" {
|
||||
archForPrebuiltEtc = arch
|
||||
break
|
||||
}
|
||||
}
|
||||
ctx.AddFarVariationDependencies([]blueprint.Variation{
|
||||
{Mutator: "os", Variation: ctx.Os().String()},
|
||||
{Mutator: "arch", Variation: archForPrebuiltEtc.String()},
|
||||
}, prebuiltTag, prebuilts...)
|
||||
}
|
||||
|
||||
// Common-arch dependencies come next
|
||||
commonVariation := ctx.Config().AndroidCommonTarget.Variations()
|
||||
ctx.AddFarVariationDependencies(commonVariation, bcpfTag, a.properties.Bootclasspath_fragments...)
|
||||
|
@ -814,6 +796,25 @@ func (a *apexBundle) OverridablePropertiesDepsMutator(ctx android.BottomUpMutato
|
|||
ctx.AddFarVariationDependencies(commonVariation, androidAppTag, a.overridableProperties.Apps...)
|
||||
ctx.AddFarVariationDependencies(commonVariation, bpfTag, a.overridableProperties.Bpfs...)
|
||||
ctx.AddFarVariationDependencies(commonVariation, rroTag, a.overridableProperties.Rros...)
|
||||
if prebuilts := a.overridableProperties.Prebuilts; len(prebuilts) > 0 {
|
||||
// For prebuilt_etc, use the first variant (64 on 64/32bit device, 32 on 32bit device)
|
||||
// regardless of the TARGET_PREFER_* setting. See b/144532908
|
||||
arches := ctx.DeviceConfig().Arches()
|
||||
if len(arches) != 0 {
|
||||
archForPrebuiltEtc := arches[0]
|
||||
for _, arch := range arches {
|
||||
// Prefer 64-bit arch if there is any
|
||||
if arch.ArchType.Multilib == "lib64" {
|
||||
archForPrebuiltEtc = arch
|
||||
break
|
||||
}
|
||||
}
|
||||
ctx.AddFarVariationDependencies([]blueprint.Variation{
|
||||
{Mutator: "os", Variation: ctx.Os().String()},
|
||||
{Mutator: "arch", Variation: archForPrebuiltEtc.String()},
|
||||
}, prebuiltTag, prebuilts...)
|
||||
}
|
||||
}
|
||||
|
||||
// Dependencies for signing
|
||||
if String(a.overridableProperties.Key) == "" {
|
||||
|
@ -3282,7 +3283,7 @@ func apexBundleBp2BuildInternal(ctx android.TopDownMutatorContext, module *apexB
|
|||
nativeSharedLibsLabelList := android.BazelLabelForModuleDeps(ctx, nativeSharedLibs)
|
||||
nativeSharedLibsLabelListAttribute := bazel.MakeLabelListAttribute(nativeSharedLibsLabelList)
|
||||
|
||||
prebuilts := module.properties.Prebuilts
|
||||
prebuilts := module.overridableProperties.Prebuilts
|
||||
prebuiltsLabelList := android.BazelLabelForModuleDeps(ctx, prebuilts)
|
||||
prebuiltsLabelListAttribute := bazel.MakeLabelListAttribute(prebuiltsLabelList)
|
||||
|
||||
|
|
|
@ -6080,6 +6080,7 @@ func TestOverrideApex(t *testing.T) {
|
|||
key: "myapex.key",
|
||||
apps: ["app"],
|
||||
bpfs: ["bpf"],
|
||||
prebuilts: ["myetc"],
|
||||
overrides: ["oldapex"],
|
||||
updatable: false,
|
||||
}
|
||||
|
@ -6089,6 +6090,7 @@ func TestOverrideApex(t *testing.T) {
|
|||
base: "myapex",
|
||||
apps: ["override_app"],
|
||||
bpfs: ["override_bpf"],
|
||||
prebuilts: ["override_myetc"],
|
||||
overrides: ["unknownapex"],
|
||||
logging_parent: "com.foo.bar",
|
||||
package_name: "test.overridden.package",
|
||||
|
@ -6137,6 +6139,16 @@ func TestOverrideApex(t *testing.T) {
|
|||
name: "override_bpf",
|
||||
srcs: ["override_bpf.c"],
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "myetc",
|
||||
src: "myprebuilt",
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "override_myetc",
|
||||
src: "override_myprebuilt",
|
||||
}
|
||||
`, withManifestPackageNameOverrides([]string{"myapex:com.android.myapex"}))
|
||||
|
||||
originalVariant := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(android.OverridableModule)
|
||||
|
@ -6158,6 +6170,9 @@ func TestOverrideApex(t *testing.T) {
|
|||
ensureNotContains(t, copyCmds, "image.apex/etc/bpf/bpf.o")
|
||||
ensureContains(t, copyCmds, "image.apex/etc/bpf/override_bpf.o")
|
||||
|
||||
ensureNotContains(t, copyCmds, "image.apex/etc/myetc")
|
||||
ensureContains(t, copyCmds, "image.apex/etc/override_myetc")
|
||||
|
||||
apexBundle := module.Module().(*apexBundle)
|
||||
name := apexBundle.Name()
|
||||
if name != "override_myapex" {
|
||||
|
|
Loading…
Reference in a new issue