blob: 4b889d1019876b95a4c86b56e9605a9baee10a57 [file] [log] [blame]
Lukacs T. Berkia7af9942021-05-11 16:53:58 +02001load("//build/bazel/rules:soong_injection.bzl", "soong_injection_repository")
Jingwen Chen1d87e992021-08-10 05:58:04 +00002load("//build/bazel/rules:make_injection.bzl", "make_injection_repository")
Rupert Shuttleworth5a3495f2020-11-02 10:42:29 +00003
Chris Parsons52421f62021-02-23 16:49:59 -05004register_toolchains(
zeekbe1d2eb2022-03-24 20:47:32 +08005 "//prebuilts/build-tools:py_toolchain",
6 "//prebuilts/clang/host/linux-x86:all",
Chris Parsons52421f62021-02-23 16:49:59 -05007)
Chris Parsons6c70b3c2021-03-01 19:34:56 -05008
Jingwen Chen4c516ed2022-01-24 14:16:07 +00009# This repository provides files that Soong emits during bp2build (other than
10# converted BUILD files), mostly .bzl files containing constants to support the
11# converted BUILD files.
Lukacs T. Berkia7af9942021-05-11 16:53:58 +020012soong_injection_repository(name="soong_injection")
Jingwen Chen240243e2021-09-21 08:52:44 +000013
14# This is a repository rule to allow Bazel builds to depend on Soong-built
15# prebuilts for migration purposes.
Jingwen Chen1d87e992021-08-10 05:58:04 +000016make_injection_repository(
17 name = "make_injection",
Jingwen Chen240243e2021-09-21 08:52:44 +000018 binaries = [
Jingwen Chene2eec9d2021-08-10 10:45:54 +000019 # APEX tools
Wei Li175d0172022-01-12 14:34:05 -080020 "apex_compression_tool",
Jingwen Chen1d87e992021-08-10 05:58:04 +000021 "apexer",
Jingwen Chen1d87e992021-08-10 05:58:04 +000022 "conv_apex_manifest",
Jingwen Chen240243e2021-09-21 08:52:44 +000023 "deapexer",
Jingwen Chen1d87e992021-08-10 05:58:04 +000024 "sefcontext_compile",
25 ],
Jingwen Chen240243e2021-09-21 08:52:44 +000026 target_module_files = {
27 # For APEX comparisons
28 "com.android.tzdata": ["system/apex/com.android.tzdata.apex"],
29 "com.android.runtime": ["system/apex/com.android.runtime.apex"],
Jingwen Chenfe16f4e2021-12-14 07:50:42 +000030 "com.android.adbd": ["system/apex/com.android.adbd.capex"],
Jingwen Chen240243e2021-09-21 08:52:44 +000031 "build.bazel.examples.apex.minimal": ["system/product/apex/build.bazel.examples.apex.minimal.apex"],
32 },
Jingwen Chen1f141e72021-12-13 09:58:01 +000033 watch_android_bp_files = [
34 "//:build/bazel/examples/apex/minimal/Android.bp", # for build.bazel.examples.apex.minimal
Jingwen Chenfe16f4e2021-12-14 07:50:42 +000035 "//:packages/modules/adbd/apex/Android.bp", # for com.android.adbd
Jingwen Chen1f141e72021-12-13 09:58:01 +000036 # TODO(b/210399979) - add the other .bp files to watch for the other modules built in these rule
37 ],
Jingwen Chen1d87e992021-08-10 05:58:04 +000038)
Lukacs T. Berkic064ea12021-04-16 16:23:32 +020039
Chris Parsons6c70b3c2021-03-01 19:34:56 -050040local_repository(
41 name = "rules_cc",
42 path = "build/bazel/rules_cc",
43)
44
45local_repository(
46 name = "bazel_skylib",
Jingwen Chendb7db4b2021-08-10 12:55:21 +000047 path = "external/bazel-skylib",
Chris Parsons6c70b3c2021-03-01 19:34:56 -050048)
49
Alex Humeskya8d3f7c2021-03-18 01:28:38 -040050local_repository(
51 name = "rules_android",
52 path = "external/bazelbuild-rules_android",
53)
54
55register_toolchains(
56 # For Starlark Android rules
57 "//prebuilts/sdk:android_default_toolchain",
58 "//prebuilts/sdk:android_sdk_tools",
59
60 # For native android_binary
61 "//prebuilts/sdk:android_sdk_tools_for_native_android_binary",
Romain Jobredeauxeda68ac2021-08-05 20:52:03 +000062
Jingwen Chene2eec9d2021-08-10 10:45:54 +000063 # For APEX rules
64 "//build/bazel/rules/apex:all"
Alex Humeskya8d3f7c2021-03-18 01:28:38 -040065)
66
67bind(
68 name = "databinding_annotation_processor",
69 actual = "//prebuilts/sdk:compiler_annotation_processor",
70)
71
72bind(
73 name = "android/dx_jar_import",
74 actual = "//prebuilts/sdk:dx_jar_import",
75)
Romain Jobredeaux86499f42021-08-02 17:22:32 +000076
77# The r8.jar in prebuilts/r8 happens to have the d8 classes needed
78# for Android app building, whereas the d8.jar in prebuilts/sdk/tools doesn't.
79bind(
80 name = "android/d8_jar_import",
81 actual = "//prebuilts/r8:r8_jar_import",
Jingwen Chen1d87e992021-08-10 05:58:04 +000082)
Jingwen Chen7dc8b3f2021-09-28 00:38:23 +000083
84# TODO(b/201242197): Avoid downloading remote_coverage_tools (on CI) by creating
85# a stub workspace. Test rules (e.g. sh_test) depend on this external dep, but
86# we don't support coverage yet. Either vendor the external dep into AOSP, or
87# cut the dependency from test rules to the external repo.
88local_repository(
89 name = "remote_coverage_tools",
90 path = "build/bazel/rules/coverage/remote_coverage_tools",
91)