2021-02-18 09:21:34 +01: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-05-21 09:37:00 +02:00
|
|
|
"testing"
|
|
|
|
|
2021-02-18 09:21:34 +01:00
|
|
|
"android/soong/android"
|
|
|
|
"android/soong/cc"
|
|
|
|
)
|
|
|
|
|
2021-05-21 09:37:00 +02:00
|
|
|
func registerCcObjectModuleTypes(ctx android.RegistrationContext) {
|
|
|
|
// Always register cc_defaults module factory
|
|
|
|
ctx.RegisterModuleType("cc_defaults", func() android.Module { return cc.DefaultsFactory() })
|
|
|
|
}
|
|
|
|
|
|
|
|
func runCcObjectTestCase(t *testing.T, tc bp2buildTestCase) {
|
2021-05-25 16:39:35 +02:00
|
|
|
t.Helper()
|
2021-11-08 18:56:31 +01:00
|
|
|
(&tc).moduleTypeUnderTest = "cc_object"
|
|
|
|
(&tc).moduleTypeUnderTestFactory = cc.ObjectFactory
|
2021-05-21 09:37:00 +02:00
|
|
|
runBp2BuildTestCase(t, registerCcObjectModuleTypes, tc)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcObjectSimple(t *testing.T) {
|
|
|
|
runCcObjectTestCase(t, bp2buildTestCase{
|
2021-11-08 18:56:31 +01:00
|
|
|
description: "simple cc_object generates cc_object with include header dep",
|
2021-05-21 09:37:00 +02:00
|
|
|
filesystem: map[string]string{
|
|
|
|
"a/b/foo.h": "",
|
|
|
|
"a/b/bar.h": "",
|
|
|
|
"a/b/exclude.c": "",
|
|
|
|
"a/b/c.c": "",
|
|
|
|
},
|
|
|
|
blueprint: `cc_object {
|
2021-02-18 09:21:34 +01:00
|
|
|
name: "foo",
|
|
|
|
local_include_dirs: ["include"],
|
2021-07-22 20:39:44 +02:00
|
|
|
system_shared_libs: [],
|
2021-02-18 09:21:34 +01:00
|
|
|
cflags: [
|
|
|
|
"-Wno-gcc-compat",
|
|
|
|
"-Wall",
|
|
|
|
"-Werror",
|
|
|
|
],
|
|
|
|
srcs: [
|
2021-02-23 06:46:47 +01:00
|
|
|
"a/b/*.c"
|
2021-02-18 09:21:34 +01:00
|
|
|
],
|
2021-02-23 06:46:47 +01:00
|
|
|
exclude_srcs: ["a/b/exclude.c"],
|
2021-02-18 09:21:34 +01:00
|
|
|
}
|
|
|
|
`,
|
2021-11-08 18:56:31 +01:00
|
|
|
expectedBazelTargets: []string{
|
|
|
|
makeBazelTarget("cc_object", "foo", attrNameToString{
|
|
|
|
"copts": `[
|
2021-02-18 09:21:34 +01:00
|
|
|
"-fno-addrsig",
|
|
|
|
"-Wno-gcc-compat",
|
|
|
|
"-Wall",
|
|
|
|
"-Werror",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
|
|
|
"local_includes": `[
|
2021-09-10 16:07:07 +02:00
|
|
|
"include",
|
|
|
|
".",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
|
|
|
"srcs": `["a/b/c.c"]`,
|
|
|
|
"system_dynamic_deps": `[]`,
|
|
|
|
}),
|
2021-02-18 09:21:34 +01:00
|
|
|
},
|
2021-05-21 09:37:00 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcObjectDefaults(t *testing.T) {
|
|
|
|
runCcObjectTestCase(t, bp2buildTestCase{
|
|
|
|
blueprint: `cc_object {
|
2021-02-18 09:21:34 +01:00
|
|
|
name: "foo",
|
2021-07-22 20:39:44 +02:00
|
|
|
system_shared_libs: [],
|
2021-02-18 09:21:34 +01:00
|
|
|
srcs: [
|
|
|
|
"a/b/*.h",
|
|
|
|
"a/b/c.c"
|
|
|
|
],
|
|
|
|
|
|
|
|
defaults: ["foo_defaults"],
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_defaults {
|
|
|
|
name: "foo_defaults",
|
|
|
|
defaults: ["foo_bar_defaults"],
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_defaults {
|
|
|
|
name: "foo_bar_defaults",
|
|
|
|
cflags: [
|
|
|
|
"-Werror",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
`,
|
2021-11-08 18:56:31 +01:00
|
|
|
expectedBazelTargets: []string{
|
|
|
|
makeBazelTarget("cc_object", "foo", attrNameToString{
|
|
|
|
"copts": `[
|
2021-02-18 09:21:34 +01:00
|
|
|
"-Werror",
|
|
|
|
"-fno-addrsig",
|
2021-11-08 18:56:31 +01:00
|
|
|
]`,
|
|
|
|
"local_includes": `["."]`,
|
|
|
|
"srcs": `["a/b/c.c"]`,
|
|
|
|
"system_dynamic_deps": `[]`,
|
|
|
|
}),
|
2021-05-21 09:37:00 +02:00
|
|
|
}})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcObjectCcObjetDepsInObjs(t *testing.T) {
|
|
|
|
runCcObjectTestCase(t, bp2buildTestCase{
|
2021-11-08 18:56:31 +01:00
|
|
|
description: "cc_object with cc_object deps in objs props",
|
2021-05-21 09:37:00 +02:00
|
|
|
filesystem: map[string]string{
|
|
|
|
"a/b/c.c": "",
|
|
|
|
"x/y/z.c": "",
|
2021-02-23 06:46:47 +01:00
|
|
|
},
|
2021-05-21 09:37:00 +02:00
|
|
|
blueprint: `cc_object {
|
2021-02-23 06:46:47 +01:00
|
|
|
name: "foo",
|
2021-07-22 20:39:44 +02:00
|
|
|
system_shared_libs: [],
|
2021-02-23 06:46:47 +01:00
|
|
|
srcs: ["a/b/c.c"],
|
|
|
|
objs: ["bar"],
|
2021-09-10 16:06:32 +02:00
|
|
|
include_build_directory: false,
|
2021-02-23 06:46:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_object {
|
|
|
|
name: "bar",
|
2021-07-22 20:39:44 +02:00
|
|
|
system_shared_libs: [],
|
2021-02-23 06:46:47 +01:00
|
|
|
srcs: ["x/y/z.c"],
|
2021-09-10 16:06:32 +02:00
|
|
|
include_build_directory: false,
|
2021-02-23 06:46:47 +01:00
|
|
|
}
|
|
|
|
`,
|
2021-11-08 18:56:31 +01:00
|
|
|
expectedBazelTargets: []string{
|
|
|
|
makeBazelTarget("cc_object", "bar", attrNameToString{
|
|
|
|
"copts": `["-fno-addrsig"]`,
|
|
|
|
"srcs": `["x/y/z.c"]`,
|
|
|
|
"system_dynamic_deps": `[]`,
|
|
|
|
}), makeBazelTarget("cc_object", "foo", attrNameToString{
|
|
|
|
"copts": `["-fno-addrsig"]`,
|
|
|
|
"deps": `[":bar"]`,
|
|
|
|
"srcs": `["a/b/c.c"]`,
|
|
|
|
"system_dynamic_deps": `[]`,
|
|
|
|
}),
|
2021-03-18 21:56:36 +01:00
|
|
|
},
|
2021-05-21 09:37:00 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcObjectIncludeBuildDirFalse(t *testing.T) {
|
|
|
|
runCcObjectTestCase(t, bp2buildTestCase{
|
2021-11-08 18:56:31 +01:00
|
|
|
description: "cc_object with include_build_dir: false",
|
2021-05-21 09:37:00 +02:00
|
|
|
filesystem: map[string]string{
|
|
|
|
"a/b/c.c": "",
|
|
|
|
"x/y/z.c": "",
|
|
|
|
},
|
|
|
|
blueprint: `cc_object {
|
2021-03-18 21:56:36 +01:00
|
|
|
name: "foo",
|
2021-07-22 20:39:44 +02:00
|
|
|
system_shared_libs: [],
|
2021-03-18 21:56:36 +01:00
|
|
|
srcs: ["a/b/c.c"],
|
|
|
|
include_build_directory: false,
|
|
|
|
}
|
|
|
|
`,
|
2021-11-08 18:56:31 +01:00
|
|
|
expectedBazelTargets: []string{
|
|
|
|
makeBazelTarget("cc_object", "foo", attrNameToString{
|
|
|
|
"copts": `["-fno-addrsig"]`,
|
|
|
|
"srcs": `["a/b/c.c"]`,
|
|
|
|
"system_dynamic_deps": `[]`,
|
|
|
|
}),
|
2021-03-24 15:14:47 +01:00
|
|
|
},
|
2021-05-21 09:37:00 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcObjectProductVariable(t *testing.T) {
|
|
|
|
runCcObjectTestCase(t, bp2buildTestCase{
|
2021-11-08 18:56:31 +01:00
|
|
|
description: "cc_object with product variable",
|
2021-05-21 09:37:00 +02:00
|
|
|
blueprint: `cc_object {
|
2021-03-24 15:14:47 +01:00
|
|
|
name: "foo",
|
2021-07-22 20:39:44 +02:00
|
|
|
system_shared_libs: [],
|
2021-03-24 15:14:47 +01:00
|
|
|
include_build_directory: false,
|
|
|
|
product_variables: {
|
|
|
|
platform_sdk_version: {
|
|
|
|
asflags: ["-DPLATFORM_SDK_VERSION=%d"],
|
|
|
|
},
|
|
|
|
},
|
2021-07-13 17:47:44 +02:00
|
|
|
srcs: ["src.S"],
|
2021-03-24 15:14:47 +01:00
|
|
|
}
|
|
|
|
`,
|
2021-11-08 18:56:31 +01:00
|
|
|
expectedBazelTargets: []string{
|
|
|
|
makeBazelTarget("cc_object", "foo", attrNameToString{
|
|
|
|
"asflags": `select({
|
2021-05-26 14:45:30 +02:00
|
|
|
"//build/bazel/product_variables:platform_sdk_version": ["-DPLATFORM_SDK_VERSION=$(Platform_sdk_version)"],
|
2021-05-06 19:54:29 +02:00
|
|
|
"//conditions:default": [],
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
"copts": `["-fno-addrsig"]`,
|
|
|
|
"srcs_as": `["src.S"]`,
|
|
|
|
"system_dynamic_deps": `[]`,
|
|
|
|
}),
|
2021-02-18 09:21:34 +01:00
|
|
|
},
|
2021-05-21 09:37:00 +02:00
|
|
|
})
|
2021-02-24 13:20:12 +01:00
|
|
|
}
|
|
|
|
|
2021-05-21 09:37:00 +02:00
|
|
|
func TestCcObjectCflagsOneArch(t *testing.T) {
|
|
|
|
runCcObjectTestCase(t, bp2buildTestCase{
|
2021-11-08 18:56:31 +01:00
|
|
|
description: "cc_object setting cflags for one arch",
|
2021-05-21 09:37:00 +02:00
|
|
|
blueprint: `cc_object {
|
2021-02-24 13:20:12 +01:00
|
|
|
name: "foo",
|
2021-07-22 20:39:44 +02:00
|
|
|
system_shared_libs: [],
|
2021-03-15 11:02:43 +01:00
|
|
|
srcs: ["a.cpp"],
|
2021-02-24 13:20:12 +01:00
|
|
|
arch: {
|
|
|
|
x86: {
|
2021-03-15 11:02:43 +01:00
|
|
|
cflags: ["-fPIC"], // string list
|
|
|
|
},
|
|
|
|
arm: {
|
2021-07-13 17:47:44 +02:00
|
|
|
srcs: ["arch/arm/file.cpp"], // label list
|
2021-02-24 13:20:12 +01:00
|
|
|
},
|
|
|
|
},
|
2021-09-10 16:06:32 +02:00
|
|
|
include_build_directory: false,
|
2021-02-24 13:20:12 +01:00
|
|
|
}
|
|
|
|
`,
|
2021-05-21 09:37:00 +02:00
|
|
|
expectedBazelTargets: []string{
|
2021-11-08 18:56:31 +01:00
|
|
|
makeBazelTarget("cc_object", "foo", attrNameToString{
|
|
|
|
"copts": `["-fno-addrsig"] + select({
|
2021-04-08 16:40:57 +02:00
|
|
|
"//build/bazel/platforms/arch:x86": ["-fPIC"],
|
2021-03-15 11:02:43 +01:00
|
|
|
"//conditions:default": [],
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
"srcs": `["a.cpp"] + select({
|
2021-07-13 17:47:44 +02:00
|
|
|
"//build/bazel/platforms/arch:arm": ["arch/arm/file.cpp"],
|
2021-03-15 11:02:43 +01:00
|
|
|
"//conditions:default": [],
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
"system_dynamic_deps": `[]`,
|
|
|
|
}),
|
2021-02-24 13:20:12 +01:00
|
|
|
},
|
2021-05-21 09:37:00 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcObjectCflagsFourArch(t *testing.T) {
|
|
|
|
runCcObjectTestCase(t, bp2buildTestCase{
|
2021-11-08 18:56:31 +01:00
|
|
|
description: "cc_object setting cflags for 4 architectures",
|
2021-05-21 09:37:00 +02:00
|
|
|
blueprint: `cc_object {
|
2021-02-24 13:20:12 +01:00
|
|
|
name: "foo",
|
2021-07-22 20:39:44 +02:00
|
|
|
system_shared_libs: [],
|
2021-03-15 11:02:43 +01:00
|
|
|
srcs: ["base.cpp"],
|
2021-02-24 13:20:12 +01:00
|
|
|
arch: {
|
|
|
|
x86: {
|
2021-03-15 11:02:43 +01:00
|
|
|
srcs: ["x86.cpp"],
|
2021-02-24 13:20:12 +01:00
|
|
|
cflags: ["-fPIC"],
|
|
|
|
},
|
|
|
|
x86_64: {
|
2021-03-15 11:02:43 +01:00
|
|
|
srcs: ["x86_64.cpp"],
|
2021-02-24 13:20:12 +01:00
|
|
|
cflags: ["-fPIC"],
|
|
|
|
},
|
|
|
|
arm: {
|
2021-03-15 11:02:43 +01:00
|
|
|
srcs: ["arm.cpp"],
|
2021-02-24 13:20:12 +01:00
|
|
|
cflags: ["-Wall"],
|
|
|
|
},
|
|
|
|
arm64: {
|
2021-03-15 11:02:43 +01:00
|
|
|
srcs: ["arm64.cpp"],
|
2021-02-24 13:20:12 +01:00
|
|
|
cflags: ["-Wall"],
|
|
|
|
},
|
|
|
|
},
|
2021-09-10 16:06:32 +02:00
|
|
|
include_build_directory: false,
|
2021-02-24 13:20:12 +01:00
|
|
|
}
|
|
|
|
`,
|
2021-05-21 09:37:00 +02:00
|
|
|
expectedBazelTargets: []string{
|
2021-11-08 18:56:31 +01:00
|
|
|
makeBazelTarget("cc_object", "foo", attrNameToString{
|
|
|
|
"copts": `["-fno-addrsig"] + select({
|
2021-04-08 16:40:57 +02:00
|
|
|
"//build/bazel/platforms/arch:arm": ["-Wall"],
|
|
|
|
"//build/bazel/platforms/arch:arm64": ["-Wall"],
|
|
|
|
"//build/bazel/platforms/arch:x86": ["-fPIC"],
|
|
|
|
"//build/bazel/platforms/arch:x86_64": ["-fPIC"],
|
2021-03-15 11:02:43 +01:00
|
|
|
"//conditions:default": [],
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
"srcs": `["base.cpp"] + select({
|
2021-04-08 16:40:57 +02:00
|
|
|
"//build/bazel/platforms/arch:arm": ["arm.cpp"],
|
|
|
|
"//build/bazel/platforms/arch:arm64": ["arm64.cpp"],
|
|
|
|
"//build/bazel/platforms/arch:x86": ["x86.cpp"],
|
|
|
|
"//build/bazel/platforms/arch:x86_64": ["x86_64.cpp"],
|
2021-03-15 11:02:43 +01:00
|
|
|
"//conditions:default": [],
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
"system_dynamic_deps": `[]`,
|
|
|
|
}),
|
2021-04-05 12:35:13 +02:00
|
|
|
},
|
2021-05-21 09:37:00 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-09-28 22:47:36 +02:00
|
|
|
func TestCcObjectLinkerScript(t *testing.T) {
|
2021-05-21 09:37:00 +02:00
|
|
|
runCcObjectTestCase(t, bp2buildTestCase{
|
2021-11-08 18:56:31 +01:00
|
|
|
description: "cc_object setting linker_script",
|
2021-05-21 09:37:00 +02:00
|
|
|
blueprint: `cc_object {
|
2021-04-05 12:35:13 +02:00
|
|
|
name: "foo",
|
2021-09-28 22:47:36 +02:00
|
|
|
srcs: ["base.cpp"],
|
|
|
|
linker_script: "bunny.lds",
|
|
|
|
include_build_directory: false,
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
expectedBazelTargets: []string{
|
2021-11-08 18:56:31 +01:00
|
|
|
makeBazelTarget("cc_object", "foo", attrNameToString{
|
|
|
|
"copts": `["-fno-addrsig"]`,
|
|
|
|
"linker_script": `"bunny.lds"`,
|
|
|
|
"srcs": `["base.cpp"]`,
|
|
|
|
}),
|
2021-09-28 22:47:36 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcObjectDepsAndLinkerScriptSelects(t *testing.T) {
|
|
|
|
runCcObjectTestCase(t, bp2buildTestCase{
|
2021-11-08 18:56:31 +01:00
|
|
|
description: "cc_object setting deps and linker_script across archs",
|
2021-09-28 22:47:36 +02:00
|
|
|
blueprint: `cc_object {
|
|
|
|
name: "foo",
|
|
|
|
srcs: ["base.cpp"],
|
|
|
|
arch: {
|
|
|
|
x86: {
|
|
|
|
objs: ["x86_obj"],
|
|
|
|
linker_script: "x86.lds",
|
|
|
|
},
|
|
|
|
x86_64: {
|
|
|
|
objs: ["x86_64_obj"],
|
|
|
|
linker_script: "x86_64.lds",
|
|
|
|
},
|
|
|
|
arm: {
|
|
|
|
objs: ["arm_obj"],
|
|
|
|
linker_script: "arm.lds",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
include_build_directory: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_object {
|
|
|
|
name: "x86_obj",
|
|
|
|
system_shared_libs: [],
|
|
|
|
srcs: ["x86.cpp"],
|
|
|
|
include_build_directory: false,
|
|
|
|
bazel_module: { bp2build_available: false },
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_object {
|
|
|
|
name: "x86_64_obj",
|
2021-07-22 20:39:44 +02:00
|
|
|
system_shared_libs: [],
|
2021-09-28 22:47:36 +02:00
|
|
|
srcs: ["x86_64.cpp"],
|
|
|
|
include_build_directory: false,
|
|
|
|
bazel_module: { bp2build_available: false },
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_object {
|
|
|
|
name: "arm_obj",
|
|
|
|
system_shared_libs: [],
|
|
|
|
srcs: ["arm.cpp"],
|
|
|
|
include_build_directory: false,
|
|
|
|
bazel_module: { bp2build_available: false },
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
expectedBazelTargets: []string{
|
2021-11-08 18:56:31 +01:00
|
|
|
makeBazelTarget("cc_object", "foo", attrNameToString{
|
|
|
|
"copts": `["-fno-addrsig"]`,
|
|
|
|
"deps": `select({
|
2021-09-28 22:47:36 +02:00
|
|
|
"//build/bazel/platforms/arch:arm": [":arm_obj"],
|
|
|
|
"//build/bazel/platforms/arch:x86": [":x86_obj"],
|
|
|
|
"//build/bazel/platforms/arch:x86_64": [":x86_64_obj"],
|
|
|
|
"//conditions:default": [],
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
"linker_script": `select({
|
2021-09-28 22:47:36 +02:00
|
|
|
"//build/bazel/platforms/arch:arm": "arm.lds",
|
|
|
|
"//build/bazel/platforms/arch:x86": "x86.lds",
|
|
|
|
"//build/bazel/platforms/arch:x86_64": "x86_64.lds",
|
|
|
|
"//conditions:default": None,
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
"srcs": `["base.cpp"]`,
|
|
|
|
}),
|
2021-09-28 22:47:36 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCcObjectSelectOnLinuxAndBionicArchs(t *testing.T) {
|
|
|
|
runCcObjectTestCase(t, bp2buildTestCase{
|
2021-11-08 18:56:31 +01:00
|
|
|
description: "cc_object setting srcs based on linux and bionic archs",
|
2021-09-28 22:47:36 +02:00
|
|
|
blueprint: `cc_object {
|
|
|
|
name: "foo",
|
2021-04-05 12:35:13 +02:00
|
|
|
srcs: ["base.cpp"],
|
|
|
|
target: {
|
2021-09-28 22:47:36 +02:00
|
|
|
linux_arm64: {
|
|
|
|
srcs: ["linux_arm64.cpp",]
|
2021-04-05 12:35:13 +02:00
|
|
|
},
|
2021-09-28 22:47:36 +02:00
|
|
|
linux_x86: {
|
|
|
|
srcs: ["linux_x86.cpp",]
|
2021-04-05 12:35:13 +02:00
|
|
|
},
|
2021-09-28 22:47:36 +02:00
|
|
|
bionic_arm64: {
|
|
|
|
srcs: ["bionic_arm64.cpp",]
|
2021-04-05 12:35:13 +02:00
|
|
|
},
|
|
|
|
},
|
2021-09-10 16:06:32 +02:00
|
|
|
include_build_directory: false,
|
2021-04-05 12:35:13 +02:00
|
|
|
}
|
|
|
|
`,
|
2021-05-21 09:37:00 +02:00
|
|
|
expectedBazelTargets: []string{
|
2021-11-08 18:56:31 +01:00
|
|
|
makeBazelTarget("cc_object", "foo", attrNameToString{
|
|
|
|
"copts": `["-fno-addrsig"]`,
|
|
|
|
"srcs": `["base.cpp"] + select({
|
2021-09-28 22:47:36 +02:00
|
|
|
"//build/bazel/platforms/os_arch:android_arm64": [
|
|
|
|
"linux_arm64.cpp",
|
2021-10-11 21:40:35 +02:00
|
|
|
"bionic_arm64.cpp",
|
2021-09-28 22:47:36 +02:00
|
|
|
],
|
|
|
|
"//build/bazel/platforms/os_arch:android_x86": ["linux_x86.cpp"],
|
|
|
|
"//build/bazel/platforms/os_arch:linux_bionic_arm64": [
|
|
|
|
"linux_arm64.cpp",
|
2021-10-11 21:40:35 +02:00
|
|
|
"bionic_arm64.cpp",
|
2021-09-28 22:47:36 +02:00
|
|
|
],
|
|
|
|
"//build/bazel/platforms/os_arch:linux_glibc_x86": ["linux_x86.cpp"],
|
|
|
|
"//build/bazel/platforms/os_arch:linux_musl_x86": ["linux_x86.cpp"],
|
2021-04-05 12:35:13 +02:00
|
|
|
"//conditions:default": [],
|
2021-11-08 18:56:31 +01:00
|
|
|
})`,
|
|
|
|
}),
|
2021-02-24 13:20:12 +01:00
|
|
|
},
|
2021-05-21 09:37:00 +02:00
|
|
|
})
|
2021-02-18 09:21:34 +01:00
|
|
|
}
|