summaryrefslogtreecommitdiff
path: root/bp2build/testing.go
diff options
context:
space:
mode:
Diffstat (limited to 'bp2build/testing.go')
-rw-r--r--bp2build/testing.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/bp2build/testing.go b/bp2build/testing.go
index f3cd7f07f..faf1a443e 100644
--- a/bp2build/testing.go
+++ b/bp2build/testing.go
@@ -33,7 +33,8 @@ type customProps struct {
Nested_props nestedProps
Nested_props_ptr *nestedProps
- Arch_paths []string `android:"path,arch_variant"`
+ Arch_paths []string `android:"path,arch_variant"`
+ Arch_paths_exclude []string `android:"path,arch_variant"`
}
type customModule struct {
@@ -155,16 +156,18 @@ func customBp2BuildMutator(ctx android.TopDownMutatorContext) {
return
}
- paths := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, m.props.Arch_paths))
+ paths := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrcExcludes(ctx, m.props.Arch_paths, m.props.Arch_paths_exclude))
for axis, configToProps := range m.GetArchVariantProperties(ctx, &customProps{}) {
for config, props := range configToProps {
if archProps, ok := props.(*customProps); ok && archProps.Arch_paths != nil {
- paths.SetSelectValue(axis, config, android.BazelLabelForModuleSrc(ctx, archProps.Arch_paths))
+ paths.SetSelectValue(axis, config, android.BazelLabelForModuleSrcExcludes(ctx, archProps.Arch_paths, archProps.Arch_paths_exclude))
}
}
}
+ paths.ResolveExcludes()
+
attrs := &customBazelModuleAttributes{
String_prop: m.props.String_prop,
String_list_prop: m.props.String_list_prop,
@@ -216,3 +219,9 @@ func generateBazelTargetsForDir(codegenCtx *CodegenContext, dir string) BazelTar
buildFileToTargets, _, _ := GenerateBazelTargets(codegenCtx, false)
return buildFileToTargets[dir]
}
+
+func registerCustomModuleForBp2buildConversion(ctx *android.TestContext) {
+ ctx.RegisterModuleType("custom", customModuleFactory)
+ ctx.RegisterBp2BuildMutator("custom", customBp2BuildMutator)
+ ctx.RegisterForBazelConversion()
+}