Correct cc_test_library migration
Previously we were treating it as a shared library only, but cc_test_library produces both a static and shared library. Test: bp2build tests Change-Id: I293d4246d581212b95765fa8f084301514d00dbf
This commit is contained in:
@@ -76,17 +76,28 @@ cc_test {
|
|||||||
static_libs: ["hostlib"],
|
static_libs: ["hostlib"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
static_libs: ["cc_test_lib1"],
|
||||||
|
shared_libs: ["cc_test_lib2"],
|
||||||
data: [":data_mod", "file.txt"],
|
data: [":data_mod", "file.txt"],
|
||||||
data_bins: [":cc_bin"],
|
data_bins: [":cc_bin"],
|
||||||
data_libs: [":cc_lib"],
|
data_libs: [":cc_lib"],
|
||||||
cflags: ["-Wall"],
|
cflags: ["-Wall"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_test_library {
|
||||||
|
name: "cc_test_lib1",
|
||||||
|
host_supported: true,
|
||||||
|
include_build_directory: false,
|
||||||
|
}
|
||||||
` + simpleModuleDoNotConvertBp2build("cc_library", "foolib") +
|
` + simpleModuleDoNotConvertBp2build("cc_library", "foolib") +
|
||||||
simpleModuleDoNotConvertBp2build("cc_library_static", "hostlib") +
|
simpleModuleDoNotConvertBp2build("cc_library_static", "hostlib") +
|
||||||
simpleModuleDoNotConvertBp2build("genrule", "data_mod") +
|
simpleModuleDoNotConvertBp2build("genrule", "data_mod") +
|
||||||
simpleModuleDoNotConvertBp2build("cc_binary", "cc_bin") +
|
simpleModuleDoNotConvertBp2build("cc_binary", "cc_bin") +
|
||||||
simpleModuleDoNotConvertBp2build("cc_test_library", "cc_lib"),
|
simpleModuleDoNotConvertBp2build("cc_library", "cc_lib") +
|
||||||
|
simpleModuleDoNotConvertBp2build("cc_test_library", "cc_test_lib2"),
|
||||||
targets: []testBazelTarget{
|
targets: []testBazelTarget{
|
||||||
|
{"cc_library_shared", "cc_test_lib1", AttrNameToString{}},
|
||||||
|
{"cc_library_static", "cc_test_lib1_bp2build_cc_library_static", AttrNameToString{}},
|
||||||
{"cc_test", "mytest", AttrNameToString{
|
{"cc_test", "mytest", AttrNameToString{
|
||||||
"copts": `["-Wall"]`,
|
"copts": `["-Wall"]`,
|
||||||
"data": `[
|
"data": `[
|
||||||
@@ -95,7 +106,7 @@ cc_test {
|
|||||||
":cc_bin",
|
":cc_bin",
|
||||||
":cc_lib",
|
":cc_lib",
|
||||||
]`,
|
]`,
|
||||||
"deps": `select({
|
"deps": `[":cc_test_lib1_bp2build_cc_library_static"] + select({
|
||||||
"//build/bazel/platforms/os:darwin": [":hostlib"],
|
"//build/bazel/platforms/os:darwin": [":hostlib"],
|
||||||
"//build/bazel/platforms/os:linux_bionic": [":hostlib"],
|
"//build/bazel/platforms/os:linux_bionic": [":hostlib"],
|
||||||
"//build/bazel/platforms/os:linux_glibc": [":hostlib"],
|
"//build/bazel/platforms/os:linux_glibc": [":hostlib"],
|
||||||
@@ -106,7 +117,7 @@ cc_test {
|
|||||||
"gtest": "True",
|
"gtest": "True",
|
||||||
"isolated": "True",
|
"isolated": "True",
|
||||||
"local_includes": `["."]`,
|
"local_includes": `["."]`,
|
||||||
"dynamic_deps": `select({
|
"dynamic_deps": `[":cc_test_lib2"] + select({
|
||||||
"//build/bazel/platforms/os:android": [":foolib"],
|
"//build/bazel/platforms/os:android": [":foolib"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
})`,
|
})`,
|
||||||
|
4
cc/cc.go
4
cc/cc.go
@@ -3914,8 +3914,8 @@ func (c *Module) typ() moduleType {
|
|||||||
// TODO(b/244431896) properly convert cc_test_library to its own macro. This
|
// TODO(b/244431896) properly convert cc_test_library to its own macro. This
|
||||||
// will let them add implicit compile deps on gtest, for example.
|
// will let them add implicit compile deps on gtest, for example.
|
||||||
//
|
//
|
||||||
// For now, treat them as regular shared libraries.
|
// For now, treat them as regular libraries.
|
||||||
return sharedLibrary
|
return fullLibrary
|
||||||
} else if c.CcLibrary() {
|
} else if c.CcLibrary() {
|
||||||
static := false
|
static := false
|
||||||
shared := false
|
shared := false
|
||||||
|
Reference in New Issue
Block a user