|
@@ -3132,3 +3132,97 @@ cc_library_static {
|
|
|
},
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+func TestCcLibraryWithSyspropSrcs(t *testing.T) {
|
|
|
+ runCcLibraryTestCase(t, Bp2buildTestCase{
|
|
|
+ Description: "cc_library with sysprop sources",
|
|
|
+ ModuleTypeUnderTest: "cc_library",
|
|
|
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
|
|
+ Blueprint: `
|
|
|
+cc_library {
|
|
|
+ name: "foo",
|
|
|
+ srcs: [
|
|
|
+ "bar.sysprop",
|
|
|
+ "baz.sysprop",
|
|
|
+ "blah.cpp",
|
|
|
+ ],
|
|
|
+ min_sdk_version: "5",
|
|
|
+}`,
|
|
|
+ ExpectedBazelTargets: []string{
|
|
|
+ MakeBazelTarget("sysprop_library", "foo_sysprop_library", AttrNameToString{
|
|
|
+ "srcs": `[
|
|
|
+ "bar.sysprop",
|
|
|
+ "baz.sysprop",
|
|
|
+ ]`,
|
|
|
+ }),
|
|
|
+ MakeBazelTarget("cc_sysprop_library_static", "foo_cc_sysprop_library_static", AttrNameToString{
|
|
|
+ "dep": `":foo_sysprop_library"`,
|
|
|
+ "min_sdk_version": `"5"`,
|
|
|
+ }),
|
|
|
+ MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
|
|
|
+ "srcs": `["blah.cpp"]`,
|
|
|
+ "local_includes": `["."]`,
|
|
|
+ "min_sdk_version": `"5"`,
|
|
|
+ "whole_archive_deps": `[":foo_cc_sysprop_library_static"]`,
|
|
|
+ }),
|
|
|
+ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
|
|
|
+ "srcs": `["blah.cpp"]`,
|
|
|
+ "local_includes": `["."]`,
|
|
|
+ "min_sdk_version": `"5"`,
|
|
|
+ "whole_archive_deps": `[":foo_cc_sysprop_library_static"]`,
|
|
|
+ }),
|
|
|
+ },
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+func TestCcLibraryWithSyspropSrcsSomeConfigs(t *testing.T) {
|
|
|
+ runCcLibraryTestCase(t, Bp2buildTestCase{
|
|
|
+ Description: "cc_library with sysprop sources in some configs but not others",
|
|
|
+ ModuleTypeUnderTest: "cc_library",
|
|
|
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
|
|
|
+ Blueprint: `
|
|
|
+cc_library {
|
|
|
+ name: "foo",
|
|
|
+ host_supported: true,
|
|
|
+ srcs: [
|
|
|
+ "blah.cpp",
|
|
|
+ ],
|
|
|
+ target: {
|
|
|
+ android: {
|
|
|
+ srcs: ["bar.sysprop"],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ min_sdk_version: "5",
|
|
|
+}`,
|
|
|
+ ExpectedBazelTargets: []string{
|
|
|
+ MakeBazelTargetNoRestrictions("sysprop_library", "foo_sysprop_library", AttrNameToString{
|
|
|
+ "srcs": `select({
|
|
|
+ "//build/bazel/platforms/os:android": ["bar.sysprop"],
|
|
|
+ "//conditions:default": [],
|
|
|
+ })`,
|
|
|
+ }),
|
|
|
+ MakeBazelTargetNoRestrictions("cc_sysprop_library_static", "foo_cc_sysprop_library_static", AttrNameToString{
|
|
|
+ "dep": `":foo_sysprop_library"`,
|
|
|
+ "min_sdk_version": `"5"`,
|
|
|
+ }),
|
|
|
+ MakeBazelTargetNoRestrictions("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
|
|
|
+ "srcs": `["blah.cpp"]`,
|
|
|
+ "local_includes": `["."]`,
|
|
|
+ "min_sdk_version": `"5"`,
|
|
|
+ "whole_archive_deps": `select({
|
|
|
+ "//build/bazel/platforms/os:android": [":foo_cc_sysprop_library_static"],
|
|
|
+ "//conditions:default": [],
|
|
|
+ })`,
|
|
|
+ }),
|
|
|
+ MakeBazelTargetNoRestrictions("cc_library_shared", "foo", AttrNameToString{
|
|
|
+ "srcs": `["blah.cpp"]`,
|
|
|
+ "local_includes": `["."]`,
|
|
|
+ "min_sdk_version": `"5"`,
|
|
|
+ "whole_archive_deps": `select({
|
|
|
+ "//build/bazel/platforms/os:android": [":foo_cc_sysprop_library_static"],
|
|
|
+ "//conditions:default": [],
|
|
|
+ })`,
|
|
|
+ }),
|
|
|
+ },
|
|
|
+ })
|
|
|
+}
|