Support abi check in bazel.
Bug: 253498204
Test: Manual and unit test.
Change-Id: Id23c4f772f67c4ba05704eaad77322133474b42b
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 61acf68..edb0c43 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -1409,6 +1409,7 @@
"strip": true,
"inject_bssl_hash": true,
"has_stubs": true,
+ "stubs_symbol_file": true,
"use_version_lib": true,
}
@@ -2710,7 +2711,8 @@
func TestCcLibraryStubs(t *testing.T) {
expectedBazelTargets := makeCcLibraryTargets("a", AttrNameToString{
- "has_stubs": `True`,
+ "has_stubs": `True`,
+ "stubs_symbol_file": `"a.map.txt"`,
})
expectedBazelTargets = append(expectedBazelTargets, makeCcStubSuiteTargets("a", AttrNameToString{
"soname": `"a.so"`,
@@ -3600,3 +3602,46 @@
},
})
}
+
+func TestCcLibraryHeaderAbiChecker(t *testing.T) {
+ runCcLibraryTestCase(t, Bp2buildTestCase{
+ Description: "cc_library with header abi checker",
+ ModuleTypeUnderTest: "cc_library",
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ Blueprint: `cc_library {
+ name: "foo",
+ header_abi_checker: {
+ enabled: true,
+ symbol_file: "a.map.txt",
+ exclude_symbol_versions: [
+ "29",
+ "30",
+ ],
+ exclude_symbol_tags: [
+ "tag1",
+ "tag2",
+ ],
+ check_all_apis: true,
+ diff_flags: ["-allow-adding-removing-weak-symbols"],
+ },
+ include_build_directory: false,
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{}),
+ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "abi_checker_enabled": `True`,
+ "abi_checker_symbol_file": `"a.map.txt"`,
+ "abi_checker_exclude_symbol_versions": `[
+ "29",
+ "30",
+ ]`,
+ "abi_checker_exclude_symbol_tags": `[
+ "tag1",
+ "tag2",
+ ]`,
+ "abi_checker_check_all_apis": `True`,
+ "abi_checker_diff_flags": `["-allow-adding-removing-weak-symbols"]`,
+ }),
+ },
+ })
+}