Merge "Support multilib property for cc_genrule" into main am: 1f4ffda2ed

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3002539

Change-Id: I6c7ea53cc99ffa001a02036ab9cd27dca7dc0b2a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2024-03-20 02:55:50 +00:00
committed by Automerger Merge Worker
2 changed files with 45 additions and 1 deletions

View File

@@ -210,3 +210,47 @@ func TestVendorProductVariantGenrule(t *testing.T) {
t.Errorf(`expected product variant, but does not exist in %v`, variants)
}
}
// cc_genrule is initialized to android.InitAndroidArchModule
// that is an architecture-specific Android module.
// So testing properties tagged with `android:"arch_variant"`
// for cc_genrule.
func TestMultilibGenruleOut(t *testing.T) {
bp := `
cc_genrule {
name: "gen",
cmd: "cp $(in) $(out)",
srcs: ["foo"],
multilib: {
lib32: {
out: [
"subdir32/external-module32",
],
},
lib64: {
out: [
"subdir64/external-module64",
],
},
},
}
`
result := PrepareForIntegrationTestWithCc.RunTestWithBp(t, bp)
gen_32bit := result.ModuleForTests("gen", "android_arm_armv7-a-neon").OutputFiles(t, "")
android.AssertPathsEndWith(t,
"genrule_out",
[]string{
"subdir32/external-module32",
},
gen_32bit,
)
gen_64bit := result.ModuleForTests("gen", "android_arm64_armv8-a").OutputFiles(t, "")
android.AssertPathsEndWith(t,
"genrule_out",
[]string{
"subdir64/external-module64",
},
gen_64bit,
)
}

View File

@@ -808,7 +808,7 @@ func GenRuleFactory() android.Module {
type genRuleProperties struct {
// names of the output files that will be generated
Out []string
Out []string `android:"arch_variant"`
}
var Bool = proptools.Bool