summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2023-04-10 13:59:43 -0600
committerSam James <sam@gentoo.org>2023-09-18 10:48:23 +0100
commit683d8b60b0038619e9d57012939330e63fea1614 (patch)
treec758d219b76942b4c7d8cf2d08a1917f0dfadcc7 /eclass/bazel.eclass
parentsys-block/thin-provisioning-tools: fix bug 911775 (diff)
downloadgentoo-683d8b60b0038619e9d57012939330e63fea1614.tar.gz
gentoo-683d8b60b0038619e9d57012939330e63fea1614.tar.bz2
gentoo-683d8b60b0038619e9d57012939330e63fea1614.zip
bazel.eclass: add support for a custom bazel
Multiple bazel packages can be installed side-by-side through version suffixes, e.g., `/usr/bin/bazel-5`, `/usr/bin/bazel-6`, etc. These can be easily simultaneously supported with an eclass param. Signed-off-by: George Burgess IV <gbiv@google.com> Closes: https://github.com/gentoo/gentoo/pull/30544 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'eclass/bazel.eclass')
-rw-r--r--eclass/bazel.eclass9
1 files changed, 8 insertions, 1 deletions
diff --git a/eclass/bazel.eclass b/eclass/bazel.eclass
index 8897ea175a84..1cba19485442 100644
--- a/eclass/bazel.eclass
+++ b/eclass/bazel.eclass
@@ -27,6 +27,13 @@ if [[ ${CATEGORY}/${PN} != "dev-util/bazel" ]]; then
BDEPEND=">=dev-util/bazel-0.20"
fi
+# @ECLASS_VARIABLE: BAZEL_BINARY
+# @DESCRIPTION:
+# The program to invoke for bazel. Defaults to `bazel`. Useful if you have
+# multiple bazel installations on your machine that differ in verson suffix,
+# e.g., `bazel-5`, `bazel-6`.
+BAZEL_BINARY="${BAZEL_BINARY:-bazel}"
+
# @FUNCTION: bazel_get_flags
# @DESCRIPTION:
# Obtain and print the bazel flags for target and host *FLAGS.
@@ -138,7 +145,7 @@ ebazel() {
output_base="${output_base%/}-bazel-base"
mkdir -p "${output_base}" || die
- set -- bazel --bazelrc="${T}/bazelrc" --output_base="${output_base}" ${@}
+ set -- "${BAZEL_BINARY}" --bazelrc="${T}/bazelrc" --output_base="${output_base}" ${@}
echo "${*}" >&2
"${@}" || die "ebazel failed"
}