Handle excludes_{shared,static}_libs
Bug: 188497994 Test: bp2build.sh Change-Id: I4a5ea40cbd804e8542fe33143e4926abc0c6164f
This commit is contained in:
@@ -985,3 +985,117 @@ func TestCcLibraryLabelAttributeGetTargetProperties(t *testing.T) {
|
||||
)`},
|
||||
})
|
||||
}
|
||||
|
||||
func TestCcLibraryExcludeLibs(t *testing.T) {
|
||||
runCcLibraryTestCase(t, bp2buildTestCase{
|
||||
moduleTypeUnderTest: "cc_library",
|
||||
moduleTypeUnderTestFactory: cc.LibraryFactory,
|
||||
moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryBp2Build,
|
||||
depsMutators: []android.RegisterMutatorFunc{cc.RegisterDepsBp2Build},
|
||||
filesystem: map[string]string{},
|
||||
blueprint: soongCcLibraryStaticPreamble + `
|
||||
cc_library {
|
||||
name: "foo_static",
|
||||
srcs: ["common.c"],
|
||||
whole_static_libs: [
|
||||
"arm_whole_static_lib_excludes",
|
||||
"malloc_not_svelte_whole_static_lib_excludes"
|
||||
],
|
||||
static_libs: [
|
||||
"arm_static_lib_excludes",
|
||||
"malloc_not_svelte_static_lib_excludes"
|
||||
],
|
||||
shared_libs: [
|
||||
"arm_shared_lib_excludes",
|
||||
],
|
||||
arch: {
|
||||
arm: {
|
||||
exclude_shared_libs: [
|
||||
"arm_shared_lib_excludes",
|
||||
],
|
||||
exclude_static_libs: [
|
||||
"arm_static_lib_excludes",
|
||||
"arm_whole_static_lib_excludes",
|
||||
],
|
||||
},
|
||||
},
|
||||
product_variables: {
|
||||
malloc_not_svelte: {
|
||||
shared_libs: ["malloc_not_svelte_shared_lib"],
|
||||
whole_static_libs: ["malloc_not_svelte_whole_static_lib"],
|
||||
exclude_static_libs: [
|
||||
"malloc_not_svelte_static_lib_excludes",
|
||||
"malloc_not_svelte_whole_static_lib_excludes",
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "arm_whole_static_lib_excludes",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "malloc_not_svelte_whole_static_lib",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "malloc_not_svelte_whole_static_lib_excludes",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "arm_static_lib_excludes",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "malloc_not_svelte_static_lib_excludes",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "arm_shared_lib_excludes",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "malloc_not_svelte_shared_lib",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{
|
||||
`cc_library(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
dynamic_deps = select({
|
||||
"//build/bazel/platforms/arch:arm": [],
|
||||
"//conditions:default": [":arm_shared_lib_excludes"],
|
||||
}) + select({
|
||||
"//build/bazel/product_variables:malloc_not_svelte": [":malloc_not_svelte_shared_lib"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
implementation_deps = select({
|
||||
"//build/bazel/platforms/arch:arm": [],
|
||||
"//conditions:default": [":arm_static_lib_excludes"],
|
||||
}) + select({
|
||||
"//build/bazel/product_variables:malloc_not_svelte": [],
|
||||
"//conditions:default": [":malloc_not_svelte_static_lib_excludes"],
|
||||
}),
|
||||
srcs_c = ["common.c"],
|
||||
whole_archive_deps = select({
|
||||
"//build/bazel/platforms/arch:arm": [],
|
||||
"//conditions:default": [":arm_whole_static_lib_excludes"],
|
||||
}) + select({
|
||||
"//build/bazel/product_variables:malloc_not_svelte": [":malloc_not_svelte_whole_static_lib"],
|
||||
"//conditions:default": [":malloc_not_svelte_whole_static_lib_excludes"],
|
||||
}),
|
||||
)`,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user