platform_build_soong/cc/Android.bp
Jingwen Chen 91220d7334 Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.

This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.

These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.

This enables //bionic/libc:libc_headers to be generated correctly, from:

    cc_library_headers {
        name: "libc_headers",
        target: {
            android: {
                header_libs: ["libc_headers_arch"],
                export_header_lib_headers: ["libc_headers_arch"],
            },
            linux_bionic: {
                header_libs: ["libc_headers_arch"],
                export_header_lib_headers: ["libc_headers_arch"],
            },
        },
        // omitted props
    }

to:

    cc_library_headers(
        name = "libc_headers",
        deps = [] + select({
            "//build/bazel/platforms/os:android": [
                ":libc_headers_arch",
            ],
            "//build/bazel/platforms/os:linux_bionic": [
                ":libc_headers_arch",
            ],
            "//conditions:default": [],
        }),
    )

Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786

Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-04-02 08:17:34 +00:00

99 lines
2 KiB
Text

package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
bootstrap_go_package {
name: "soong-cc",
pkgPath: "android/soong/cc",
deps: [
"blueprint",
"blueprint-pathtools",
"soong",
"soong-android",
"soong-bazel",
"soong-cc-config",
"soong-etc",
"soong-genrule",
"soong-tradefed",
],
srcs: [
"androidmk.go",
"api_level.go",
"builder.go",
"bp2build.go",
"cc.go",
"ccdeps.go",
"check.go",
"coverage.go",
"gen.go",
"image.go",
"linkable.go",
"lto.go",
"makevars.go",
"pgo.go",
"prebuilt.go",
"proto.go",
"rs.go",
"sanitize.go",
"sabi.go",
"sdk.go",
"snapshot_prebuilt.go",
"snapshot_utils.go",
"stl.go",
"strip.go",
"sysprop.go",
"tidy.go",
"util.go",
"vendor_snapshot.go",
"vndk.go",
"vndk_prebuilt.go",
"cflag_artifacts.go",
"cmakelists.go",
"compdb.go",
"compiler.go",
"installer.go",
"linker.go",
"binary.go",
"binary_sdk_member.go",
"fuzz.go",
"library.go",
"library_headers.go",
"library_sdk_member.go",
"object.go",
"test.go",
"toolchain_library.go",
"ndk_prebuilt.go",
"ndk_headers.go",
"ndk_library.go",
"ndk_sysroot.go",
"llndk_library.go",
"kernel_headers.go",
"genrule.go",
"vendor_public_library.go",
"testing.go",
"stub_library.go",
],
testSrcs: [
"cc_test.go",
"compiler_test.go",
"gen_test.go",
"genrule_test.go",
"library_headers_test.go",
"library_test.go",
"object_test.go",
"prebuilt_test.go",
"proto_test.go",
"test_data_test.go",
"vendor_snapshot_test.go",
],
pluginFor: ["soong_build"],
}