summaryrefslogtreecommitdiff
path: root/bp2build/testing.go
diff options
context:
space:
mode:
author Liz Kammer <eakammer@google.com> 2021-08-04 15:17:02 -0400
committer Liz Kammer <eakammer@google.com> 2021-08-12 15:54:38 -0400
commit32b77cf8a8142449e2ab68f45b67afc883a6bbd7 (patch)
tree8963b117bd77b475c710440813580853345d9fc4 /bp2build/testing.go
parentdd7107c84b12a367329334e3e8514d9da75174e2 (diff)
Add some initial benchmarking for bp2build.
Test: go test -benchmark=. in bp2build directory Change-Id: I8275c38461078cc6100fbc89837177de0edc9d68
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()
+}