• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This repository provides files that Soong emits during bp2build (other than
2# converted BUILD files), mostly .bzl files containing constants to support the
3# converted BUILD files.
4load("//build/bazel/rules:soong_injection.bzl", "soong_injection_repository")
5
6soong_injection_repository(name = "soong_injection")
7
8# ! WARNING ! WARNING ! WARNING !
9# make_injection is a repository rule to allow Bazel builds to depend on
10# Soong-built prebuilts for experimental purposes. It is fragile, slow, and
11# works for very limited use cases. Do not add a dependency that will cause
12# make_injection to run for any prod builds or tests.
13#
14# If you need to add something in this list, please contact the Roboleaf
15# team and ask jingwen@ for a review.
16load("//build/bazel/rules:make_injection.bzl", "make_injection_repository")
17
18make_injection_repository(
19    name = "make_injection",
20    binaries = [
21        "build_image",
22        "mkuserimg_mke2fs",
23    ],
24    target_module_files = {},
25    watch_android_bp_files = [
26        "//:build/make/tools/releasetools/Android.bp",  # for build_image
27        "//:system/extras/ext4_utils/Android.bp",  # for mkuserimg_mke2fs
28    ],
29)
30# ! WARNING ! WARNING ! WARNING !
31
32load("//build/bazel/rules:env.bzl", "env_repository")
33
34env_repository(
35    name = "env",
36)
37
38# This repository is a containter for API surface stub libraries.
39load("//build/bazel/rules:api_surfaces_injection.bzl", "api_surfaces_repository")
40
41# TODO: Once BUILD files for stubs are checked-in, this should be converted to a local_repository.
42api_surfaces_repository(name = "api_surfaces")
43
44load("//build/bazel_common_rules/workspace:external.bzl", "import_external_repositories")
45
46import_external_repositories(
47    bazel_skylib = True,
48    io_abseil_py = True,
49)
50
51load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
52
53bazel_skylib_workspace()
54
55local_repository(
56    name = "rules_android",
57    path = "external/bazelbuild-rules_android",
58)
59
60local_repository(
61    name = "rules_license",
62    path = "external/bazelbuild-rules_license",
63)
64
65register_toolchains(
66    "//prebuilts/build-tools:py_toolchain",
67
68    # For Android rules
69    "//prebuilts/sdk:all",
70
71    # For APEX rules
72    "//build/bazel/rules/apex:all",
73
74    # For partition rules
75    "//build/bazel/rules/partitions:all",
76)
77
78bind(
79    name = "databinding_annotation_processor",
80    actual = "//prebuilts/sdk:compiler_annotation_processor",
81)
82
83bind(
84    name = "android/dx_jar_import",
85    actual = "//prebuilts/sdk:dx_jar_import",
86)
87
88# The r8.jar in prebuilts/r8 happens to have the d8 classes needed
89# for Android app building, whereas the d8.jar in prebuilts/sdk/tools doesn't.
90bind(
91    name = "android/d8_jar_import",
92    actual = "//prebuilts/bazel/common/r8:r8_jar_import",
93)
94
95# TODO(b/201242197): Avoid downloading remote_coverage_tools (on CI) by creating
96# a stub workspace. Test rules (e.g. sh_test) depend on this external dep, but
97# we don't support coverage yet. Either vendor the external dep into AOSP, or
98# cut the dependency from test rules to the external repo.
99local_repository(
100    name = "remote_coverage_tools",
101    path = "build/bazel_common_rules/rules/coverage/remote_coverage_tools",
102)
103
104# Stubbing the local_jdk both ensures that we don't accidentally download remote
105# repositories and allows us to let the Kotlin rules continue to access
106# @local_jdk//jar.
107local_repository(
108    name = "local_jdk",
109    path = "build/bazel/rules/java/stub_local_jdk",
110)
111
112# The following 2 repositories contain prebuilts that are necessary to the Java Rules.
113# They are vendored locally to avoid the need for CI bots to download them.
114local_repository(
115    name = "remote_java_tools",
116    path = "prebuilts/bazel/common/remote_java_tools",
117)
118
119local_repository(
120    name = "remote_java_tools_linux",
121    path = "prebuilts/bazel/linux-x86_64/remote_java_tools_linux",
122)
123
124# The following repository contains android_tools prebuilts.
125local_repository(
126    name = "android_tools",
127    path = "prebuilts/bazel/common/android_tools",
128)
129
130# The rules_java repository is stubbed and points to the native Java rules until
131# it can be properly vendored.
132local_repository(
133    name = "rules_java",
134    path = "build/bazel_common_rules/rules/java/rules_java",
135)
136
137register_toolchains(
138    "//prebuilts/jdk/jdk17:runtime_toolchain_definition",
139    "//build/bazel/rules/java:jdk17_host_toolchain_java_definition",
140)
141
142local_repository(
143    name = "kotlin_maven_interface",
144    path = "build/bazel/rules/kotlin/maven_interface",
145)
146
147local_repository(
148    name = "rules_kotlin",
149    path = "external/bazelbuild-kotlin-rules",
150    repo_mapping = {
151        "@maven": "@kotlin_maven_interface",
152        "@bazel_platforms": "@platforms",
153    },
154)
155
156new_local_repository(
157    name = "kotlinc",
158    build_file = "//build/bazel/rules/kotlin:kotlinc.BUILD",
159    path = "external/kotlinc",
160)
161
162register_toolchains("@rules_kotlin//toolchains/kotlin_jvm:kt_jvm_toolchain")
163
164load("//prebuilts/clang/host/linux-x86:cc_toolchain_config.bzl", "cc_register_toolchains")
165
166cc_register_toolchains()
167