Loading android/prebuilt.go +3 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,9 @@ func InitSingleSourcePrebuiltModule(module PrebuiltInterface, srcProps interface srcPropertyName := proptools.PropertyNameForField(srcField) srcsSupplier := func(ctx BaseModuleContext) []string { if !ctx.Module().Enabled() { return nil } value := srcPropsValue.FieldByIndex(srcFieldIndex) if value.Kind() == reflect.Ptr { value = value.Elem() Loading java/app.go +7 −0 Original line number Diff line number Diff line Loading @@ -1400,6 +1400,13 @@ func (a *AndroidAppImport) processVariants(ctx android.LoadHookContext) { archProps := reflect.ValueOf(a.archVariants).Elem().FieldByName("Arch") archType := ctx.Config().AndroidFirstDeviceTarget.Arch.ArchType MergePropertiesFromVariant(ctx, &a.properties, archProps, archType.Name) if String(a.properties.Apk) == "" { // Disable this module since the apk property is still empty after processing all matching // variants. This likely means there is no matching variant, and the default variant doesn't // have an apk property value either. a.Disable() } } func MergePropertiesFromVariant(ctx android.EarlyModuleContext, Loading java/app_test.go +24 −0 Original line number Diff line number Diff line Loading @@ -2524,6 +2524,24 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) { `, expected: "prebuilts/apk/app.apk", }, { name: "no matching arch without default", bp: ` android_app_import { name: "foo", arch: { arm: { apk: "prebuilts/apk/app_arm.apk", }, }, presigned: true, dex_preopt: { enabled: true, }, } `, expected: "", }, } jniRuleRe := regexp.MustCompile("^if \\(zipinfo (\\S+)") Loading @@ -2531,6 +2549,12 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) { ctx, _ := testJava(t, test.bp) variant := ctx.ModuleForTests("foo", "android_common") if test.expected == "" { if variant.Module().Enabled() { t.Error("module should have been disabled, but wasn't") } continue } jniRuleCommand := variant.Output("jnis-uncompressed/foo.apk").RuleParams.Command matches := jniRuleRe.FindStringSubmatch(jniRuleCommand) if len(matches) != 2 { Loading Loading
android/prebuilt.go +3 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,9 @@ func InitSingleSourcePrebuiltModule(module PrebuiltInterface, srcProps interface srcPropertyName := proptools.PropertyNameForField(srcField) srcsSupplier := func(ctx BaseModuleContext) []string { if !ctx.Module().Enabled() { return nil } value := srcPropsValue.FieldByIndex(srcFieldIndex) if value.Kind() == reflect.Ptr { value = value.Elem() Loading
java/app.go +7 −0 Original line number Diff line number Diff line Loading @@ -1400,6 +1400,13 @@ func (a *AndroidAppImport) processVariants(ctx android.LoadHookContext) { archProps := reflect.ValueOf(a.archVariants).Elem().FieldByName("Arch") archType := ctx.Config().AndroidFirstDeviceTarget.Arch.ArchType MergePropertiesFromVariant(ctx, &a.properties, archProps, archType.Name) if String(a.properties.Apk) == "" { // Disable this module since the apk property is still empty after processing all matching // variants. This likely means there is no matching variant, and the default variant doesn't // have an apk property value either. a.Disable() } } func MergePropertiesFromVariant(ctx android.EarlyModuleContext, Loading
java/app_test.go +24 −0 Original line number Diff line number Diff line Loading @@ -2524,6 +2524,24 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) { `, expected: "prebuilts/apk/app.apk", }, { name: "no matching arch without default", bp: ` android_app_import { name: "foo", arch: { arm: { apk: "prebuilts/apk/app_arm.apk", }, }, presigned: true, dex_preopt: { enabled: true, }, } `, expected: "", }, } jniRuleRe := regexp.MustCompile("^if \\(zipinfo (\\S+)") Loading @@ -2531,6 +2549,12 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) { ctx, _ := testJava(t, test.bp) variant := ctx.ModuleForTests("foo", "android_common") if test.expected == "" { if variant.Module().Enabled() { t.Error("module should have been disabled, but wasn't") } continue } jniRuleCommand := variant.Output("jnis-uncompressed/foo.apk").RuleParams.Command matches := jniRuleRe.FindStringSubmatch(jniRuleCommand) if len(matches) != 2 { Loading