Add apex_available aidl + aidl&lang libraries
Test: b build com.android.neuralnetworks com.android.media.swcodec
Change-Id: I008b915b22e4c8c2cf1f0aee6cfdaf17374cb3a9
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 48e93cd..16d8f6e 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -2425,7 +2425,10 @@
"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"]`,
}),
@@ -2464,7 +2467,10 @@
"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"]`,
}),
@@ -3322,6 +3328,7 @@
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"]`,
diff --git a/bp2build/filegroup_conversion_test.go b/bp2build/filegroup_conversion_test.go
index e978fb3..7ce559d 100644
--- a/bp2build/filegroup_conversion_test.go
+++ b/bp2build/filegroup_conversion_test.go
@@ -74,6 +74,7 @@
expectedBazelAttrs: AttrNameToString{
"srcs": `["aidl/foo.aidl"]`,
"strip_import_prefix": `"aidl"`,
+ "tags": `["apex_available=//apex_available:anyapex"]`,
},
},
{
@@ -85,18 +86,21 @@
}`,
expectedBazelAttrs: AttrNameToString{
"srcs": `["aidl/foo.aidl"]`,
+ "tags": `["apex_available=//apex_available:anyapex"]`,
},
},
}
for _, test := range testcases {
- expectedBazelTargets := []string{
- MakeBazelTargetNoRestrictions("aidl_library", "foo", test.expectedBazelAttrs),
- }
- runFilegroupTestCase(t, Bp2buildTestCase{
- Description: test.name,
- Blueprint: test.bp,
- ExpectedBazelTargets: expectedBazelTargets,
+ t.Run(test.name, func(t *testing.T) {
+ expectedBazelTargets := []string{
+ MakeBazelTargetNoRestrictions("aidl_library", "foo", test.expectedBazelAttrs),
+ }
+ runFilegroupTestCase(t, Bp2buildTestCase{
+ Description: test.name,
+ Blueprint: test.bp,
+ ExpectedBazelTargets: expectedBazelTargets,
+ })
})
}
}
@@ -136,7 +140,11 @@
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"]`}),
}})
diff --git a/bp2build/java_library_conversion_test.go b/bp2build/java_library_conversion_test.go
index e3c4857..69d0db9 100644
--- a/bp2build/java_library_conversion_test.go
+++ b/bp2build/java_library_conversion_test.go
@@ -493,6 +493,7 @@
"a.aidl",
"b.aidl",
]`,
+ "tags": `["apex_available=//apex_available:anyapex"]`,
}),
MakeBazelTarget("java_aidl_library", "example_lib_java_aidl_library", AttrNameToString{
"deps": `[":aidl_files"]`,
diff --git a/bp2build/testing.go b/bp2build/testing.go
index ee2ab08..856b6ee 100644
--- a/bp2build/testing.go
+++ b/bp2build/testing.go
@@ -228,6 +228,7 @@
//
// 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.