Loading android/arch.go +12 −0 Original line number Diff line number Diff line Loading @@ -587,6 +587,7 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) { } osTargets := mctx.Config().Targets[os] image := base.commonProperties.ImageVariation // Filter NativeBridge targets unless they are explicitly supported. // Skip creating native bridge variants for non-core modules. Loading @@ -602,6 +603,17 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) { osTargets = targets } // Filter HostCross targets if disabled. if base.HostSupported() && !base.HostCrossSupported() { var targets []Target for _, t := range osTargets { if !t.HostCross { targets = append(targets, t) } } osTargets = targets } // only the primary arch in the ramdisk / vendor_ramdisk / recovery partition if os == Android && (module.InstallInRecovery() || module.InstallInRamdisk() || module.InstallInVendorRamdisk() || module.InstallInDebugRamdisk()) { osTargets = []Target{osTargets[0]} Loading android/arch_test.go +21 −7 Original line number Diff line number Diff line Loading @@ -331,6 +331,12 @@ func TestArchMutator(t *testing.T) { host_supported: true, } module { name: "nohostcross", host_supported: true, host_cross_supported: false, } module { name: "baz", device_supported: false, Loading Loading @@ -359,6 +365,7 @@ func TestArchMutator(t *testing.T) { preparer FixturePreparer fooVariants []string barVariants []string noHostCrossVariants []string bazVariants []string quxVariants []string firstVariants []string Loading @@ -373,6 +380,7 @@ func TestArchMutator(t *testing.T) { preparer: nil, fooVariants: []string{"android_arm64_armv8-a", "android_arm_armv7-a-neon"}, barVariants: append(buildOSVariants, "android_arm64_armv8-a", "android_arm_armv7-a-neon"), noHostCrossVariants: append(buildOSVariants, "android_arm64_armv8-a", "android_arm_armv7-a-neon"), bazVariants: nil, quxVariants: append(buildOS32Variants, "android_arm_armv7-a-neon"), firstVariants: append(buildOS64Variants, "android_arm64_armv8-a"), Loading @@ -390,6 +398,7 @@ func TestArchMutator(t *testing.T) { }), fooVariants: nil, barVariants: buildOSVariants, noHostCrossVariants: buildOSVariants, bazVariants: nil, quxVariants: buildOS32Variants, firstVariants: buildOS64Variants, Loading @@ -406,6 +415,7 @@ func TestArchMutator(t *testing.T) { }), fooVariants: []string{"android_arm64_armv8-a", "android_arm_armv7-a-neon"}, barVariants: []string{"linux_musl_x86_64", "linux_musl_arm64", "linux_musl_x86", "android_arm64_armv8-a", "android_arm_armv7-a-neon"}, noHostCrossVariants: []string{"linux_musl_x86_64", "linux_musl_x86", "android_arm64_armv8-a", "android_arm_armv7-a-neon"}, bazVariants: nil, quxVariants: []string{"linux_musl_x86", "android_arm_armv7-a-neon"}, firstVariants: []string{"linux_musl_x86_64", "linux_musl_arm64", "android_arm64_armv8-a"}, Loading Loading @@ -461,6 +471,10 @@ func TestArchMutator(t *testing.T) { t.Errorf("want bar variants:\n%q\ngot:\n%q\n", w, g) } if g, w := enabledVariants(ctx, "nohostcross"), tt.noHostCrossVariants; !reflect.DeepEqual(w, g) { t.Errorf("want nohostcross variants:\n%q\ngot:\n%q\n", w, g) } if g, w := enabledVariants(ctx, "baz"), tt.bazVariants; !reflect.DeepEqual(w, g) { t.Errorf("want baz variants:\n%q\ngot:\n%q\n", w, g) } Loading android/module.go +15 −1 Original line number Diff line number Diff line Loading @@ -603,6 +603,11 @@ type hostAndDeviceProperties struct { Device_supported *bool } type hostCrossProperties struct { // If set to true, build a variant of the module for the host cross. Defaults to true. Host_cross_supported *bool } type Multilib string const ( Loading Loading @@ -718,6 +723,10 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib m.AddProperties(&base.hostAndDeviceProperties) } if hod&hostCrossSupported != 0 { m.AddProperties(&base.hostCrossProperties) } initArchModule(m) } Loading Loading @@ -803,6 +812,7 @@ type ModuleBase struct { distProperties distProperties variableProperties interface{} hostAndDeviceProperties hostAndDeviceProperties hostCrossProperties hostCrossProperties // Arch specific versions of structs in GetProperties() prior to // initialization in InitAndroidArchModule, lets call it `generalProperties`. Loading Loading @@ -1299,7 +1309,11 @@ func (m *ModuleBase) HostCrossSupported() bool { // hostEnabled is true if the host_supported property is true or the HostOrDeviceSupported // value has the hostDefault bit set. hostEnabled := proptools.BoolDefault(m.hostAndDeviceProperties.Host_supported, hod&hostDefault != 0) return hod&hostCrossSupported != 0 && hostEnabled // Default true for the Host_cross_supported property hostCrossEnabled := proptools.BoolDefault(m.hostCrossProperties.Host_cross_supported, true) return hod&hostCrossSupported != 0 && hostEnabled && hostCrossEnabled } func (m *ModuleBase) Platform() bool { Loading Loading
android/arch.go +12 −0 Original line number Diff line number Diff line Loading @@ -587,6 +587,7 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) { } osTargets := mctx.Config().Targets[os] image := base.commonProperties.ImageVariation // Filter NativeBridge targets unless they are explicitly supported. // Skip creating native bridge variants for non-core modules. Loading @@ -602,6 +603,17 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) { osTargets = targets } // Filter HostCross targets if disabled. if base.HostSupported() && !base.HostCrossSupported() { var targets []Target for _, t := range osTargets { if !t.HostCross { targets = append(targets, t) } } osTargets = targets } // only the primary arch in the ramdisk / vendor_ramdisk / recovery partition if os == Android && (module.InstallInRecovery() || module.InstallInRamdisk() || module.InstallInVendorRamdisk() || module.InstallInDebugRamdisk()) { osTargets = []Target{osTargets[0]} Loading
android/arch_test.go +21 −7 Original line number Diff line number Diff line Loading @@ -331,6 +331,12 @@ func TestArchMutator(t *testing.T) { host_supported: true, } module { name: "nohostcross", host_supported: true, host_cross_supported: false, } module { name: "baz", device_supported: false, Loading Loading @@ -359,6 +365,7 @@ func TestArchMutator(t *testing.T) { preparer FixturePreparer fooVariants []string barVariants []string noHostCrossVariants []string bazVariants []string quxVariants []string firstVariants []string Loading @@ -373,6 +380,7 @@ func TestArchMutator(t *testing.T) { preparer: nil, fooVariants: []string{"android_arm64_armv8-a", "android_arm_armv7-a-neon"}, barVariants: append(buildOSVariants, "android_arm64_armv8-a", "android_arm_armv7-a-neon"), noHostCrossVariants: append(buildOSVariants, "android_arm64_armv8-a", "android_arm_armv7-a-neon"), bazVariants: nil, quxVariants: append(buildOS32Variants, "android_arm_armv7-a-neon"), firstVariants: append(buildOS64Variants, "android_arm64_armv8-a"), Loading @@ -390,6 +398,7 @@ func TestArchMutator(t *testing.T) { }), fooVariants: nil, barVariants: buildOSVariants, noHostCrossVariants: buildOSVariants, bazVariants: nil, quxVariants: buildOS32Variants, firstVariants: buildOS64Variants, Loading @@ -406,6 +415,7 @@ func TestArchMutator(t *testing.T) { }), fooVariants: []string{"android_arm64_armv8-a", "android_arm_armv7-a-neon"}, barVariants: []string{"linux_musl_x86_64", "linux_musl_arm64", "linux_musl_x86", "android_arm64_armv8-a", "android_arm_armv7-a-neon"}, noHostCrossVariants: []string{"linux_musl_x86_64", "linux_musl_x86", "android_arm64_armv8-a", "android_arm_armv7-a-neon"}, bazVariants: nil, quxVariants: []string{"linux_musl_x86", "android_arm_armv7-a-neon"}, firstVariants: []string{"linux_musl_x86_64", "linux_musl_arm64", "android_arm64_armv8-a"}, Loading Loading @@ -461,6 +471,10 @@ func TestArchMutator(t *testing.T) { t.Errorf("want bar variants:\n%q\ngot:\n%q\n", w, g) } if g, w := enabledVariants(ctx, "nohostcross"), tt.noHostCrossVariants; !reflect.DeepEqual(w, g) { t.Errorf("want nohostcross variants:\n%q\ngot:\n%q\n", w, g) } if g, w := enabledVariants(ctx, "baz"), tt.bazVariants; !reflect.DeepEqual(w, g) { t.Errorf("want baz variants:\n%q\ngot:\n%q\n", w, g) } Loading
android/module.go +15 −1 Original line number Diff line number Diff line Loading @@ -603,6 +603,11 @@ type hostAndDeviceProperties struct { Device_supported *bool } type hostCrossProperties struct { // If set to true, build a variant of the module for the host cross. Defaults to true. Host_cross_supported *bool } type Multilib string const ( Loading Loading @@ -718,6 +723,10 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib m.AddProperties(&base.hostAndDeviceProperties) } if hod&hostCrossSupported != 0 { m.AddProperties(&base.hostCrossProperties) } initArchModule(m) } Loading Loading @@ -803,6 +812,7 @@ type ModuleBase struct { distProperties distProperties variableProperties interface{} hostAndDeviceProperties hostAndDeviceProperties hostCrossProperties hostCrossProperties // Arch specific versions of structs in GetProperties() prior to // initialization in InitAndroidArchModule, lets call it `generalProperties`. Loading Loading @@ -1299,7 +1309,11 @@ func (m *ModuleBase) HostCrossSupported() bool { // hostEnabled is true if the host_supported property is true or the HostOrDeviceSupported // value has the hostDefault bit set. hostEnabled := proptools.BoolDefault(m.hostAndDeviceProperties.Host_supported, hod&hostDefault != 0) return hod&hostCrossSupported != 0 && hostEnabled // Default true for the Host_cross_supported property hostCrossEnabled := proptools.BoolDefault(m.hostCrossProperties.Host_cross_supported, true) return hod&hostCrossSupported != 0 && hostEnabled && hostCrossEnabled } func (m *ModuleBase) Platform() bool { Loading