blob: 370a9af1735d2c5779a6adeb6fab2895f29e0d1c [file] [log] [blame]
# Helpers for stl property resolution.
# These mappings taken from build/soong/cc/stl.go
load("//build/bazel/product_variables:constants.bzl", "constants")
_libcpp_stl_names = {"libc++" : True,
"libc++_static": True,
"c++_shared": True,
"c++_static": True,
"": True,
"system": True}
# https://cs.android.com/android/platform/superproject/+/master:build/soong/cc/stl.go;l=157;drc=55d98d2ba142d6c35894b1092397e2b5a70bc2e8
_common_static_deps = select({
constants.ArchVariantToConstraints["android"]: ["//external/libcxxabi:libc++demangle"],
"//conditions:default": [],
})
# https://cs.android.com/android/platform/superproject/+/master:build/soong/cc/stl.go;l=162;drc=cb0ac95bde896fa2aa59193a37ceb580758c322c
# this should vary based on vndk version
# skip libm and libc because then we would have duplicates due to system_shared_library
_libunwind = "//prebuilts/clang/host/linux-x86:libunwind"
_static_binary_deps = select({
constants.ArchVariantToConstraints["android"]: [_libunwind],
constants.ArchVariantToConstraints["linux_bionic"]: [_libunwind],
"//conditions:default": [],
})
def static_stl_deps(stl_name):
# TODO(b/201079053): Handle useSdk, windows, fuschia, preferably with selects.
if stl_name in _libcpp_stl_names:
return ["//external/libcxx:libc++_static"] + _common_static_deps
elif stl_name == "none":
return []
else:
fail("Unhandled stl %s" % stl_name)
def static_binary_stl_deps(stl_name):
base = static_stl_deps(stl_name)
if stl_name == "none":
return base
else:
return base + _static_binary_deps
def shared_stl_deps(stl_name):
# TODO(b/201079053): Handle useSdk, windows, fuschia, preferably with selects.
if stl_name in _libcpp_stl_names:
return (_common_static_deps, ["//external/libcxx:libc++"])
elif stl_name == "none":
return ([], [])
else:
fail("Unhandled stl %s" % stl_name)