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_android//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        ),
28        data = attr.label_list(allow_files = True),
29        deps = attr.label_list(
30            allow_files = False,
31            providers = [JavaInfo],
32        ),
33        exports = attr.label_list(
34            allow_files = False,
35            allow_rules = ["aar_import", "java_import"],
36        ),
37        has_lint_jar = attr.bool(
38            default = False,
39            doc = "Whether the aar contains a lint.jar. This is required to " +
40                  "know at analysis time if a lint jar is included in the aar.",
41        ),
42        package = attr.string(
43            doc = "Package to use while processing the aar at analysis time. " +
44                  "This needs to be the same value as the manifest's package.",
45        ),
46        srcjar = attr.label(
47            allow_single_file = [".srcjar"],
48            doc =
49                "A srcjar file that contains the source code for the JVM " +
50                "artifacts stored within the AAR.",
51        ),
52        _flags = attr.label(
53            default = "@rules_android//rules/flags",
54        ),
55        _java_toolchain = attr.label(
56            default = Label("//tools/jdk:toolchain_android_only"),
57        ),
58        _host_javabase = attr.label(
59            cfg = "host",
60            default = Label("//tools/jdk:current_java_runtime"),
61        ),
62    ),
63    _attrs.DATA_CONTEXT,
64)
65