diff options
author | Yifan Hong <elsk@google.com> | 2022-09-23 02:57:18 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-09-23 02:57:18 +0000 |
commit | 6a7176e7b13a474154ad3b2b3a25b16e3470f21d (patch) | |
tree | 77c9ede8cbf7536b1607c0765a9380e0a3b74a3d | |
parent | f9ca3e7993108ab4de1dfca154401c25ba0f09bc (diff) | |
parent | 9e291de41047413cd94e16eb99d3ba0afa0db6c0 (diff) | |
download | bazel_common_rules-6a7176e7b13a474154ad3b2b3a25b16e3470f21d.tar.gz |
Merge "external: allow to import external packages from <subdirectory>/external." am: b060f84810 am: 9b43409e99 am: 25374c9702 am: aa177bf8a7 am: 9e291de410
Original change: https://android-review.googlesource.com/c/platform/build/bazel_common_rules/+/2223277
Change-Id: I825a9ccfca0ce6636c1c7aedebf258294e3afb66
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | workspace/external.bzl | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/workspace/external.bzl b/workspace/external.bzl index 8964ec5..15a29f4 100644 --- a/workspace/external.bzl +++ b/workspace/external.bzl @@ -15,10 +15,11 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def import_external_repositories( + workspace_root = None, bazel_skylib = None, io_abseil_py = None, io_bazel_stardoc = None): - """Import repositories in external/ that are common to Bazel builds for Android. + """Import repositories in `{root}/external/` that are common to Bazel builds for Android. In particular, these external projects are shared by Android platform repo manifest and Android kernel repo manifest. @@ -27,27 +28,36 @@ def import_external_repositories( of repositories imported by providing them in the arguments. Args: + workspace_root: Root under which the `external/` directory may be found, relative + to the main workspace. + + When calling `import_external_repositories` in the main workspace's + `WORKSPACE` file, leave `root = None`. bazel_skylib: If `True`, load `bazel_skylib`. io_abseil_py: If `True`, load `io_abseil_py`. io_bazel_stardoc: If `True`, load `io_bazel_stardoc`. """ + workspace_prefix = workspace_root or "" + if workspace_prefix: + workspace_prefix += "/" + if bazel_skylib: maybe( repo_rule = native.local_repository, name = "bazel_skylib", - path = "external/bazel-skylib", + path = "{}external/bazel-skylib".format(workspace_prefix), ) if io_abseil_py: maybe( repo_rule = native.local_repository, name = "io_abseil_py", - path = "external/python/absl-py", + path = "{}external/python/absl-py".format(workspace_prefix), ) if io_bazel_stardoc: maybe( repo_rule = native.local_repository, name = "io_bazel_stardoc", - path = "external/stardoc", + path = "{}external/stardoc".format(workspace_prefix), ) |