Add musl defaults in bp2build
Bug: 261657184 Test: Unit Tests Test: Manual Inspection of generated files Change-Id: I69864abb410fddecd530fc75f2531aff33b33c97
This commit is contained in:
@@ -1805,6 +1805,11 @@ func TestCcLibrary_SystemSharedLibsLinuxBionicEmpty(t *testing.T) {
|
||||
ModuleTypeUnderTest: "cc_library",
|
||||
ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
||||
Blueprint: soongCcLibraryPreamble + `
|
||||
cc_library {
|
||||
name: "libc_musl",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "target_linux_bionic_empty",
|
||||
target: {
|
||||
@@ -1816,7 +1821,10 @@ cc_library {
|
||||
}
|
||||
`,
|
||||
ExpectedBazelTargets: makeCcLibraryTargets("target_linux_bionic_empty", AttrNameToString{
|
||||
"system_dynamic_deps": `[]`,
|
||||
"system_dynamic_deps": `select({
|
||||
"//build/bazel/platforms/os:linux_musl": [":libc_musl"],
|
||||
"//conditions:default": [],
|
||||
})`,
|
||||
}),
|
||||
},
|
||||
)
|
||||
@@ -1828,6 +1836,11 @@ func TestCcLibrary_SystemSharedLibsBionicEmpty(t *testing.T) {
|
||||
ModuleTypeUnderTest: "cc_library",
|
||||
ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
||||
Blueprint: soongCcLibraryPreamble + `
|
||||
cc_library {
|
||||
name: "libc_musl",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "target_bionic_empty",
|
||||
target: {
|
||||
@@ -1839,12 +1852,68 @@ cc_library {
|
||||
}
|
||||
`,
|
||||
ExpectedBazelTargets: makeCcLibraryTargets("target_bionic_empty", AttrNameToString{
|
||||
"system_dynamic_deps": `[]`,
|
||||
"system_dynamic_deps": `select({
|
||||
"//build/bazel/platforms/os:linux_musl": [":libc_musl"],
|
||||
"//conditions:default": [],
|
||||
})`,
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func TestCcLibrary_SystemSharedLibsMuslEmpty(t *testing.T) {
|
||||
runCcLibraryTestCase(t, Bp2buildTestCase{
|
||||
Description: "cc_library system_shared_lib empty for musl variant",
|
||||
ModuleTypeUnderTest: "cc_library",
|
||||
ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
||||
Blueprint: soongCcLibraryPreamble + `
|
||||
cc_library {
|
||||
name: "libc_musl",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "target_musl_empty",
|
||||
target: {
|
||||
musl: {
|
||||
system_shared_libs: [],
|
||||
},
|
||||
},
|
||||
include_build_directory: false,
|
||||
}
|
||||
`,
|
||||
ExpectedBazelTargets: makeCcLibraryTargets("target_musl_empty", AttrNameToString{
|
||||
"system_dynamic_deps": `[]`,
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
func TestCcLibrary_SystemSharedLibsLinuxMuslEmpty(t *testing.T) {
|
||||
runCcLibraryTestCase(t, Bp2buildTestCase{
|
||||
Description: "cc_library system_shared_lib empty for linux_musl variant",
|
||||
ModuleTypeUnderTest: "cc_library",
|
||||
ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
||||
Blueprint: soongCcLibraryPreamble + `
|
||||
cc_library {
|
||||
name: "libc_musl",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "target_linux_musl_empty",
|
||||
target: {
|
||||
linux_musl: {
|
||||
system_shared_libs: [],
|
||||
},
|
||||
},
|
||||
include_build_directory: false,
|
||||
}
|
||||
`,
|
||||
ExpectedBazelTargets: makeCcLibraryTargets("target_linux_musl_empty", AttrNameToString{
|
||||
"system_dynamic_deps": `[]`,
|
||||
}),
|
||||
})
|
||||
}
|
||||
func TestCcLibrary_SystemSharedLibsSharedAndRoot(t *testing.T) {
|
||||
runCcLibraryTestCase(t, Bp2buildTestCase{
|
||||
Description: "cc_library system_shared_libs set for shared and root",
|
||||
|
Reference in New Issue
Block a user