xref: /aosp_15_r20/external/bazelbuild-rules_android/rules/android_sdk_repository/empty.template.bzl (revision 9e965d6fece27a77de5377433c2f7e6999b8cc0b)
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"""
15This module adds no-op repository rules when the Android SDK is not installed.
16"""
17
18package(default_visibility = ["//visibility:public"])
19
20# android_sdk_repository was used without a valid Android SDK being set.
21# Either the path attribute of android_sdk_repository or the ANDROID_HOME
22# environment variable must be set.
23# This is a minimal BUILD file to allow non-Android builds to continue.
24
25alias(
26    name = "has_androidsdk",
27    actual = "@bazel_tools//tools/android:always_false",
28)
29
30filegroup(
31    name = "files",
32    srcs = [":error_message"],
33)
34
35filegroup(
36    name = "sdk",
37    srcs = [":error_message"],
38)
39
40filegroup(
41    name = "d8_jar_import",
42    srcs = [":error_message"],
43)
44
45filegroup(
46    name = "dx_jar_import",
47    srcs = [":error_message"],
48)
49
50genrule(
51    name = "invalid_android_sdk_repository_error",
52    outs = [
53        "error_message",
54    ],
55    cmd = """echo \
56    android_sdk_repository was used without a valid Android SDK being set. \
57    Either the path attribute of android_sdk_repository or the ANDROID_HOME \
58    environment variable must be set. ; \
59    exit 1 """,
60)
61