Bazel: Add copts attribute to macros which use _default_copts where necessary

Propagate `_default_copts` to rules which use them.

PiperOrigin-RevId: 480871797
Change-Id: I8be371d2db5db103e6ab6ef31a181f2f818a1fc2
This commit is contained in:
Sandboxed API Team 2022-10-13 06:00:42 -07:00 committed by Copybara-Service
parent 79b6784b82
commit 882e474032

View File

@ -222,7 +222,8 @@ def sapi_library(
deps = [], deps = [],
tags = [], tags = [],
generator_version = 1, generator_version = 1,
visibility = None): visibility = None,
default_copts = []):
"""Provides the implementation of a Sandboxed API library. """Provides the implementation of a Sandboxed API library.
Args: Args:
@ -258,6 +259,8 @@ def sapi_library(
version 2 uses the newer C++ implementation that uses the full clang version 2 uses the newer C++ implementation that uses the full clang
compiler front-end for parsing. Both emit equivalent Sandboxed APIs. compiler front-end for parsing. Both emit equivalent Sandboxed APIs.
visibility: Target visibility visibility: Target visibility
default_copts: List of package level default copts, an additional
attribute since copts already has default value.
""" """
common = { common = {
@ -292,7 +295,7 @@ def sapi_library(
srcs = srcs, srcs = srcs,
data = [":" + name + ".bin"] + data, data = [":" + name + ".bin"] + data,
hdrs = lib_hdrs, hdrs = lib_hdrs,
copts = copts, copts = default_copts + copts,
defines = defines, defines = defines,
deps = sort_deps( deps = sort_deps(
[ [
@ -320,6 +323,7 @@ def sapi_library(
":" + name + ".lib", ":" + name + ".lib",
"//sandboxed_api:client", "//sandboxed_api:client",
], ],
copts = default_copts,
**common **common
) )
@ -327,6 +331,7 @@ def sapi_library(
name = name + ".lib", name = name + ".lib",
deps = [lib], deps = [lib],
alwayslink = 1, # All functions are linked into depending binaries alwayslink = 1, # All functions are linked into depending binaries
copts = default_copts,
**common **common
) )