Add bp2build arch-specific paths mutator
Adds deps for properties tagged `android:"path"` within arch, multilib,
and target properties.
Test: build/bazel/ci/bp2build.sh
Test: m nothing
Bug: 185217298
Change-Id: I0230da399d2c4e984b837f69523fa09eadba3ff1
diff --git a/bp2build/testing.go b/bp2build/testing.go
index ef3a78f..d65aa0b 100644
--- a/bp2build/testing.go
+++ b/bp2build/testing.go
@@ -28,6 +28,8 @@
Nested_props nestedProps
Nested_props_ptr *nestedProps
+
+ Arch_paths []string `android:"path,arch_variant"`
}
type customModule struct {
@@ -56,7 +58,7 @@
func customModuleFactory() android.Module {
m := customModuleFactoryBase()
- android.InitAndroidModule(m)
+ android.InitAndroidArchModule(m, android.HostAndDeviceSupported, android.MultilibBoth)
return m
}
@@ -114,6 +116,7 @@
type customBazelModuleAttributes struct {
String_prop string
String_list_prop []string
+ Arch_paths bazel.LabelListAttribute
}
type customBazelModule struct {
@@ -137,9 +140,18 @@
return
}
+ paths := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, m.props.Arch_paths))
+
+ for arch, props := range m.GetArchProperties(&customProps{}) {
+ if archProps, ok := props.(*customProps); ok && archProps.Arch_paths != nil {
+ paths.SetValueForArch(arch.Name, android.BazelLabelForModuleSrc(ctx, archProps.Arch_paths))
+ }
+ }
+
attrs := &customBazelModuleAttributes{
String_prop: m.props.String_prop,
String_list_prop: m.props.String_list_prop,
+ Arch_paths: paths,
}
props := bazel.BazelTargetModuleProperties{