xref: /aosp_15_r20/external/bazelbuild-rules_android/rules/aar_import/attrs.bzl (revision 9e965d6fece27a77de5377433c2f7e6999b8cc0b)
1# Copyright 2018 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"""Attributes."""
16
17load(
18    "//rules:attrs.bzl",
19    _attrs = "attrs",
20)
21
22ATTRS = _attrs.add(
23    dict(
24        aar = attr.label(
25            allow_single_file = [".aar"],
26            mandatory = True,
27            doc = "The .aar file to process.",
28        ),
29        data = attr.label_list(
30            allow_files = True,
31            doc = "Files needed by this rule at runtime. May list file or rule " +
32                  "targets. Generally allows any target.",
33        ),
34        deps = attr.label_list(
35            allow_files = False,
36            providers = [JavaInfo],
37            doc = "The list of libraries to link against.",
38        ),
39        exports = attr.label_list(
40            allow_files = False,
41            allow_rules = ["aar_import", "java_import", "kt_jvm_import"],
42            doc = "The closure of all rules reached via `exports` attributes are considered " +
43                  "direct dependencies of any rule that directly depends on the target with " +
44                  "`exports`. The `exports` are not direct deps of the rule they belong to.",
45        ),
46        has_lint_jar = attr.bool(
47            default = False,
48            doc = "Whether the aar contains a lint.jar. This is required to " +
49                  "know at analysis time if a lint jar is included in the aar.",
50        ),
51        package = attr.string(
52            doc = "Package to use while processing the aar at analysis time. " +
53                  "This needs to be the same value as the manifest's package.",
54        ),
55        srcjar = attr.label(
56            allow_single_file = [".srcjar"],
57            doc = "A srcjar file that contains the source code for the JVM " +
58                  "artifacts stored within the AAR.",
59        ),
60        _flags = attr.label(
61            default = "//rules/flags",
62        ),
63        _java_toolchain = attr.label(
64            default = Label("//tools/jdk:toolchain_android_only"),
65        ),
66        _host_javabase = attr.label(
67            cfg = "exec",
68            default = Label("//tools/jdk:current_java_runtime"),
69        ),
70    ),
71    _attrs.DATA_CONTEXT,
72    _attrs.ANDROID_TOOLCHAIN_ATTRS,
73    _attrs.AUTOMATIC_EXEC_GROUPS_ENABLED,
74)
75