• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("//build/bazel/rules:soong_injection.bzl", "soong_injection_repository")
2load("//build/bazel/rules:make_injection.bzl", "make_injection_repository")
3
4register_toolchains(
5    "//prebuilts/build-tools:py_toolchain",
6    "//prebuilts/clang/host/linux-x86:all",
7)
8
9# 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.
12soong_injection_repository(name="soong_injection")
13
14# This is a repository rule to allow Bazel builds to depend on Soong-built
15# prebuilts for migration purposes.
16make_injection_repository(
17    name = "make_injection",
18    binaries = [
19        # APEX tools
20        "apex_compression_tool",
21        "apexer",
22        "conv_apex_manifest",
23        "deapexer",
24        "sefcontext_compile",
25    ],
26    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"],
30        "com.android.adbd": ["system/apex/com.android.adbd.capex"],
31        "build.bazel.examples.apex.minimal": ["system/product/apex/build.bazel.examples.apex.minimal.apex"],
32    },
33    watch_android_bp_files = [
34        "//:build/bazel/examples/apex/minimal/Android.bp", # for build.bazel.examples.apex.minimal
35        "//:packages/modules/adbd/apex/Android.bp", # for com.android.adbd
36        # TODO(b/210399979) - add the other .bp files to watch for the other modules built in these rule
37    ],
38)
39
40local_repository(
41    name = "rules_cc",
42    path = "build/bazel/rules_cc",
43)
44
45local_repository(
46    name = "bazel_skylib",
47    path = "external/bazel-skylib",
48)
49
50local_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",
62
63  # For APEX rules
64  "//build/bazel/rules/apex: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:r8_jar_import",
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/rules/coverage/remote_coverage_tools",
91)
92