Propagate compatible_with through sapi_library.

If a sandboxing target sets a `compatible_with` constraint, the current sapi.bzl doesn't propagate this to the subsequent target generations.

We implement the forwarding similarly to the `visibility` attribute.

PiperOrigin-RevId: 546838438
Change-Id: I8a0b2623ee3aa91ffe7e6f4b001177c03806f532
This commit is contained in:
Oliver Kunz 2023-07-10 05:06:47 -07:00 committed by Copybara-Service
parent a94b17d821
commit 5dd7584e55

View File

@ -253,6 +253,7 @@ def sapi_library(
tags = [],
generator_version = 1,
visibility = None,
compatible_with = None,
default_copts = []):
"""Provides the implementation of a Sandboxed API library.
@ -289,6 +290,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
compatible_with: The list of environments this target can be built for,
in addition to default-supported environments.
default_copts: List of package level default copts, an additional
attribute since copts already has default value.
"""
@ -299,6 +302,9 @@ def sapi_library(
if visibility:
common["visibility"] = visibility
if compatible_with != None:
common["compatible_with"] = compatible_with
generated_header = name + ".sapi.h"
# Reference (pull into the archive) required functions only. If the functions'