Loading android/arch.go +17 −1 Original line number Diff line number Diff line Loading @@ -822,7 +822,7 @@ func archMutator(mctx BottomUpMutatorContext) { os := base.commonProperties.CompileOS osTargets := mctx.Config().Targets[os] image := base.commonProperties.ImageVariation // Filter NativeBridge targets unless they are explicitly supported if os == Android && !Bool(base.commonProperties.Native_bridge_supported) { var targets []Target Loading Loading @@ -859,6 +859,12 @@ func archMutator(mctx BottomUpMutatorContext) { } } if image == RecoveryVariation { primaryArch := mctx.Config().DevicePrimaryArchType() targets = filterToArch(targets, primaryArch) multiTargets = filterToArch(multiTargets, primaryArch) } if len(targets) == 0 { base.commonProperties.Enabled = boolPtr(false) return Loading Loading @@ -907,6 +913,16 @@ func decodeMultilib(base *ModuleBase, class OsClass) (multilib, extraMultilib st } } func filterToArch(targets []Target, arch ArchType) []Target { for i := 0; i < len(targets); i++ { if targets[i].Arch.ArchType != arch { targets = append(targets[:i], targets[i+1:]...) i-- } } return targets } // createArchType takes a reflect.Type that is either a struct or a pointer to a struct, and returns a list of // reflect.Type that contains the arch-variant properties inside structs for each architecture, os, target, multilib, // etc. Loading android/module.go +8 −6 Original line number Diff line number Diff line Loading @@ -1005,6 +1005,7 @@ func determineModuleKind(m *ModuleBase, ctx blueprint.BaseModuleContext) moduleK func (m *ModuleBase) baseModuleContextFactory(ctx blueprint.BaseModuleContext) baseModuleContext { return baseModuleContext{ BaseModuleContext: ctx, os: m.commonProperties.CompileOS, target: m.commonProperties.CompileTarget, targetPrimary: m.commonProperties.CompilePrimary, multiTargets: m.commonProperties.CompileMultiTargets, Loading Loading @@ -1117,6 +1118,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) type baseModuleContext struct { blueprint.BaseModuleContext os OsType target Target multiTargets []Target targetPrimary bool Loading Loading @@ -1460,27 +1462,27 @@ func (b *baseModuleContext) Arch() Arch { } func (b *baseModuleContext) Os() OsType { return b.target.Os return b.os } func (b *baseModuleContext) Host() bool { return b.target.Os.Class == Host || b.target.Os.Class == HostCross return b.os.Class == Host || b.os.Class == HostCross } func (b *baseModuleContext) Device() bool { return b.target.Os.Class == Device return b.os.Class == Device } func (b *baseModuleContext) Darwin() bool { return b.target.Os == Darwin return b.os == Darwin } func (b *baseModuleContext) Fuchsia() bool { return b.target.Os == Fuchsia return b.os == Fuchsia } func (b *baseModuleContext) Windows() bool { return b.target.Os == Windows return b.os == Windows } func (b *baseModuleContext) Debug() bool { Loading android/mutator.go +1 −1 Original line number Diff line number Diff line Loading @@ -87,9 +87,9 @@ var preArch = []RegisterMutatorFunc{ func registerArchMutator(ctx RegisterMutatorsContext) { ctx.BottomUp("os", osMutator).Parallel() ctx.BottomUp("image", imageMutator).Parallel() ctx.BottomUp("arch", archMutator).Parallel() ctx.TopDown("arch_hooks", archHookMutator).Parallel() ctx.BottomUp("image", imageMutator).Parallel() } var preDeps = []RegisterMutatorFunc{ Loading android/paths_test.go +24 −0 Original line number Diff line number Diff line Loading @@ -257,6 +257,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "host binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: hostTarget.Os, target: hostTarget, }, }, Loading @@ -268,6 +269,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "system binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, }, Loading @@ -278,6 +280,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "vendor binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: socSpecificModule, }, Loading @@ -289,6 +292,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "odm binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: deviceSpecificModule, }, Loading @@ -300,6 +304,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "product binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: productSpecificModule, }, Loading @@ -311,6 +316,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "system_ext binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: systemExtSpecificModule, }, Loading @@ -322,6 +328,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "root binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inRoot: true, Loading @@ -333,6 +340,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "recovery binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inRecovery: true, Loading @@ -344,6 +352,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "recovery root binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inRecovery: true, Loading @@ -357,6 +366,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "system native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inData: true, Loading @@ -368,6 +378,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "vendor native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: socSpecificModule, }, Loading @@ -380,6 +391,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "odm native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: deviceSpecificModule, }, Loading @@ -392,6 +404,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "product native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: productSpecificModule, }, Loading @@ -405,6 +418,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "system_ext native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: systemExtSpecificModule, }, Loading @@ -418,6 +432,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized system binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inSanitizerDir: true, Loading @@ -429,6 +444,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized vendor binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: socSpecificModule, }, Loading @@ -441,6 +457,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized odm binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: deviceSpecificModule, }, Loading @@ -453,6 +470,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized product binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: productSpecificModule, }, Loading @@ -466,6 +484,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized system_ext binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: systemExtSpecificModule, }, Loading @@ -479,6 +498,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized system native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inData: true, Loading @@ -491,6 +511,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized vendor native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: socSpecificModule, }, Loading @@ -504,6 +525,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized odm native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: deviceSpecificModule, }, Loading @@ -517,6 +539,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized product native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: productSpecificModule, }, Loading @@ -530,6 +553,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized system_ext native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: systemExtSpecificModule, }, Loading apex/apex_test.go +2 −2 Original line number Diff line number Diff line Loading @@ -1160,8 +1160,8 @@ func TestUseVendor(t *testing.T) { inputsString := strings.Join(inputsList, " ") // ensure that the apex includes vendor variants of the direct and indirect deps ensureContains(t, inputsString, "android_arm64_armv8-a_vendor.VER_shared_myapex/mylib.so") ensureContains(t, inputsString, "android_arm64_armv8-a_vendor.VER_shared_myapex/mylib2.so") ensureContains(t, inputsString, "android_vendor.VER_arm64_armv8-a_shared_myapex/mylib.so") ensureContains(t, inputsString, "android_vendor.VER_arm64_armv8-a_shared_myapex/mylib2.so") // ensure that the apex does not include core variants ensureNotContains(t, inputsString, "android_arm64_armv8-a_shared_myapex/mylib.so") Loading Loading
android/arch.go +17 −1 Original line number Diff line number Diff line Loading @@ -822,7 +822,7 @@ func archMutator(mctx BottomUpMutatorContext) { os := base.commonProperties.CompileOS osTargets := mctx.Config().Targets[os] image := base.commonProperties.ImageVariation // Filter NativeBridge targets unless they are explicitly supported if os == Android && !Bool(base.commonProperties.Native_bridge_supported) { var targets []Target Loading Loading @@ -859,6 +859,12 @@ func archMutator(mctx BottomUpMutatorContext) { } } if image == RecoveryVariation { primaryArch := mctx.Config().DevicePrimaryArchType() targets = filterToArch(targets, primaryArch) multiTargets = filterToArch(multiTargets, primaryArch) } if len(targets) == 0 { base.commonProperties.Enabled = boolPtr(false) return Loading Loading @@ -907,6 +913,16 @@ func decodeMultilib(base *ModuleBase, class OsClass) (multilib, extraMultilib st } } func filterToArch(targets []Target, arch ArchType) []Target { for i := 0; i < len(targets); i++ { if targets[i].Arch.ArchType != arch { targets = append(targets[:i], targets[i+1:]...) i-- } } return targets } // createArchType takes a reflect.Type that is either a struct or a pointer to a struct, and returns a list of // reflect.Type that contains the arch-variant properties inside structs for each architecture, os, target, multilib, // etc. Loading
android/module.go +8 −6 Original line number Diff line number Diff line Loading @@ -1005,6 +1005,7 @@ func determineModuleKind(m *ModuleBase, ctx blueprint.BaseModuleContext) moduleK func (m *ModuleBase) baseModuleContextFactory(ctx blueprint.BaseModuleContext) baseModuleContext { return baseModuleContext{ BaseModuleContext: ctx, os: m.commonProperties.CompileOS, target: m.commonProperties.CompileTarget, targetPrimary: m.commonProperties.CompilePrimary, multiTargets: m.commonProperties.CompileMultiTargets, Loading Loading @@ -1117,6 +1118,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) type baseModuleContext struct { blueprint.BaseModuleContext os OsType target Target multiTargets []Target targetPrimary bool Loading Loading @@ -1460,27 +1462,27 @@ func (b *baseModuleContext) Arch() Arch { } func (b *baseModuleContext) Os() OsType { return b.target.Os return b.os } func (b *baseModuleContext) Host() bool { return b.target.Os.Class == Host || b.target.Os.Class == HostCross return b.os.Class == Host || b.os.Class == HostCross } func (b *baseModuleContext) Device() bool { return b.target.Os.Class == Device return b.os.Class == Device } func (b *baseModuleContext) Darwin() bool { return b.target.Os == Darwin return b.os == Darwin } func (b *baseModuleContext) Fuchsia() bool { return b.target.Os == Fuchsia return b.os == Fuchsia } func (b *baseModuleContext) Windows() bool { return b.target.Os == Windows return b.os == Windows } func (b *baseModuleContext) Debug() bool { Loading
android/mutator.go +1 −1 Original line number Diff line number Diff line Loading @@ -87,9 +87,9 @@ var preArch = []RegisterMutatorFunc{ func registerArchMutator(ctx RegisterMutatorsContext) { ctx.BottomUp("os", osMutator).Parallel() ctx.BottomUp("image", imageMutator).Parallel() ctx.BottomUp("arch", archMutator).Parallel() ctx.TopDown("arch_hooks", archHookMutator).Parallel() ctx.BottomUp("image", imageMutator).Parallel() } var preDeps = []RegisterMutatorFunc{ Loading
android/paths_test.go +24 −0 Original line number Diff line number Diff line Loading @@ -257,6 +257,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "host binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: hostTarget.Os, target: hostTarget, }, }, Loading @@ -268,6 +269,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "system binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, }, Loading @@ -278,6 +280,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "vendor binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: socSpecificModule, }, Loading @@ -289,6 +292,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "odm binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: deviceSpecificModule, }, Loading @@ -300,6 +304,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "product binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: productSpecificModule, }, Loading @@ -311,6 +316,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "system_ext binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: systemExtSpecificModule, }, Loading @@ -322,6 +328,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "root binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inRoot: true, Loading @@ -333,6 +340,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "recovery binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inRecovery: true, Loading @@ -344,6 +352,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "recovery root binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inRecovery: true, Loading @@ -357,6 +366,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "system native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inData: true, Loading @@ -368,6 +378,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "vendor native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: socSpecificModule, }, Loading @@ -380,6 +391,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "odm native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: deviceSpecificModule, }, Loading @@ -392,6 +404,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "product native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: productSpecificModule, }, Loading @@ -405,6 +418,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "system_ext native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: systemExtSpecificModule, }, Loading @@ -418,6 +432,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized system binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inSanitizerDir: true, Loading @@ -429,6 +444,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized vendor binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: socSpecificModule, }, Loading @@ -441,6 +457,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized odm binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: deviceSpecificModule, }, Loading @@ -453,6 +470,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized product binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: productSpecificModule, }, Loading @@ -466,6 +484,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized system_ext binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: systemExtSpecificModule, }, Loading @@ -479,6 +498,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized system native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, }, inData: true, Loading @@ -491,6 +511,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized vendor native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: socSpecificModule, }, Loading @@ -504,6 +525,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized odm native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: deviceSpecificModule, }, Loading @@ -517,6 +539,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized product native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: productSpecificModule, }, Loading @@ -530,6 +553,7 @@ func TestPathForModuleInstall(t *testing.T) { name: "sanitized system_ext native test binary", ctx: &moduleInstallPathContextImpl{ baseModuleContext: baseModuleContext{ os: deviceTarget.Os, target: deviceTarget, kind: systemExtSpecificModule, }, Loading
apex/apex_test.go +2 −2 Original line number Diff line number Diff line Loading @@ -1160,8 +1160,8 @@ func TestUseVendor(t *testing.T) { inputsString := strings.Join(inputsList, " ") // ensure that the apex includes vendor variants of the direct and indirect deps ensureContains(t, inputsString, "android_arm64_armv8-a_vendor.VER_shared_myapex/mylib.so") ensureContains(t, inputsString, "android_arm64_armv8-a_vendor.VER_shared_myapex/mylib2.so") ensureContains(t, inputsString, "android_vendor.VER_arm64_armv8-a_shared_myapex/mylib.so") ensureContains(t, inputsString, "android_vendor.VER_arm64_armv8-a_shared_myapex/mylib2.so") // ensure that the apex does not include core variants ensureNotContains(t, inputsString, "android_arm64_armv8-a_shared_myapex/mylib.so") Loading