• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)
21load(
22    "//rules:native_deps.bzl",
23    "split_config_aspect",
24)
25
26ATTRS = _attrs.replace(
27    _attrs.add(
28        dict(
29            srcs = attr.label_list(
30                # TODO(timpeut): Set PropertyFlag direct_compile_time_input
31                allow_files = [".java", ".srcjar"],
32            ),
33            deps = attr.label_list(
34                allow_files = True,
35                allow_rules = [
36                    "aar_import",
37                    "android_library",
38                    "cc_library",
39                    "java_import",
40                    "java_library",
41                    "java_lite_proto_library",
42                ],
43                providers = [
44                    [CcInfo],
45                    [JavaInfo],
46                    ["AndroidResourcesInfo", "AndroidAssetsInfo"],
47                ],
48                cfg = android_common.multi_cpu_configuration,
49            ),
50            enable_data_binding = attr.bool(),
51            instruments = attr.label(),
52            manifest_values = attr.string_dict(),
53            manifest_merger = attr.string(
54                default = "auto",
55                values = ["auto", "legacy", "android", "force_android"],
56            ),
57            native_target = attr.label(
58                allow_files = False,
59                allow_rules = ["android_binary", "android_test"],
60            ),
61            proguard_specs = attr.label_list(allow_empty = True, allow_files = True),
62            resource_configuration_filters = attr.string_list(),
63            densities = attr.string_list(),
64            nocompress_extensions = attr.string_list(),
65            shrink_resources = _attrs.tristate.create(
66                default = _attrs.tristate.auto,
67            ),
68            _java_toolchain = attr.label(
69                default = Label("//tools/jdk:toolchain_android_only"),
70            ),
71            _defined_resource_files = attr.bool(default = False),
72            _enable_manifest_merging = attr.bool(default = True),
73            _cc_toolchain_split = attr.label(
74                cfg = android_common.multi_cpu_configuration,
75                default = "@bazel_tools//tools/cpp:current_cc_toolchain",
76                aspects = [split_config_aspect],
77            ),
78            _grep_includes = attr.label(
79                allow_single_file = True,
80                executable = True,
81                cfg = "exec",
82                default = Label("@@bazel_tools//tools/cpp:grep-includes"),
83            ),
84        ),
85        _attrs.COMPILATION,
86        _attrs.DATA_CONTEXT,
87        _attrs.ANDROID_TOOLCHAIN_ATTRS,
88    ),
89    # TODO(b/167599192): don't override manifest attr to remove .xml file restriction.
90    manifest = attr.label(
91        allow_single_file = True,
92    ),
93)
94