2021-09-01 23:22:09 +02:00
|
|
|
// Copyright 2021 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package bp2build
|
|
|
|
|
|
|
|
import (
|
2021-09-17 13:38:09 +02:00
|
|
|
"fmt"
|
2021-09-01 23:22:09 +02:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"android/soong/android"
|
|
|
|
"android/soong/cc"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// See cc/testing.go for more context
|
|
|
|
// TODO(alexmarquez): Split out the preamble into common code?
|
|
|
|
soongCcLibrarySharedPreamble = soongCcLibraryStaticPreamble
|
|
|
|
)
|
|
|
|
|
|
|
|
func registerCcLibrarySharedModuleTypes(ctx android.RegistrationContext) {
|
|
|
|
cc.RegisterCCBuildComponents(ctx)
|
|
|
|
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
|
|
|
|
ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory)
|
2021-09-28 15:19:17 +02:00
|
|
|
ctx.RegisterModuleType("cc_library", cc.LibraryFactory)
|
2021-09-01 23:22:09 +02:00
|
|
|
}
|
|
|
|
|
2022-06-21 21:28:33 +02:00
|
|
|
func runCcLibrarySharedTestCase(t *testing.T, tc Bp2buildTestCase) {
|
2021-09-01 23:22:09 +02:00
|
|
|
t.Helper()
|
2022-06-21 21:28:33 +02:00
|
|
|
(&tc).ModuleTypeUnderTest = "cc_library_shared"
|
|
|
|
(&tc).ModuleTypeUnderTestFactory = cc.LibrarySharedFactory
|
|
|
|
RunBp2BuildTestCase(t, registerCcLibrarySharedModuleTypes, tc)
|
2021-09-01 23:22:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcLibrarySharedSimple(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared simple overall test",
|
|
|
|
Filesystem: map[string]string{
|
2021-09-01 23:22:09 +02:00
|
|
|
// NOTE: include_dir headers *should not* appear in Bazel hdrs later (?)
|
|
|
|
"include_dir_1/include_dir_1_a.h": "",
|
|
|
|
"include_dir_1/include_dir_1_b.h": "",
|
|
|
|
"include_dir_2/include_dir_2_a.h": "",
|
|
|
|
"include_dir_2/include_dir_2_b.h": "",
|
|
|
|
// NOTE: local_include_dir headers *should not* appear in Bazel hdrs later (?)
|
|
|
|
"local_include_dir_1/local_include_dir_1_a.h": "",
|
|
|
|
"local_include_dir_1/local_include_dir_1_b.h": "",
|
|
|
|
"local_include_dir_2/local_include_dir_2_a.h": "",
|
|
|
|
"local_include_dir_2/local_include_dir_2_b.h": "",
|
|
|
|
// NOTE: export_include_dir headers *should* appear in Bazel hdrs later
|
|
|
|
"export_include_dir_1/export_include_dir_1_a.h": "",
|
|
|
|
"export_include_dir_1/export_include_dir_1_b.h": "",
|
|
|
|
"export_include_dir_2/export_include_dir_2_a.h": "",
|
|
|
|
"export_include_dir_2/export_include_dir_2_b.h": "",
|
|
|
|
// NOTE: Soong implicitly includes headers in the current directory
|
|
|
|
"implicit_include_1.h": "",
|
|
|
|
"implicit_include_2.h": "",
|
|
|
|
},
|
2022-06-21 21:28:33 +02:00
|
|
|
Blueprint: soongCcLibrarySharedPreamble + `
|
2021-09-01 23:22:09 +02:00
|
|
|
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_shared {
|
|
|
|
name: "shared_lib_1",
|
|
|
|
srcs: ["shared_lib_1.cc"],
|
|
|
|
bazel_module: { bp2build_available: false },
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library_shared {
|
|
|
|
name: "shared_lib_2",
|
|
|
|
srcs: ["shared_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_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
srcs: [
|
|
|
|
"foo_shared1.cc",
|
|
|
|
"foo_shared2.cc",
|
|
|
|
],
|
|
|
|
cflags: [
|
|
|
|
"-Dflag1",
|
|
|
|
"-Dflag2"
|
|
|
|
],
|
|
|
|
shared_libs: [
|
|
|
|
"shared_lib_1",
|
|
|
|
"shared_lib_2"
|
|
|
|
],
|
|
|
|
whole_static_libs: [
|
|
|
|
"whole_static_lib_1",
|
|
|
|
"whole_static_lib_2"
|
|
|
|
],
|
|
|
|
include_dirs: [
|
|
|
|
"include_dir_1",
|
|
|
|
"include_dir_2",
|
|
|
|
],
|
|
|
|
local_include_dirs: [
|
|
|
|
"local_include_dir_1",
|
|
|
|
"local_include_dir_2",
|
|
|
|
],
|
|
|
|
export_include_dirs: [
|
|
|
|
"export_include_dir_1",
|
|
|
|
"export_include_dir_2"
|
|
|
|
],
|
|
|
|
header_libs: [
|
|
|
|
"header_lib_1",
|
|
|
|
"header_lib_2"
|
|
|
|
],
|
2022-03-02 00:44:08 +01:00
|
|
|
sdk_version: "current",
|
|
|
|
min_sdk_version: "29",
|
2021-09-01 23:22:09 +02:00
|
|
|
|
|
|
|
// TODO: Also support export_header_lib_headers
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2021-11-08 18:56:31 +01:00
|
|
|
"absolute_includes": `[
|
2021-09-01 23:22:09 +02:00
|
|
|
"include_dir_1",
|
|
|
|
"include_dir_2",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
|
|
|
"copts": `[
|
2021-09-01 23:22:09 +02:00
|
|
|
"-Dflag1",
|
|
|
|
"-Dflag2",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
|
|
|
"export_includes": `[
|
2021-09-01 23:22:09 +02:00
|
|
|
"export_include_dir_1",
|
|
|
|
"export_include_dir_2",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
|
|
|
"implementation_deps": `[
|
2021-09-01 23:22:09 +02:00
|
|
|
":header_lib_1",
|
|
|
|
":header_lib_2",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
|
|
|
"implementation_dynamic_deps": `[
|
2021-09-22 21:52:58 +02:00
|
|
|
":shared_lib_1",
|
|
|
|
":shared_lib_2",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
|
|
|
"local_includes": `[
|
2021-09-01 23:22:09 +02:00
|
|
|
"local_include_dir_1",
|
|
|
|
"local_include_dir_2",
|
|
|
|
".",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
|
|
|
"srcs": `[
|
2021-09-01 23:22:09 +02:00
|
|
|
"foo_shared1.cc",
|
|
|
|
"foo_shared2.cc",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
|
|
|
"whole_archive_deps": `[
|
2021-09-01 23:22:09 +02:00
|
|
|
":whole_static_lib_1",
|
|
|
|
":whole_static_lib_2",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
2022-04-21 17:19:27 +02:00
|
|
|
"sdk_version": `"current"`,
|
|
|
|
"min_sdk_version": `"29"`,
|
2021-11-08 18:56:31 +01:00
|
|
|
}),
|
|
|
|
},
|
2021-09-01 23:22:09 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcLibrarySharedArchSpecificSharedLib(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared arch-specific shared_libs with whole_static_libs",
|
|
|
|
Filesystem: map[string]string{},
|
|
|
|
Blueprint: soongCcLibrarySharedPreamble + `
|
2021-09-01 23:22:09 +02:00
|
|
|
cc_library_static {
|
|
|
|
name: "static_dep",
|
|
|
|
bazel_module: { bp2build_available: false },
|
|
|
|
}
|
|
|
|
cc_library_shared {
|
|
|
|
name: "shared_dep",
|
|
|
|
bazel_module: { bp2build_available: false },
|
|
|
|
}
|
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
arch: { arm64: { shared_libs: ["shared_dep"], whole_static_libs: ["static_dep"] } },
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2021-11-08 18:56:31 +01:00
|
|
|
"implementation_dynamic_deps": `select({
|
2021-09-01 23:22:09 +02:00
|
|
|
"//build/bazel/platforms/arch:arm64": [":shared_dep"],
|
|
|
|
"//conditions:default": [],
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
"whole_archive_deps": `select({
|
2021-09-01 23:22:09 +02:00
|
|
|
"//build/bazel/platforms/arch:arm64": [":static_dep"],
|
|
|
|
"//conditions:default": [],
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
}),
|
|
|
|
},
|
2021-09-01 23:22:09 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcLibrarySharedOsSpecificSharedLib(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared os-specific shared_libs",
|
|
|
|
Filesystem: map[string]string{},
|
|
|
|
Blueprint: soongCcLibrarySharedPreamble + `
|
2021-09-01 23:22:09 +02:00
|
|
|
cc_library_shared {
|
|
|
|
name: "shared_dep",
|
|
|
|
bazel_module: { bp2build_available: false },
|
|
|
|
}
|
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
target: { android: { shared_libs: ["shared_dep"], } },
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2021-11-08 18:56:31 +01:00
|
|
|
"implementation_dynamic_deps": `select({
|
2021-09-01 23:22:09 +02:00
|
|
|
"//build/bazel/platforms/os:android": [":shared_dep"],
|
|
|
|
"//conditions:default": [],
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
}),
|
|
|
|
},
|
2021-09-01 23:22:09 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcLibrarySharedBaseArchOsSpecificSharedLib(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared base, arch, and os-specific shared_libs",
|
|
|
|
Filesystem: map[string]string{},
|
|
|
|
Blueprint: soongCcLibrarySharedPreamble + `
|
2021-09-01 23:22:09 +02:00
|
|
|
cc_library_shared {
|
|
|
|
name: "shared_dep",
|
|
|
|
bazel_module: { bp2build_available: false },
|
|
|
|
}
|
|
|
|
cc_library_shared {
|
|
|
|
name: "shared_dep2",
|
|
|
|
bazel_module: { bp2build_available: false },
|
|
|
|
}
|
|
|
|
cc_library_shared {
|
|
|
|
name: "shared_dep3",
|
|
|
|
bazel_module: { bp2build_available: false },
|
|
|
|
}
|
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
shared_libs: ["shared_dep"],
|
|
|
|
target: { android: { shared_libs: ["shared_dep2"] } },
|
|
|
|
arch: { arm64: { shared_libs: ["shared_dep3"] } },
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2021-11-08 18:56:31 +01:00
|
|
|
"implementation_dynamic_deps": `[":shared_dep"] + select({
|
2021-09-01 23:22:09 +02:00
|
|
|
"//build/bazel/platforms/arch:arm64": [":shared_dep3"],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}) + select({
|
|
|
|
"//build/bazel/platforms/os:android": [":shared_dep2"],
|
|
|
|
"//conditions:default": [],
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
}),
|
|
|
|
},
|
2021-09-01 23:22:09 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcLibrarySharedSimpleExcludeSrcs(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared simple exclude_srcs",
|
|
|
|
Filesystem: map[string]string{
|
2021-09-01 23:22:09 +02:00
|
|
|
"common.c": "",
|
|
|
|
"foo-a.c": "",
|
|
|
|
"foo-excluded.c": "",
|
|
|
|
},
|
2022-06-21 21:28:33 +02:00
|
|
|
Blueprint: soongCcLibrarySharedPreamble + `
|
2021-09-01 23:22:09 +02:00
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
srcs: ["common.c", "foo-*.c"],
|
|
|
|
exclude_srcs: ["foo-excluded.c"],
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2021-11-08 18:56:31 +01:00
|
|
|
"srcs_c": `[
|
2021-09-01 23:22:09 +02:00
|
|
|
"common.c",
|
|
|
|
"foo-a.c",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
|
|
|
}),
|
|
|
|
},
|
2021-09-01 23:22:09 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcLibrarySharedStrip(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared stripping",
|
|
|
|
Filesystem: map[string]string{},
|
|
|
|
Blueprint: soongCcLibrarySharedPreamble + `
|
2021-09-01 23:22:09 +02:00
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
strip: {
|
|
|
|
keep_symbols: false,
|
|
|
|
keep_symbols_and_debug_frame: true,
|
|
|
|
keep_symbols_list: ["sym", "sym2"],
|
|
|
|
all: true,
|
|
|
|
none: false,
|
|
|
|
},
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2021-11-08 18:56:31 +01:00
|
|
|
"strip": `{
|
2021-09-01 23:22:09 +02:00
|
|
|
"all": True,
|
|
|
|
"keep_symbols": False,
|
|
|
|
"keep_symbols_and_debug_frame": True,
|
|
|
|
"keep_symbols_list": [
|
|
|
|
"sym",
|
|
|
|
"sym2",
|
|
|
|
],
|
|
|
|
"none": False,
|
2021-11-08 18:56:31 +01:00
|
|
|
}`,
|
|
|
|
}),
|
|
|
|
},
|
2021-09-01 23:22:09 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-09-27 03:46:01 +02:00
|
|
|
func TestCcLibrarySharedVersionScriptAndDynamicList(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
2022-09-27 03:46:01 +02:00
|
|
|
Description: "cc_library_shared version script and dynamic list",
|
2022-06-21 21:28:33 +02:00
|
|
|
Filesystem: map[string]string{
|
2021-09-01 23:22:09 +02:00
|
|
|
"version_script": "",
|
2022-09-27 03:46:01 +02:00
|
|
|
"dynamic.list": "",
|
2021-09-01 23:22:09 +02:00
|
|
|
},
|
2022-06-21 21:28:33 +02:00
|
|
|
Blueprint: soongCcLibrarySharedPreamble + `
|
2021-09-01 23:22:09 +02:00
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
version_script: "version_script",
|
2022-09-27 03:46:01 +02:00
|
|
|
dynamic_list: "dynamic.list",
|
2021-09-01 23:22:09 +02:00
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2022-09-27 03:46:01 +02:00
|
|
|
"additional_linker_inputs": `[
|
|
|
|
"version_script",
|
|
|
|
"dynamic.list",
|
|
|
|
]`,
|
|
|
|
"linkopts": `[
|
|
|
|
"-Wl,--version-script,$(location version_script)",
|
|
|
|
"-Wl,--dynamic-list,$(location dynamic.list)",
|
|
|
|
]`,
|
2021-11-08 18:56:31 +01:00
|
|
|
}),
|
|
|
|
},
|
2021-09-01 23:22:09 +02:00
|
|
|
})
|
|
|
|
}
|
2021-09-17 13:38:09 +02:00
|
|
|
|
2022-09-20 20:58:01 +02:00
|
|
|
func TestCcLibraryLdflagsSplitBySpaceSoongAdded(t *testing.T) {
|
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "ldflags are split by spaces except for the ones added by soong (version script and dynamic list)",
|
|
|
|
Filesystem: map[string]string{
|
|
|
|
"version_script": "",
|
|
|
|
"dynamic.list": "",
|
|
|
|
},
|
|
|
|
Blueprint: `
|
|
|
|
cc_library_shared {
|
|
|
|
name: "foo",
|
|
|
|
ldflags: [
|
|
|
|
"--nospace_flag",
|
|
|
|
"-z spaceflag",
|
|
|
|
],
|
|
|
|
version_script: "version_script",
|
|
|
|
dynamic_list: "dynamic.list",
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
|
|
|
ExpectedBazelTargets: []string{
|
|
|
|
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
|
|
|
|
"additional_linker_inputs": `[
|
|
|
|
"version_script",
|
|
|
|
"dynamic.list",
|
|
|
|
]`,
|
|
|
|
"linkopts": `[
|
|
|
|
"--nospace_flag",
|
|
|
|
"-z",
|
|
|
|
"spaceflag",
|
|
|
|
"-Wl,--version-script,$(location version_script)",
|
|
|
|
"-Wl,--dynamic-list,$(location dynamic.list)",
|
|
|
|
]`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-09-17 13:38:09 +02:00
|
|
|
func TestCcLibrarySharedNoCrtTrue(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared - nocrt: true emits attribute",
|
|
|
|
Filesystem: map[string]string{
|
2021-09-17 13:38:09 +02:00
|
|
|
"impl.cpp": "",
|
|
|
|
},
|
2022-06-21 21:28:33 +02:00
|
|
|
Blueprint: soongCcLibraryPreamble + `
|
2021-09-17 13:38:09 +02:00
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
srcs: ["impl.cpp"],
|
|
|
|
nocrt: true,
|
|
|
|
include_build_directory: false,
|
|
|
|
}
|
|
|
|
`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2021-11-08 18:56:31 +01:00
|
|
|
"link_crt": `False`,
|
|
|
|
"srcs": `["impl.cpp"]`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
2021-09-17 13:38:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcLibrarySharedNoCrtFalse(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared - nocrt: false doesn't emit attribute",
|
|
|
|
Filesystem: map[string]string{
|
2021-09-17 13:38:09 +02:00
|
|
|
"impl.cpp": "",
|
|
|
|
},
|
2022-06-21 21:28:33 +02:00
|
|
|
Blueprint: soongCcLibraryPreamble + `
|
2021-09-17 13:38:09 +02:00
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
srcs: ["impl.cpp"],
|
|
|
|
nocrt: false,
|
|
|
|
include_build_directory: false,
|
|
|
|
}
|
|
|
|
`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2021-11-08 18:56:31 +01:00
|
|
|
"srcs": `["impl.cpp"]`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
2021-09-17 13:38:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcLibrarySharedNoCrtArchVariant(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared - nocrt in select",
|
|
|
|
Filesystem: map[string]string{
|
2021-09-17 13:38:09 +02:00
|
|
|
"impl.cpp": "",
|
|
|
|
},
|
2022-06-21 21:28:33 +02:00
|
|
|
Blueprint: soongCcLibraryPreamble + `
|
2021-09-17 13:38:09 +02:00
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
srcs: ["impl.cpp"],
|
|
|
|
arch: {
|
|
|
|
arm: {
|
|
|
|
nocrt: true,
|
|
|
|
},
|
|
|
|
x86: {
|
|
|
|
nocrt: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
include_build_directory: false,
|
|
|
|
}
|
|
|
|
`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedErr: fmt.Errorf("module \"foo_shared\": nocrt is not supported for arch variants"),
|
2021-09-17 13:38:09 +02:00
|
|
|
})
|
|
|
|
}
|
2021-09-28 15:19:17 +02:00
|
|
|
|
|
|
|
func TestCcLibrarySharedProto(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Blueprint: soongCcProtoPreamble + `cc_library_shared {
|
2021-09-28 15:19:17 +02:00
|
|
|
name: "foo",
|
|
|
|
srcs: ["foo.proto"],
|
|
|
|
proto: {
|
|
|
|
export_proto_headers: true,
|
|
|
|
},
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("proto_library", "foo_proto", AttrNameToString{
|
2021-09-28 15:19:17 +02:00
|
|
|
"srcs": `["foo.proto"]`,
|
2022-08-31 20:28:19 +02:00
|
|
|
}), MakeBazelTarget("cc_lite_proto_library", "foo_cc_proto_lite", AttrNameToString{
|
2021-09-28 15:19:17 +02:00
|
|
|
"deps": `[":foo_proto"]`,
|
2022-08-31 20:28:19 +02:00
|
|
|
}), MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
|
2021-09-28 15:19:17 +02:00
|
|
|
"dynamic_deps": `[":libprotobuf-cpp-lite"]`,
|
|
|
|
"whole_archive_deps": `[":foo_cc_proto_lite"]`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
2021-12-10 13:22:53 +01:00
|
|
|
|
|
|
|
func TestCcLibrarySharedUseVersionLib(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
2022-09-16 15:01:29 +02:00
|
|
|
Filesystem: map[string]string{
|
|
|
|
soongCcVersionLibBpPath: soongCcVersionLibBp,
|
|
|
|
},
|
2022-06-21 21:28:33 +02:00
|
|
|
Blueprint: soongCcProtoPreamble + `cc_library_shared {
|
2021-12-10 13:22:53 +01:00
|
|
|
name: "foo",
|
|
|
|
use_version_lib: true,
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
|
2022-09-16 15:01:29 +02:00
|
|
|
"use_version_lib": "True",
|
|
|
|
"implementation_whole_archive_deps": `["//build/soong/cc/libbuildversion:libbuildversion"]`,
|
2021-12-10 13:22:53 +01:00
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
2022-01-07 15:55:29 +01:00
|
|
|
|
|
|
|
func TestCcLibrarySharedStubs(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared stubs",
|
|
|
|
ModuleTypeUnderTest: "cc_library_shared",
|
|
|
|
ModuleTypeUnderTestFactory: cc.LibrarySharedFactory,
|
|
|
|
Dir: "foo/bar",
|
|
|
|
Filesystem: map[string]string{
|
2022-01-07 15:55:29 +01:00
|
|
|
"foo/bar/Android.bp": `
|
|
|
|
cc_library_shared {
|
|
|
|
name: "a",
|
|
|
|
stubs: { symbol_file: "a.map.txt", versions: ["28", "29", "current"] },
|
|
|
|
bazel_module: { bp2build_available: true },
|
|
|
|
include_build_directory: false,
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
},
|
2022-06-21 21:28:33 +02:00
|
|
|
Blueprint: soongCcLibraryPreamble,
|
2022-09-21 01:04:39 +02:00
|
|
|
ExpectedBazelTargets: []string{makeCcStubSuiteTargets("a", AttrNameToString{
|
|
|
|
"soname": `"a.so"`,
|
|
|
|
"source_library": `":a"`,
|
|
|
|
"stubs_symbol_file": `"a.map.txt"`,
|
|
|
|
"stubs_versions": `[
|
2022-09-16 17:36:10 +02:00
|
|
|
"28",
|
|
|
|
"29",
|
|
|
|
"current",
|
|
|
|
]`,
|
2022-09-21 01:04:39 +02:00
|
|
|
}),
|
|
|
|
MakeBazelTarget("cc_library_shared", "a", AttrNameToString{
|
|
|
|
"has_stubs": `True`,
|
2022-09-16 17:36:10 +02:00
|
|
|
}),
|
2022-01-07 15:55:29 +01:00
|
|
|
},
|
2022-09-21 01:04:39 +02:00
|
|
|
})
|
2022-01-07 15:55:29 +01:00
|
|
|
}
|
2022-04-21 17:19:27 +02:00
|
|
|
|
|
|
|
func TestCcLibrarySharedSystemSharedLibsSharedEmpty(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared system_shared_libs empty shared default",
|
|
|
|
ModuleTypeUnderTest: "cc_library_shared",
|
|
|
|
ModuleTypeUnderTestFactory: cc.LibrarySharedFactory,
|
|
|
|
Blueprint: soongCcLibrarySharedPreamble + `
|
2022-04-21 17:19:27 +02:00
|
|
|
cc_defaults {
|
|
|
|
name: "empty_defaults",
|
|
|
|
shared: {
|
|
|
|
system_shared_libs: [],
|
|
|
|
},
|
|
|
|
include_build_directory: false,
|
|
|
|
}
|
|
|
|
cc_library_shared {
|
|
|
|
name: "empty",
|
|
|
|
defaults: ["empty_defaults"],
|
|
|
|
}
|
|
|
|
`,
|
2022-08-31 20:28:19 +02:00
|
|
|
ExpectedBazelTargets: []string{MakeBazelTarget("cc_library_shared", "empty", AttrNameToString{
|
2022-04-21 17:19:27 +02:00
|
|
|
"system_dynamic_deps": "[]",
|
|
|
|
})},
|
|
|
|
})
|
|
|
|
}
|
2022-05-13 22:55:35 +02:00
|
|
|
|
|
|
|
func TestCcLibrarySharedConvertLex(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared with lex files",
|
|
|
|
ModuleTypeUnderTest: "cc_library_shared",
|
|
|
|
ModuleTypeUnderTestFactory: cc.LibrarySharedFactory,
|
|
|
|
Filesystem: map[string]string{
|
2022-05-13 22:55:35 +02:00
|
|
|
"foo.c": "",
|
|
|
|
"bar.cc": "",
|
|
|
|
"foo1.l": "",
|
|
|
|
"bar1.ll": "",
|
|
|
|
"foo2.l": "",
|
|
|
|
"bar2.ll": "",
|
|
|
|
},
|
2022-06-21 21:28:33 +02:00
|
|
|
Blueprint: `cc_library_shared {
|
2022-05-13 22:55:35 +02:00
|
|
|
name: "foo_lib",
|
|
|
|
srcs: ["foo.c", "bar.cc", "foo1.l", "foo2.l", "bar1.ll", "bar2.ll"],
|
|
|
|
lex: { flags: ["--foo_flags"] },
|
|
|
|
include_build_directory: false,
|
|
|
|
bazel_module: { bp2build_available: true },
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("genlex", "foo_lib_genlex_l", AttrNameToString{
|
2022-05-13 22:55:35 +02:00
|
|
|
"srcs": `[
|
|
|
|
"foo1.l",
|
|
|
|
"foo2.l",
|
|
|
|
]`,
|
|
|
|
"lexopts": `["--foo_flags"]`,
|
|
|
|
}),
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("genlex", "foo_lib_genlex_ll", AttrNameToString{
|
2022-05-13 22:55:35 +02:00
|
|
|
"srcs": `[
|
|
|
|
"bar1.ll",
|
|
|
|
"bar2.ll",
|
|
|
|
]`,
|
|
|
|
"lexopts": `["--foo_flags"]`,
|
|
|
|
}),
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_lib", AttrNameToString{
|
2022-05-13 22:55:35 +02:00
|
|
|
"srcs": `[
|
|
|
|
"bar.cc",
|
|
|
|
":foo_lib_genlex_ll",
|
|
|
|
]`,
|
|
|
|
"srcs_c": `[
|
|
|
|
"foo.c",
|
|
|
|
":foo_lib_genlex_l",
|
|
|
|
]`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
2022-05-17 00:56:04 +02:00
|
|
|
|
|
|
|
func TestCcLibrarySharedClangUnknownFlags(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Blueprint: soongCcProtoPreamble + `cc_library_shared {
|
2022-05-17 00:56:04 +02:00
|
|
|
name: "foo",
|
|
|
|
conlyflags: ["-a", "-finline-functions"],
|
|
|
|
cflags: ["-b","-finline-functions"],
|
|
|
|
cppflags: ["-c", "-finline-functions"],
|
|
|
|
ldflags: ["-d","-finline-functions", "-e"],
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
|
2022-05-17 00:56:04 +02:00
|
|
|
"conlyflags": `["-a"]`,
|
|
|
|
"copts": `["-b"]`,
|
|
|
|
"cppflags": `["-c"]`,
|
|
|
|
"linkopts": `[
|
|
|
|
"-d",
|
|
|
|
"-e",
|
|
|
|
]`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCCLibraryFlagSpaceSplitting(t *testing.T) {
|
2022-06-21 21:28:33 +02:00
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Blueprint: soongCcProtoPreamble + `cc_library_shared {
|
2022-05-17 00:56:04 +02:00
|
|
|
name: "foo",
|
|
|
|
conlyflags: [ "-include header.h"],
|
|
|
|
cflags: ["-include header.h"],
|
|
|
|
cppflags: ["-include header.h"],
|
|
|
|
version_script: "version_script",
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
2022-06-21 21:28:33 +02:00
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
|
2022-05-17 00:56:04 +02:00
|
|
|
"additional_linker_inputs": `["version_script"]`,
|
|
|
|
"conlyflags": `[
|
|
|
|
"-include",
|
|
|
|
"header.h",
|
|
|
|
]`,
|
|
|
|
"copts": `[
|
|
|
|
"-include",
|
|
|
|
"header.h",
|
|
|
|
]`,
|
|
|
|
"cppflags": `[
|
|
|
|
"-include",
|
|
|
|
"header.h",
|
|
|
|
]`,
|
|
|
|
"linkopts": `["-Wl,--version-script,$(location version_script)"]`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
2022-08-09 18:50:56 +02:00
|
|
|
|
|
|
|
func TestCCLibrarySharedRuntimeDeps(t *testing.T) {
|
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Blueprint: `cc_library_shared {
|
|
|
|
name: "bar",
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_library_shared {
|
|
|
|
name: "foo",
|
|
|
|
runtime_libs: ["foo"],
|
|
|
|
}`,
|
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "bar", AttrNameToString{
|
2022-08-09 18:50:56 +02:00
|
|
|
"local_includes": `["."]`,
|
|
|
|
}),
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
|
2022-08-09 18:50:56 +02:00
|
|
|
"runtime_deps": `[":foo"]`,
|
|
|
|
"local_includes": `["."]`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
2022-02-24 00:39:59 +01:00
|
|
|
|
|
|
|
func TestCcLibrarySharedEmptySuffix(t *testing.T) {
|
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared with empty suffix",
|
|
|
|
Filesystem: map[string]string{
|
|
|
|
"foo.c": "",
|
|
|
|
},
|
|
|
|
Blueprint: soongCcLibrarySharedPreamble + `
|
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
suffix: "",
|
|
|
|
srcs: ["foo.c"],
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2022-02-24 00:39:59 +01:00
|
|
|
"srcs_c": `["foo.c"]`,
|
|
|
|
"suffix": `""`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcLibrarySharedSuffix(t *testing.T) {
|
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared with suffix",
|
|
|
|
Filesystem: map[string]string{
|
|
|
|
"foo.c": "",
|
|
|
|
},
|
|
|
|
Blueprint: soongCcLibrarySharedPreamble + `
|
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
suffix: "-suf",
|
|
|
|
srcs: ["foo.c"],
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2022-02-24 00:39:59 +01:00
|
|
|
"srcs_c": `["foo.c"]`,
|
|
|
|
"suffix": `"-suf"`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcLibrarySharedArchVariantSuffix(t *testing.T) {
|
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared with arch-variant suffix",
|
|
|
|
Filesystem: map[string]string{
|
|
|
|
"foo.c": "",
|
|
|
|
},
|
|
|
|
Blueprint: soongCcLibrarySharedPreamble + `
|
|
|
|
cc_library_shared {
|
|
|
|
name: "foo_shared",
|
|
|
|
arch: {
|
|
|
|
arm64: { suffix: "-64" },
|
|
|
|
arm: { suffix: "-32" },
|
|
|
|
},
|
|
|
|
srcs: ["foo.c"],
|
|
|
|
include_build_directory: false,
|
|
|
|
}`,
|
|
|
|
ExpectedBazelTargets: []string{
|
2022-08-31 20:28:19 +02:00
|
|
|
MakeBazelTarget("cc_library_shared", "foo_shared", AttrNameToString{
|
2022-02-24 00:39:59 +01:00
|
|
|
"srcs_c": `["foo.c"]`,
|
|
|
|
"suffix": `select({
|
|
|
|
"//build/bazel/platforms/arch:arm": "-32",
|
|
|
|
"//build/bazel/platforms/arch:arm64": "-64",
|
|
|
|
"//conditions:default": None,
|
|
|
|
})`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
2022-09-06 21:31:25 +02:00
|
|
|
|
|
|
|
func TestCcLibrarySharedWithSyspropSrcs(t *testing.T) {
|
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared with sysprop sources",
|
|
|
|
Blueprint: `
|
|
|
|
cc_library_shared {
|
|
|
|
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_shared", "foo", AttrNameToString{
|
|
|
|
"srcs": `["blah.cpp"]`,
|
|
|
|
"local_includes": `["."]`,
|
|
|
|
"min_sdk_version": `"5"`,
|
|
|
|
"whole_archive_deps": `[":foo_cc_sysprop_library_static"]`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcLibrarySharedWithSyspropSrcsSomeConfigs(t *testing.T) {
|
|
|
|
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
|
|
|
|
Description: "cc_library_shared with sysprop sources in some configs but not others",
|
|
|
|
Blueprint: `
|
|
|
|
cc_library_shared {
|
|
|
|
name: "foo",
|
|
|
|
srcs: [
|
|
|
|
"blah.cpp",
|
|
|
|
],
|
|
|
|
target: {
|
|
|
|
android: {
|
|
|
|
srcs: ["bar.sysprop"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
min_sdk_version: "5",
|
|
|
|
}`,
|
|
|
|
ExpectedBazelTargets: []string{
|
|
|
|
MakeBazelTarget("sysprop_library", "foo_sysprop_library", AttrNameToString{
|
|
|
|
"srcs": `select({
|
|
|
|
"//build/bazel/platforms/os:android": ["bar.sysprop"],
|
|
|
|
"//conditions:default": [],
|
|
|
|
})`,
|
|
|
|
}),
|
|
|
|
MakeBazelTarget("cc_sysprop_library_static", "foo_cc_sysprop_library_static", AttrNameToString{
|
|
|
|
"dep": `":foo_sysprop_library"`,
|
|
|
|
"min_sdk_version": `"5"`,
|
|
|
|
}),
|
|
|
|
MakeBazelTarget("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": [],
|
|
|
|
})`,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|