#!/usr/bin/env bash # SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 BAZEL_VERSION="$1" shift set +e local_bazel_ver=$(bazel version 2>&1 | grep -i label | awk '{print $3}') if [[ "$local_bazel_ver" == "$BAZEL_VERSION" ]]; then exit 0 fi set -e # Install Bazelâ„¢ mkdir -p /bazel cd /bazel if [[ ! -f "bazel-$BAZEL_VERSION-installer-linux-x86_64.sh" ]]; then curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh fi chmod +x /bazel/bazel-*.sh /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh