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
pull/171/head
Sandboxed API Team 2022-10-13 06:00:42 -07:00 committed by Copybara-Service
parent 79b6784b82
commit 882e474032
1 changed files with 7 additions and 2 deletions

View File

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