diff --git a/base/debian/control b/base/debian/control index e9b6490a363..2006e3b0332 100644 --- a/base/debian/control +++ b/base/debian/control @@ -2,7 +2,7 @@ Source: cuttlefish-common Maintainer: Cuttlefish Team Section: misc Priority: optional -Build-Depends: bazel [amd64], +Build-Depends: bazelisk, cmake, config-package-dev, debhelper-compat (= 12), @@ -113,7 +113,7 @@ Description: Utilities for Android cuttlefish devices in the cloud Package: cuttlefish-defaults Architecture: any -Build-Depends: bazel [amd64], +Build-Depends: bazelisk, dh-exec Depends: cuttlefish-base, Description: May potentially enable new or experimental cuttlefish diff --git a/tools/buildutils/installbazel.sh b/tools/buildutils/installbazel.sh index 486efef6b39..ef351ddfa45 100755 --- a/tools/buildutils/installbazel.sh +++ b/tools/buildutils/installbazel.sh @@ -14,30 +14,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Install bazel (https://bazel.build/install/ubuntu) +# Install bazel via bazelisk (https://github.com/bazelbuild/bazelisk) set -e -function install_bazel_x86_64() { - echo "Installing bazel" - apt install apt-transport-https curl gnupg -y - curl -fsSL https://releases.bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg - mv bazel-archive-keyring.gpg /usr/share/keyrings - echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list - # bazel needs the zip command to gather test outputs but doesn't depend on it - apt-get update && apt-get install -y bazel zip unzip -} +BAZELISK_VERSION=v1.29.0 -function install_bazel_aarch64() { - BAZELISK_VERSION=v1.19.0 - apt install wget - tmpdir="$(mktemp -t -d bazel_installer_XXXXXX)" - trap "rm -rf $tmpdir" EXIT - pushd "${tmpdir}" - wget "https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-arm64" - mv bazelisk-linux-arm64 /usr/local/bin/bazel - chmod 0755 /usr/local/bin/bazel - popd -} +ARCH=$(uname -m) +if [ "${ARCH}" = "x86_64" ]; then + ARCH="amd64" +elif [ "${ARCH}" = "aarch64" ]; then + ARCH="arm64" +fi -install_bazel_$(uname -m) +apt install -y build-essential wget +tmpdir="$(mktemp -t -d bazel_installer_XXXXXX)" +trap "rm -rf $tmpdir" EXIT +pushd "${tmpdir}" +wget "https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-${ARCH}.deb" +apt install -y "./bazelisk-${ARCH}.deb" +popd