Merge "Fix indexing bug when config.Arches() returns an empty array."

This commit is contained in:
Martin Stjernholm
2021-05-22 18:53:42 +00:00
committed by Gerrit Code Review
2 changed files with 36 additions and 12 deletions

View File

@@ -741,20 +741,22 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
} }
} }
// For prebuilt_etc, use the first variant (64 on 64/32bit device, 32 on 32bit device) if prebuilts := a.properties.Prebuilts; len(prebuilts) > 0 {
// regardless of the TARGET_PREFER_* setting. See b/144532908 // For prebuilt_etc, use the first variant (64 on 64/32bit device, 32 on 32bit device)
archForPrebuiltEtc := config.Arches()[0] // regardless of the TARGET_PREFER_* setting. See b/144532908
for _, arch := range config.Arches() { archForPrebuiltEtc := config.Arches()[0]
// Prefer 64-bit arch if there is any for _, arch := range config.Arches() {
if arch.ArchType.Multilib == "lib64" { // Prefer 64-bit arch if there is any
archForPrebuiltEtc = arch if arch.ArchType.Multilib == "lib64" {
break archForPrebuiltEtc = arch
break
}
} }
ctx.AddFarVariationDependencies([]blueprint.Variation{
{Mutator: "os", Variation: ctx.Os().String()},
{Mutator: "arch", Variation: archForPrebuiltEtc.String()},
}, prebuiltTag, prebuilts...)
} }
ctx.AddFarVariationDependencies([]blueprint.Variation{
{Mutator: "os", Variation: ctx.Os().String()},
{Mutator: "arch", Variation: archForPrebuiltEtc.String()},
}, prebuiltTag, a.properties.Prebuilts...)
// Common-arch dependencies come next // Common-arch dependencies come next
commonVariation := ctx.Config().AndroidCommonTarget.Variations() commonVariation := ctx.Config().AndroidCommonTarget.Variations()

View File

@@ -7589,6 +7589,28 @@ func TestPrebuiltStubLibDep(t *testing.T) {
} }
} }
func TestHostApexInHostOnlyBuild(t *testing.T) {
testApex(t, `
apex {
name: "myapex",
host_supported: true,
key: "myapex.key",
updatable: false,
payload_type: "zip",
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
`,
android.FixtureModifyConfig(func(config android.Config) {
// We may not have device targets in all builds, e.g. in
// prebuilts/build-tools/build-prebuilts.sh
config.Targets[android.Android] = []android.Target{}
}))
}
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
os.Exit(m.Run()) os.Exit(m.Run())
} }