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 8load("//build/bazel/rules:env.bzl", "env_repository") 9 10env_repository( 11 name = "env", 12) 13 14# This repository is a containter for API surface stub libraries. 15load("//build/bazel/rules:api_surfaces_injection.bzl", "api_surfaces_repository") 16 17# TODO: Once BUILD files for stubs are checked-in, this should be converted to a local_repository. 18api_surfaces_repository(name = "api_surfaces") 19 20local_repository( 21 name = "bazel_skylib", 22 path = "external/bazel-skylib", 23) 24 25load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") 26 27local_repository( 28 name = "io_abseil_py", 29 path = "external/python/absl-py", 30) 31 32bazel_skylib_workspace() 33 34local_repository( 35 name = "rules_android", 36 path = "external/bazelbuild-rules_android", 37) 38 39local_repository( 40 name = "rules_license", 41 path = "external/bazelbuild-rules_license", 42) 43 44local_repository( 45 name = "rules_python", 46 path = "external/bazelbuild-rules_python", 47) 48 49local_repository( 50 name = "rules_cc", 51 path = "external/bazelbuild-rules_cc", 52) 53 54register_toolchains( 55 "//prebuilts/build-tools:py_toolchain", 56 57 # For Android rules 58 "//prebuilts/sdk:all", 59 60 # For APEX rules 61 "//build/bazel/rules/apex:all", 62 63 # For partition rules 64 "//build/bazel/rules/partitions:all", 65) 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) 76 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:r8lib-prebuilt", 82) 83 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_common_rules/rules/coverage/remote_coverage_tools", 91) 92 93# Stubbing the local_jdk both ensures that we don't accidentally download remote 94# repositories and allows us to let the Kotlin rules continue to access 95# @local_jdk//jar. 96local_repository( 97 name = "local_jdk", 98 path = "build/bazel/rules/java/stub_local_jdk", 99) 100 101# The following 2 repositories contain prebuilts that are necessary to the Java Rules. 102# They are vendored locally to avoid the need for CI bots to download them. 103local_repository( 104 name = "remote_java_tools", 105 path = "prebuilts/bazel/common/remote_java_tools", 106) 107 108local_repository( 109 name = "remote_java_tools_linux", 110 path = "prebuilts/bazel/linux-x86_64/remote_java_tools_linux", 111) 112 113# TODO(b/253667328): the below 3 repositories are all pointed to shim 114# repositories with targets that will cause failures if they are 115# actually depended on. Eventually we should properly vendor these 116# repositories. 117local_repository( 118 name = "remote_java_tools_darwin_x86_64", 119 path = "prebuilts/bazel/darwin-x86_64/remote_java_tools_darwin", 120) 121 122local_repository( 123 name = "remote_java_tools_darwin_arm64", 124 path = "prebuilts/bazel/darwin-x86_64/remote_java_tools_darwin", 125) 126 127local_repository( 128 name = "remote_java_tools_windows", 129 path = "prebuilts/bazel/darwin-x86_64/remote_java_tools_darwin", 130) 131 132# The following repository contains android_tools prebuilts. 133local_repository( 134 name = "android_tools", 135 path = "prebuilts/bazel/common/android_tools", 136) 137 138# The vendored rules_java repository. 139local_repository( 140 name = "rules_java", 141 path = "external/bazelbuild-rules_java", 142) 143 144register_toolchains( 145 "//prebuilts/jdk/jdk21:runtime_toolchain_definition", 146 "//build/bazel/rules/java:jdk21_host_toolchain_java_definition", 147) 148 149local_repository( 150 name = "kotlin_maven_interface", 151 path = "build/bazel/rules/kotlin/maven_interface", 152) 153 154local_repository( 155 name = "rules_kotlin", 156 path = "external/bazelbuild-kotlin-rules", 157 repo_mapping = { 158 "@maven": "@kotlin_maven_interface", 159 "@bazel_platforms": "@platforms", 160 }, 161) 162 163new_local_repository( 164 name = "kotlinc", 165 build_file = "//build/bazel/rules/kotlin:kotlinc.BUILD", 166 path = "external/kotlinc", 167) 168 169register_toolchains("//build/bazel/rules/kotlin:kt_jvm_toolchain_linux") 170 171load("//build/bazel/toolchains/clang/host/linux-x86:cc_toolchain_config.bzl", "cc_register_toolchains") 172 173cc_register_toolchains() 174 175local_repository( 176 name = "io_bazel_rules_go", 177 path = "external/bazelbuild-rules_go", 178) 179 180load( 181 "@io_bazel_rules_go//go:deps.bzl", 182 "go_register_toolchains", 183 "go_rules_dependencies", 184 "go_wrap_sdk", 185) 186 187go_wrap_sdk( 188 name = "go_sdk", 189 # Add coveragedesign to experiments. This is a temporary hack due to two separate issues combinining together 190 # 1. android: 191 # Starting with go 1.20, the standard go sdk does not ship with .a files for the standard libraries 192 # However, this breaks the go rules in build/blueprint. As a temporary workaround, we distribute prebuilts of the standard libaries 193 # in prebuilts/go using GODEBUG='installgoroot=all' in the prebuilt update script 194 # 195 # 2. rules_go: 196 # coverage is not supported in rules_go, and therefore it adds nocoveragedesign to GOEXPERIMENT. This is not an issue for non Android cases 197 # since the go SDK used in those cases does not contain prebuilts of standard libraries. The stdlib is built from scratch with `nocoverageredesign`. 198 # 199 # Without this, we run into isues during compilation 200 # ``` 201 # GoCompilePkg build/blueprint/blueprint-deptools.a failed 202 # build/blueprint/deptools/depfile.go:18:2: could not import fmt (object is [go object linux amd64 go1.20.2 GOAMD64=v1 X:unified,regabiwrappers,regabiargs,coverageredesign 203 # ^^^^^^^^^^^^^^^^ 204 # ] expected [go object linux amd64 go1.20.2 GOAMD64=v1 X:unified,regabiwrappers,regabiargs 205 # ``` 206 # TODO - b/288456805: Remove this hardcoded experiment value 207 experiments = ["coverageredesign"], 208 # The expected key format is <goos>_<goarch> 209 # The value is any file in the GOROOT for that platform 210 root_files = { 211 "linux_amd64": "@//:prebuilts/go/linux-x86/README.md", 212 "darwin_amd64": "@//prebuilts/go/darwin-x86/README.md", 213 }, 214) 215 216go_rules_dependencies() 217 218go_register_toolchains(experiments = []) 219 220local_repository( 221 name = "rules_proto", 222 path = "build/bazel/rules/proto", 223) 224 225local_repository( 226 name = "rules_rust", 227 path = "external/bazelbuild-rules_rust", 228) 229 230new_local_repository( 231 name = "rules_rust_tinyjson", 232 build_file = "@rules_rust//util/process_wrapper:BUILD.tinyjson.bazel", 233 path = "external/rust/crates/tinyjson", 234) 235 236local_repository( 237 name = "rules_testing", 238 path = "external/bazelbuild-rules_testing", 239) 240 241register_toolchains( 242 # The base toolchains need to be registered before <os_arch> 243 # to ensure it is preferably resolved when it's enabled by 244 # base_toolchain_enabled config_setting 245 "//build/bazel/toolchains/rust/bootstrap:rust_toolchain_android_arm64_base", 246 "//build/bazel/toolchains/rust/bootstrap:rust_toolchain_android_arm_base", 247 "//build/bazel/toolchains/rust/bootstrap:rust_toolchain_android_x86_64_base", 248 "//build/bazel/toolchains/rust/bootstrap:rust_toolchain_android_x86_base", 249 "//build/bazel/toolchains/rust:rust_toolchain_android_arm64", 250 "//build/bazel/toolchains/rust:rust_toolchain_android_arm", 251 "//build/bazel/toolchains/rust:rust_toolchain_android_x86_64", 252 "//build/bazel/toolchains/rust:rust_toolchain_android_x86", 253 "build/bazel/toolchains/rust:rust_toolchain_x86_64_unknown-linux-gnu", 254 "build/bazel/toolchains/rust:proto-toolchain", 255) 256