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 contains repository rules and helpers needed to configure the Android SDK for Bazel. 16""" 17 18load( 19 ":helper.bzl", 20 "create_android_sdk_rules", 21 "create_system_images_filegroups", 22) 23 24package(default_visibility = ["//visibility:public"]) 25 26alias( 27 name = "has_androidsdk", 28 actual = "@bazel_tools//tools/android:always_true", 29) 30 31create_android_sdk_rules( 32 name = "__repository_name__", 33 build_tools_version = "__build_tools_version__", 34 build_tools_directory = "__build_tools_directory__", 35 api_levels = [__api_levels__], 36 default_api_level = __default_api_level__, 37) 38 39alias( 40 name = "adb", 41 actual = "platform-tools/adb", 42) 43 44alias( 45 name = "emulator", 46 actual = "emulator/emulator", 47) 48 49# emulator v29+ removed the arm and x86 specific binaries. 50# Keeping these aliases around for backwards compatibility. 51alias( 52 name = "emulator_arm", 53 actual = "emulator/emulator", 54) 55 56alias( 57 name = "emulator_x86", 58 actual = "emulator/emulator", 59) 60 61filegroup( 62 name = "emulator_x86_bios", 63 srcs = glob( 64 ["emulator/lib/pc-bios/*"], 65 allow_empty = True, 66 ), 67) 68 69alias( 70 name = "mksd", 71 actual = "emulator/mksdcard", 72) 73 74filegroup( 75 name = "emulator_shared_libs", 76 srcs = glob( 77 ["emulator/lib64/**"], 78 allow_empty = True, 79 ), 80) 81 82filegroup( 83 name = "sdk_path", 84 srcs = ["."], 85) 86 87filegroup( 88 name = "qemu2_x86", 89 srcs = ["emulator/emulator"] + select({ 90 "@bazel_tools//src/conditions:darwin_x86_64": ["emulator/qemu/darwin-x86_64/qemu-system-i386"], 91 "@bazel_tools//src/conditions:darwin_arm64": ["emulator/qemu/darwin-aarch64/qemu-system-aarch64"], 92 "//conditions:default": ["emulator/qemu/linux-x86_64/qemu-system-i386"], 93 }), 94) 95 96create_system_images_filegroups( 97 system_image_dirs = [__system_image_dirs__], 98) 99 100exports_files( 101 # TODO(katre): implement these. 102 #[ __exported_files__] + 103 glob(["system-images/**"], allow_empty = True), 104) 105