Loading android/filegroup.go +13 −4 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ func (fg *fileGroup) ConvertWithBp2build(ctx TopDownMutatorContext) { // If the module has a mixed bag of AIDL and non-AIDL files, split the filegroup manually // and then convert if fg.ShouldConvertToAidlLibrary(ctx) { tags := []string{"apex_available=//apex_available:anyapex"} attrs := &bazelAidlLibraryAttributes{ Srcs: srcs, Strip_import_prefix: fg.properties.Path, Loading @@ -128,17 +129,25 @@ func (fg *fileGroup) ConvertWithBp2build(ctx TopDownMutatorContext) { Bzl_load_location: "//build/bazel/rules/aidl:library.bzl", } ctx.CreateBazelTargetModule(props, CommonAttributes{Name: fg.Name()}, attrs) ctx.CreateBazelTargetModule( props, CommonAttributes{ Name: fg.Name(), Tags: bazel.MakeStringListAttribute(tags), }, attrs) } else { if fg.ShouldConvertToProtoLibrary(ctx) { // TODO(b/246997908): we can remove this tag if we could figure out a // solution for this bug. attrs := &ProtoAttrs{ Srcs: srcs, Strip_import_prefix: fg.properties.Path, } tags := []string{"manual"} tags := []string{ "apex_available=//apex_available:anyapex", // TODO(b/246997908): we can remove this tag if we could figure out a solution for this bug. "manual", } ctx.CreateBazelTargetModule( bazel.BazelTargetModuleProperties{Rule_class: "proto_library"}, CommonAttributes{ Loading bp2build/cc_library_conversion_test.go +9 −2 Original line number Diff line number Diff line Loading @@ -2425,7 +2425,10 @@ cc_library { "whole_archive_deps": `[":a_cc_proto_lite"]`, }), MakeBazelTargetNoRestrictions("proto_library", "a_fg_proto_bp2build_converted", AttrNameToString{ "srcs": `["a_fg.proto"]`, "tags": `["manual"]`, "tags": `[ "apex_available=//apex_available:anyapex", "manual", ]`, }), MakeBazelTargetNoRestrictions("filegroup", "a_fg_proto", AttrNameToString{ "srcs": `["a_fg.proto"]`, }), Loading Loading @@ -2464,7 +2467,10 @@ cc_library { "whole_archive_deps": `[":a_cc_proto_lite"]`, }), MakeBazelTargetNoRestrictions("proto_library", "a_fg_proto_bp2build_converted", AttrNameToString{ "srcs": `["a_fg.proto"]`, "tags": `["manual"]`, "tags": `[ "apex_available=//apex_available:anyapex", "manual", ]`, }), MakeBazelTargetNoRestrictions("filegroup", "a_fg_proto", AttrNameToString{ "srcs": `["a_fg.proto"]`, }), Loading Loading @@ -3322,6 +3328,7 @@ cc_library { MakeBazelTargetNoRestrictions("aidl_library", "A_aidl", AttrNameToString{ "srcs": `["aidl/A.aidl"]`, "strip_import_prefix": `"aidl"`, "tags": `["apex_available=//apex_available:anyapex"]`, }), MakeBazelTarget("aidl_library", "foo_aidl_library", AttrNameToString{ "srcs": `["B.aidl"]`, Loading bp2build/filegroup_conversion_test.go +16 −8 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ func TestFilegroupWithAidlSrcs(t *testing.T) { expectedBazelAttrs: AttrNameToString{ "srcs": `["aidl/foo.aidl"]`, "strip_import_prefix": `"aidl"`, "tags": `["apex_available=//apex_available:anyapex"]`, }, }, { Loading @@ -85,11 +86,13 @@ func TestFilegroupWithAidlSrcs(t *testing.T) { }`, expectedBazelAttrs: AttrNameToString{ "srcs": `["aidl/foo.aidl"]`, "tags": `["apex_available=//apex_available:anyapex"]`, }, }, } for _, test := range testcases { t.Run(test.name, func(t *testing.T) { expectedBazelTargets := []string{ MakeBazelTargetNoRestrictions("aidl_library", "foo", test.expectedBazelAttrs), } Loading @@ -98,6 +101,7 @@ func TestFilegroupWithAidlSrcs(t *testing.T) { Blueprint: test.bp, ExpectedBazelTargets: expectedBazelTargets, }) }) } } Loading Loading @@ -136,7 +140,11 @@ filegroup { MakeBazelTargetNoRestrictions("proto_library", "foo_bp2build_converted", AttrNameToString{ "srcs": `["proto/foo.proto"]`, "strip_import_prefix": `"proto"`, "tags": `["manual"]`}), "tags": `[ "apex_available=//apex_available:anyapex", "manual", ]`, }), MakeBazelTargetNoRestrictions("filegroup", "foo", AttrNameToString{ "srcs": `["proto/foo.proto"]`}), }}) Loading bp2build/java_library_conversion_test.go +1 −0 Original line number Diff line number Diff line Loading @@ -493,6 +493,7 @@ java_library { "a.aidl", "b.aidl", ]`, "tags": `["apex_available=//apex_available:anyapex"]`, }), MakeBazelTarget("java_aidl_library", "example_lib_java_aidl_library", AttrNameToString{ "deps": `[":aidl_files"]`, Loading bp2build/testing.go +1 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,7 @@ type BazelTestResult struct { // // If ignoreUnexpected=true then it will ignore directories for which there are no expected targets. func (b BazelTestResult) CompareAllBazelTargets(t *testing.T, description string, expectedTargets map[string][]string, ignoreUnexpected bool) { t.Helper() actualTargets := b.buildFileToTargets // Generate the sorted set of directories to check. Loading Loading
android/filegroup.go +13 −4 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ func (fg *fileGroup) ConvertWithBp2build(ctx TopDownMutatorContext) { // If the module has a mixed bag of AIDL and non-AIDL files, split the filegroup manually // and then convert if fg.ShouldConvertToAidlLibrary(ctx) { tags := []string{"apex_available=//apex_available:anyapex"} attrs := &bazelAidlLibraryAttributes{ Srcs: srcs, Strip_import_prefix: fg.properties.Path, Loading @@ -128,17 +129,25 @@ func (fg *fileGroup) ConvertWithBp2build(ctx TopDownMutatorContext) { Bzl_load_location: "//build/bazel/rules/aidl:library.bzl", } ctx.CreateBazelTargetModule(props, CommonAttributes{Name: fg.Name()}, attrs) ctx.CreateBazelTargetModule( props, CommonAttributes{ Name: fg.Name(), Tags: bazel.MakeStringListAttribute(tags), }, attrs) } else { if fg.ShouldConvertToProtoLibrary(ctx) { // TODO(b/246997908): we can remove this tag if we could figure out a // solution for this bug. attrs := &ProtoAttrs{ Srcs: srcs, Strip_import_prefix: fg.properties.Path, } tags := []string{"manual"} tags := []string{ "apex_available=//apex_available:anyapex", // TODO(b/246997908): we can remove this tag if we could figure out a solution for this bug. "manual", } ctx.CreateBazelTargetModule( bazel.BazelTargetModuleProperties{Rule_class: "proto_library"}, CommonAttributes{ Loading
bp2build/cc_library_conversion_test.go +9 −2 Original line number Diff line number Diff line Loading @@ -2425,7 +2425,10 @@ cc_library { "whole_archive_deps": `[":a_cc_proto_lite"]`, }), MakeBazelTargetNoRestrictions("proto_library", "a_fg_proto_bp2build_converted", AttrNameToString{ "srcs": `["a_fg.proto"]`, "tags": `["manual"]`, "tags": `[ "apex_available=//apex_available:anyapex", "manual", ]`, }), MakeBazelTargetNoRestrictions("filegroup", "a_fg_proto", AttrNameToString{ "srcs": `["a_fg.proto"]`, }), Loading Loading @@ -2464,7 +2467,10 @@ cc_library { "whole_archive_deps": `[":a_cc_proto_lite"]`, }), MakeBazelTargetNoRestrictions("proto_library", "a_fg_proto_bp2build_converted", AttrNameToString{ "srcs": `["a_fg.proto"]`, "tags": `["manual"]`, "tags": `[ "apex_available=//apex_available:anyapex", "manual", ]`, }), MakeBazelTargetNoRestrictions("filegroup", "a_fg_proto", AttrNameToString{ "srcs": `["a_fg.proto"]`, }), Loading Loading @@ -3322,6 +3328,7 @@ cc_library { MakeBazelTargetNoRestrictions("aidl_library", "A_aidl", AttrNameToString{ "srcs": `["aidl/A.aidl"]`, "strip_import_prefix": `"aidl"`, "tags": `["apex_available=//apex_available:anyapex"]`, }), MakeBazelTarget("aidl_library", "foo_aidl_library", AttrNameToString{ "srcs": `["B.aidl"]`, Loading
bp2build/filegroup_conversion_test.go +16 −8 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ func TestFilegroupWithAidlSrcs(t *testing.T) { expectedBazelAttrs: AttrNameToString{ "srcs": `["aidl/foo.aidl"]`, "strip_import_prefix": `"aidl"`, "tags": `["apex_available=//apex_available:anyapex"]`, }, }, { Loading @@ -85,11 +86,13 @@ func TestFilegroupWithAidlSrcs(t *testing.T) { }`, expectedBazelAttrs: AttrNameToString{ "srcs": `["aidl/foo.aidl"]`, "tags": `["apex_available=//apex_available:anyapex"]`, }, }, } for _, test := range testcases { t.Run(test.name, func(t *testing.T) { expectedBazelTargets := []string{ MakeBazelTargetNoRestrictions("aidl_library", "foo", test.expectedBazelAttrs), } Loading @@ -98,6 +101,7 @@ func TestFilegroupWithAidlSrcs(t *testing.T) { Blueprint: test.bp, ExpectedBazelTargets: expectedBazelTargets, }) }) } } Loading Loading @@ -136,7 +140,11 @@ filegroup { MakeBazelTargetNoRestrictions("proto_library", "foo_bp2build_converted", AttrNameToString{ "srcs": `["proto/foo.proto"]`, "strip_import_prefix": `"proto"`, "tags": `["manual"]`}), "tags": `[ "apex_available=//apex_available:anyapex", "manual", ]`, }), MakeBazelTargetNoRestrictions("filegroup", "foo", AttrNameToString{ "srcs": `["proto/foo.proto"]`}), }}) Loading
bp2build/java_library_conversion_test.go +1 −0 Original line number Diff line number Diff line Loading @@ -493,6 +493,7 @@ java_library { "a.aidl", "b.aidl", ]`, "tags": `["apex_available=//apex_available:anyapex"]`, }), MakeBazelTarget("java_aidl_library", "example_lib_java_aidl_library", AttrNameToString{ "deps": `[":aidl_files"]`, Loading
bp2build/testing.go +1 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,7 @@ type BazelTestResult struct { // // If ignoreUnexpected=true then it will ignore directories for which there are no expected targets. func (b BazelTestResult) CompareAllBazelTargets(t *testing.T, description string, expectedTargets map[string][]string, ignoreUnexpected bool) { t.Helper() actualTargets := b.buildFileToTargets // Generate the sorted set of directories to check. Loading