Cleanup bp2build tests to reduce repetition
Test: go test bp2build tests Change-Id: Ia96a1a8ed58d5be13fedf31e1667670efdfe3aef
This commit is contained in:
@@ -26,18 +26,18 @@ const (
|
||||
// See cc/testing.go for more context
|
||||
soongCcLibraryStaticPreamble = `
|
||||
cc_defaults {
|
||||
name: "linux_bionic_supported",
|
||||
name: "linux_bionic_supported",
|
||||
}
|
||||
|
||||
toolchain_library {
|
||||
name: "libclang_rt.builtins-x86_64-android",
|
||||
defaults: ["linux_bionic_supported"],
|
||||
vendor_available: true,
|
||||
vendor_ramdisk_available: true,
|
||||
product_available: true,
|
||||
recovery_available: true,
|
||||
native_bridge_supported: true,
|
||||
src: "",
|
||||
name: "libclang_rt.builtins-x86_64-android",
|
||||
defaults: ["linux_bionic_supported"],
|
||||
vendor_available: true,
|
||||
vendor_ramdisk_available: true,
|
||||
product_available: true,
|
||||
recovery_available: true,
|
||||
native_bridge_supported: true,
|
||||
src: "",
|
||||
}`
|
||||
)
|
||||
|
||||
@@ -112,31 +112,37 @@ func TestCcLibraryStaticSimple(t *testing.T) {
|
||||
cc_library_headers {
|
||||
name: "header_lib_1",
|
||||
export_include_dirs: ["header_lib_1"],
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library_headers {
|
||||
name: "header_lib_2",
|
||||
export_include_dirs: ["header_lib_2"],
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "static_lib_1",
|
||||
srcs: ["static_lib_1.cc"],
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "static_lib_2",
|
||||
srcs: ["static_lib_2.cc"],
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "whole_static_lib_1",
|
||||
srcs: ["whole_static_lib_1.cc"],
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "whole_static_lib_2",
|
||||
srcs: ["whole_static_lib_2.cc"],
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
@@ -211,38 +217,6 @@ cc_library_static {
|
||||
":whole_static_lib_1",
|
||||
":whole_static_lib_2",
|
||||
],
|
||||
)`, `cc_library_static(
|
||||
name = "static_lib_1",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs = ["static_lib_1.cc"],
|
||||
)`, `cc_library_static(
|
||||
name = "static_lib_2",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs = ["static_lib_2.cc"],
|
||||
)`, `cc_library_static(
|
||||
name = "whole_static_lib_1",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs = ["whole_static_lib_1.cc"],
|
||||
)`, `cc_library_static(
|
||||
name = "whole_static_lib_2",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs = ["whole_static_lib_2.cc"],
|
||||
)`},
|
||||
})
|
||||
}
|
||||
@@ -273,7 +247,7 @@ cc_library_static {
|
||||
srcs: [
|
||||
],
|
||||
include_dirs: [
|
||||
"subpackage",
|
||||
"subpackage",
|
||||
],
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
@@ -305,13 +279,10 @@ func TestCcLibraryStaticExportIncludeDir(t *testing.T) {
|
||||
cc_library_static {
|
||||
name: "foo_static",
|
||||
export_include_dirs: ["subpackage"],
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
export_includes = ["subpackage"],
|
||||
linkstatic = True,
|
||||
)`},
|
||||
@@ -334,13 +305,10 @@ func TestCcLibraryStaticExportSystemIncludeDir(t *testing.T) {
|
||||
cc_library_static {
|
||||
name: "foo_static",
|
||||
export_system_include_dirs: ["subpackage"],
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
export_system_includes = ["subpackage"],
|
||||
linkstatic = True,
|
||||
)`},
|
||||
@@ -473,18 +441,21 @@ func TestCcLibraryStaticArchSpecificStaticLib(t *testing.T) {
|
||||
moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryStaticBp2Build,
|
||||
filesystem: map[string]string{},
|
||||
blueprint: soongCcLibraryStaticPreamble + `
|
||||
cc_library_static { name: "static_dep" }
|
||||
cc_library_static { name: "static_dep2" }
|
||||
cc_library_static {
|
||||
name: "static_dep",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
cc_library_static {
|
||||
name: "static_dep2",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
cc_library_static {
|
||||
name: "foo_static",
|
||||
arch: { arm64: { static_libs: ["static_dep"], whole_static_libs: ["static_dep2"] } },
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
implementation_deps = select({
|
||||
"//build/bazel/platforms/arch:arm64": [":static_dep"],
|
||||
"//conditions:default": [],
|
||||
@@ -494,20 +465,6 @@ cc_library_static {
|
||||
"//build/bazel/platforms/arch:arm64": [":static_dep2"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)`, `cc_library_static(
|
||||
name = "static_dep",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
)`, `cc_library_static(
|
||||
name = "static_dep2",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
)`},
|
||||
})
|
||||
}
|
||||
@@ -520,18 +477,21 @@ func TestCcLibraryStaticOsSpecificStaticLib(t *testing.T) {
|
||||
moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryStaticBp2Build,
|
||||
filesystem: map[string]string{},
|
||||
blueprint: soongCcLibraryStaticPreamble + `
|
||||
cc_library_static { name: "static_dep" }
|
||||
cc_library_static { name: "static_dep2" }
|
||||
cc_library_static {
|
||||
name: "static_dep",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
cc_library_static {
|
||||
name: "static_dep2",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
cc_library_static {
|
||||
name: "foo_static",
|
||||
target: { android: { static_libs: ["static_dep"], whole_static_libs: ["static_dep2"] } },
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
implementation_deps = select({
|
||||
"//build/bazel/platforms/os:android": [":static_dep"],
|
||||
"//conditions:default": [],
|
||||
@@ -541,20 +501,6 @@ cc_library_static {
|
||||
"//build/bazel/platforms/os:android": [":static_dep2"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)`, `cc_library_static(
|
||||
name = "static_dep",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
)`, `cc_library_static(
|
||||
name = "static_dep2",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
)`},
|
||||
})
|
||||
}
|
||||
@@ -567,23 +513,32 @@ func TestCcLibraryStaticBaseArchOsSpecificStaticLib(t *testing.T) {
|
||||
moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryStaticBp2Build,
|
||||
filesystem: map[string]string{},
|
||||
blueprint: soongCcLibraryStaticPreamble + `
|
||||
cc_library_static { name: "static_dep" }
|
||||
cc_library_static { name: "static_dep2" }
|
||||
cc_library_static { name: "static_dep3" }
|
||||
cc_library_static { name: "static_dep4" }
|
||||
cc_library_static {
|
||||
name: "static_dep",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
cc_library_static {
|
||||
name: "static_dep2",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
cc_library_static {
|
||||
name: "static_dep3",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
cc_library_static {
|
||||
name: "static_dep4",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
cc_library_static {
|
||||
name: "foo_static",
|
||||
static_libs: ["static_dep"],
|
||||
whole_static_libs: ["static_dep2"],
|
||||
target: { android: { static_libs: ["static_dep3"] } },
|
||||
arch: { arm64: { static_libs: ["static_dep4"] } },
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
implementation_deps = [":static_dep"] + select({
|
||||
"//build/bazel/platforms/arch:arm64": [":static_dep4"],
|
||||
"//conditions:default": [],
|
||||
@@ -593,34 +548,6 @@ cc_library_static {
|
||||
}),
|
||||
linkstatic = True,
|
||||
whole_archive_deps = [":static_dep2"],
|
||||
)`, `cc_library_static(
|
||||
name = "static_dep",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
)`, `cc_library_static(
|
||||
name = "static_dep2",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
)`, `cc_library_static(
|
||||
name = "static_dep3",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
)`, `cc_library_static(
|
||||
name = "static_dep4",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
)`},
|
||||
})
|
||||
}
|
||||
@@ -641,13 +568,10 @@ cc_library_static {
|
||||
name: "foo_static",
|
||||
srcs: ["common.c", "foo-*.c"],
|
||||
exclude_srcs: ["foo-excluded.c"],
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs_c = [
|
||||
"common.c",
|
||||
@@ -671,14 +595,11 @@ func TestCcLibraryStaticOneArchSrcs(t *testing.T) {
|
||||
cc_library_static {
|
||||
name: "foo_static",
|
||||
srcs: ["common.c"],
|
||||
arch: { arm: { srcs: ["foo-arm.c"] } }
|
||||
arch: { arm: { srcs: ["foo-arm.c"] } },
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs_c = ["common.c"] + select({
|
||||
"//build/bazel/platforms/arch:arm": ["foo-arm.c"],
|
||||
@@ -708,13 +629,10 @@ cc_library_static {
|
||||
arch: {
|
||||
arm: { srcs: ["for-arm.c"], exclude_srcs: ["not-for-arm.c"] },
|
||||
},
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs_c = ["common.c"] + select({
|
||||
"//build/bazel/platforms/arch:arm": ["for-arm.c"],
|
||||
@@ -746,13 +664,10 @@ cc_library_static {
|
||||
arm: { srcs: ["for-arm.c"], exclude_srcs: ["not-for-arm.c"] },
|
||||
x86: { srcs: ["for-x86.c"], exclude_srcs: ["not-for-x86.c"] },
|
||||
},
|
||||
include_build_directory: false,
|
||||
} `,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs_c = ["common.c"] + select({
|
||||
"//build/bazel/platforms/arch:arm": [
|
||||
@@ -799,14 +714,11 @@ cc_library_static {
|
||||
arm64: { srcs: ["for-arm64.c"], exclude_srcs: ["not-for-arm64.c"] },
|
||||
x86: { srcs: ["for-x86.c"], exclude_srcs: ["not-for-x86.c"] },
|
||||
x86_64: { srcs: ["for-x86_64.c"], exclude_srcs: ["not-for-x86_64.c"] },
|
||||
},
|
||||
},
|
||||
include_build_directory: false,
|
||||
} `,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs_c = ["common.c"] + select({
|
||||
"//build/bazel/platforms/arch:arm": [
|
||||
@@ -863,13 +775,10 @@ cc_library_static {
|
||||
arch: {
|
||||
arm: { exclude_srcs: ["foo-no-arm.cc"] },
|
||||
},
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs = ["common.cc"] + select({
|
||||
"//build/bazel/platforms/arch:arm": [],
|
||||
@@ -900,13 +809,10 @@ cc_library_static {
|
||||
arm: { exclude_srcs: ["foo-no-arm.cc"] },
|
||||
x86: { srcs: ["x86-only.cc"] },
|
||||
},
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs = ["common.cc"] + select({
|
||||
"//build/bazel/platforms/arch:arm": [],
|
||||
@@ -928,26 +834,19 @@ func TestCcLibraryStaticMultipleDepSameName(t *testing.T) {
|
||||
moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryStaticBp2Build,
|
||||
filesystem: map[string]string{},
|
||||
blueprint: soongCcLibraryStaticPreamble + `
|
||||
cc_library_static { name: "static_dep" }
|
||||
cc_library_static {
|
||||
name: "static_dep",
|
||||
bazel_module: { bp2build_available: false },
|
||||
}
|
||||
cc_library_static {
|
||||
name: "foo_static",
|
||||
static_libs: ["static_dep", "static_dep"],
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
implementation_deps = [":static_dep"],
|
||||
linkstatic = True,
|
||||
)`, `cc_library_static(
|
||||
name = "static_dep",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
)`},
|
||||
})
|
||||
}
|
||||
@@ -970,13 +869,10 @@ cc_library_static {
|
||||
multilib: {
|
||||
lib32: { srcs: ["for-lib32.c"], exclude_srcs: ["not-for-lib32.c"] },
|
||||
},
|
||||
include_build_directory: false,
|
||||
} `,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs_c = ["common.c"] + select({
|
||||
"//build/bazel/platforms/arch:arm": ["for-lib32.c"],
|
||||
@@ -1008,13 +904,10 @@ cc_library_static {
|
||||
lib32: { srcs: ["for-lib32.c"], exclude_srcs: ["not-for-lib32.c"] },
|
||||
lib64: { srcs: ["for-lib64.c"], exclude_srcs: ["not-for-lib64.c"] },
|
||||
},
|
||||
include_build_directory: false,
|
||||
} `,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static2",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs_c = ["common.c"] + select({
|
||||
"//build/bazel/platforms/arch:arm": [
|
||||
@@ -1079,13 +972,10 @@ cc_library_static {
|
||||
lib32: { srcs: ["for-lib32.c"], exclude_srcs: ["not-for-lib32.c"] },
|
||||
lib64: { srcs: ["for-lib64.c"], exclude_srcs: ["not-for-lib64.c"] },
|
||||
},
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static3",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs_c = ["common.c"] + select({
|
||||
"//build/bazel/platforms/arch:arm": [
|
||||
@@ -1146,21 +1036,21 @@ func TestCcLibraryStaticArchSrcsExcludeSrcsGeneratedFiles(t *testing.T) {
|
||||
"not-for-everything.cpp": "",
|
||||
"dep/Android.bp": `
|
||||
genrule {
|
||||
name: "generated_src_other_pkg",
|
||||
out: ["generated_src_other_pkg.cpp"],
|
||||
cmd: "nothing to see here",
|
||||
name: "generated_src_other_pkg",
|
||||
out: ["generated_src_other_pkg.cpp"],
|
||||
cmd: "nothing to see here",
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "generated_hdr_other_pkg",
|
||||
out: ["generated_hdr_other_pkg.cpp"],
|
||||
cmd: "nothing to see here",
|
||||
name: "generated_hdr_other_pkg",
|
||||
out: ["generated_hdr_other_pkg.cpp"],
|
||||
cmd: "nothing to see here",
|
||||
}
|
||||
|
||||
genrule {
|
||||
name: "generated_hdr_other_pkg_x86",
|
||||
out: ["generated_hdr_other_pkg_x86.cpp"],
|
||||
cmd: "nothing to see here",
|
||||
name: "generated_hdr_other_pkg_x86",
|
||||
out: ["generated_hdr_other_pkg_x86.cpp"],
|
||||
cmd: "nothing to see here",
|
||||
}`,
|
||||
},
|
||||
blueprint: soongCcLibraryStaticPreamble + `
|
||||
@@ -1196,14 +1086,11 @@ cc_library_static {
|
||||
generated_headers: ["generated_hdr_other_pkg_x86"],
|
||||
},
|
||||
},
|
||||
include_build_directory: false,
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static3",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs = [
|
||||
"//dep:generated_hdr_other_pkg",
|
||||
@@ -1256,13 +1143,10 @@ cc_library_static {
|
||||
srcs: ["linux_bionic_x86_64_src.c"],
|
||||
},
|
||||
},
|
||||
include_build_directory: false,
|
||||
}`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs_c = select({
|
||||
"//build/bazel/platforms/os:android": ["android_src.c"],
|
||||
@@ -1301,13 +1185,11 @@ cc_library_static {
|
||||
cflags: ["-Wbinder32bit"],
|
||||
},
|
||||
},
|
||||
include_build_directory: false,
|
||||
} `,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
] + select({
|
||||
copts = select({
|
||||
"//build/bazel/product_variables:binder32bit": ["-Wbinder32bit"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
@@ -1339,40 +1221,38 @@ cc_library_static {
|
||||
cflags: ["-Wmalloc_not_svelte"],
|
||||
},
|
||||
},
|
||||
arch: {
|
||||
arm64: {
|
||||
product_variables: {
|
||||
malloc_not_svelte: {
|
||||
cflags: ["-Warm64_malloc_not_svelte"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
multilib: {
|
||||
lib32: {
|
||||
product_variables: {
|
||||
malloc_not_svelte: {
|
||||
cflags: ["-Wlib32_malloc_not_svelte"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
target: {
|
||||
android: {
|
||||
product_variables: {
|
||||
malloc_not_svelte: {
|
||||
cflags: ["-Wandroid_malloc_not_svelte"],
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
arch: {
|
||||
arm64: {
|
||||
product_variables: {
|
||||
malloc_not_svelte: {
|
||||
cflags: ["-Warm64_malloc_not_svelte"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
multilib: {
|
||||
lib32: {
|
||||
product_variables: {
|
||||
malloc_not_svelte: {
|
||||
cflags: ["-Wlib32_malloc_not_svelte"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
target: {
|
||||
android: {
|
||||
product_variables: {
|
||||
malloc_not_svelte: {
|
||||
cflags: ["-Wandroid_malloc_not_svelte"],
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
include_build_directory: false,
|
||||
} `,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
] + select({
|
||||
copts = select({
|
||||
"//build/bazel/product_variables:malloc_not_svelte": ["-Wmalloc_not_svelte"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
@@ -1410,20 +1290,14 @@ cc_library_static {
|
||||
asflags: ["-DPLATFORM_SDK_VERSION=%d"],
|
||||
},
|
||||
},
|
||||
include_build_directory: false,
|
||||
} `,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "foo_static",
|
||||
asflags = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
] + select({
|
||||
asflags = select({
|
||||
"//build/bazel/product_variables:platform_sdk_version": ["-DPLATFORM_SDK_VERSION=$(Platform_sdk_version)"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
srcs_as = ["common.S"],
|
||||
)`},
|
||||
@@ -1439,15 +1313,12 @@ func TestStaticLibrary_SystemSharedLibsRootEmpty(t *testing.T) {
|
||||
blueprint: soongCcLibraryStaticPreamble + `
|
||||
cc_library_static {
|
||||
name: "root_empty",
|
||||
system_shared_libs: [],
|
||||
system_shared_libs: [],
|
||||
include_build_directory: false,
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "root_empty",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
system_dynamic_deps = [],
|
||||
)`},
|
||||
@@ -1464,20 +1335,17 @@ func TestStaticLibrary_SystemSharedLibsStaticEmpty(t *testing.T) {
|
||||
cc_defaults {
|
||||
name: "static_empty_defaults",
|
||||
static: {
|
||||
system_shared_libs: [],
|
||||
},
|
||||
system_shared_libs: [],
|
||||
},
|
||||
include_build_directory: false,
|
||||
}
|
||||
cc_library_static {
|
||||
name: "static_empty",
|
||||
defaults: ["static_empty_defaults"],
|
||||
defaults: ["static_empty_defaults"],
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "static_empty",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
system_dynamic_deps = [],
|
||||
)`},
|
||||
@@ -1498,14 +1366,11 @@ cc_library_static {
|
||||
system_shared_libs: [],
|
||||
},
|
||||
},
|
||||
include_build_directory: false,
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "target_bionic_empty",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
system_dynamic_deps = [],
|
||||
)`},
|
||||
@@ -1530,14 +1395,11 @@ cc_library_static {
|
||||
system_shared_libs: [],
|
||||
},
|
||||
},
|
||||
include_build_directory: false,
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "target_linux_bionic_empty",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
system_dynamic_deps = [],
|
||||
)`},
|
||||
@@ -1560,14 +1422,11 @@ cc_library_static {
|
||||
system_shared_libs: ["libc"],
|
||||
},
|
||||
},
|
||||
include_build_directory: false,
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "target_bionic",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
system_dynamic_deps = select({
|
||||
"//build/bazel/platforms/os:bionic": [":libc"],
|
||||
@@ -1589,20 +1448,17 @@ cc_library{name: "libm"}
|
||||
|
||||
cc_library_static {
|
||||
name: "target_linux_bionic",
|
||||
system_shared_libs: ["libc"],
|
||||
system_shared_libs: ["libc"],
|
||||
target: {
|
||||
linux_bionic: {
|
||||
system_shared_libs: ["libm"],
|
||||
},
|
||||
},
|
||||
include_build_directory: false,
|
||||
}
|
||||
`,
|
||||
expectedBazelTargets: []string{`cc_library_static(
|
||||
name = "target_linux_bionic",
|
||||
copts = [
|
||||
"-I.",
|
||||
"-I$(BINDIR)/.",
|
||||
],
|
||||
linkstatic = True,
|
||||
system_dynamic_deps = [":libc"] + select({
|
||||
"//build/bazel/platforms/os:linux_bionic": [":libm"],
|
||||
|
Reference in New Issue
Block a user