1# Copyright 2023 The Bazel Authors. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15"""android_sandboxed_sdk rule. 16 17This file exists to inject the correct version of android_binary. 18""" 19 20load("//rules:android_binary.bzl", _android_binary = "android_binary") 21load(":android_sandboxed_sdk_macro.bzl", _android_sandboxed_sdk_macro = "android_sandboxed_sdk_macro") 22 23def android_sandboxed_sdk( 24 name, 25 sdk_modules_config, 26 deps, 27 min_sdk_version = 21, 28 visibility = None, 29 testonly = None, 30 tags = [], 31 custom_package = None): 32 """Rule to build an Android Sandboxed SDK. 33 34 A sandboxed SDK is a collection of libraries that can run independently in the Privacy Sandbox 35 or in a separate split APK of an app. See: 36 https://developer.android.com/design-for-safety/privacy-sandbox. 37 38 Args: 39 name: Unique name of this target. 40 sdk_modules_config: Module config for this SDK. For full definition see 41 https://github.com/google/bundletool/blob/master/src/main/proto/sdk_modules_config.proto 42 deps: Set of android libraries that make up this SDK. 43 min_sdk_version: Min SDK version for the SDK. 44 visibility: A list of targets allowed to depend on this rule. 45 testonly: Whether this library is only for testing. 46 tags: A list of string tags passed to generated targets. 47 custom_package: Java package for which java sources will be generated. By default the package 48 is inferred from the directory where the BUILD file containing the rule is. You can specify 49 a different package but this is highly discouraged since it can introduce classpath 50 conflicts with other libraries that will only be detected at runtime. 51 """ 52 53 _android_sandboxed_sdk_macro( 54 name = name, 55 sdk_modules_config = sdk_modules_config, 56 deps = deps, 57 min_sdk_version = min_sdk_version, 58 visibility = visibility, 59 testonly = testonly, 60 tags = tags, 61 custom_package = custom_package, 62 android_binary = _android_binary, 63 ) 64