1# Updating the Bazel prebuilts in AOSP 2 3## Instructions 4 5First, decide which version of Bazel you need. 6 7* A Bazel release (e.g. Bazel 3.7.0) 8* A Bazel nightly 9* A Bazel per-commit build 10 11Whichever of these you use, you will need to use official **nojdk x86-64** 12versions of Bazel, for Linux and macOS (Darwin). 13 14Run the `release_bazel.py` script in the root repository to download 15and verify the binaries from the trusted Bazel CI pipeline: 16 17`python /prebuilts/bazel/common/release_bazel.py --commit <commit>` 18 19To get the commit hash for builds, see the [Bazel releases], [Bazel nightlies] 20or [Bazel per-commit builds] sections below. 21 22this will run `update.sh` which will also: 23 - Download the remote_java_tools prebuilts corresponding 24 to the downloaded Bazel binary 25 - verify that the downloaded binary has the correct SHA-256 26 checksum as provided from Bazel CI metadata. 27 28Once you have the binaries, you will need to create and send up to three CLs, 29to update the Linux, macOS, and platform-agnostic prebuilts that live in separate 30Git repositories, i.e. 31 32* https://android.googlesource.com/platform/prebuilts/bazel/linux-x86_64/ 33* https://android.googlesource.com/platform/prebuilts/bazel/darwin-x86_64/ 34* https://android.googlesource.com/platform/prebuilts/bazel/common/ 35 36The update script does not automatically create CLs, so you need to create them 37manually. In each CL description, mention the testing you did, which should 38at least include: 39 40* For release builds only: **Verifying the file signature**, e.g. 41 * `gpg --import bazel-release.pub.gpg` 42 * Taken from https://bazel.build/bazel-release.pub.gpg 43 * `gpg --verify bazel_nojdk-<commit>-linux-x86_64.sig` 44 * It should say "Good signature from Bazel Developer ..." 45* **Verifying that Bazel starts, on Linux and on macOS**, e.g. 46 * `source build/envsetup.sh` 47 * `bazel info` 48 49Ensure that the CLs are set to the same Gerrit topic so they are submitted together. 50 51## Obtaining Bazel binaries 52 53The `update.sh` script automates downloading Bazel binaries. The next sections 54describe how the different Bazel binaries (release, nightly, per-commit) can be 55manually downloaded from the Bazel CI. 56 57### Bazel releases 58 59The commit hash for linux and darwin **nojdk x86-64** binaries are available from https://github.com/bazelbuild/bazel/releases 60 61### Bazel nightlies 62 63The commit hash and urls for linux and macOS **nojdk x86-64** binaries are available in https://storage.googleapis.com/bazel-builds/metadata/latest.json 64 65### Bazel per-commit builds 66 67You need to know the GitHub commit that contains your change, e.g. 68https://github.com/bazelbuild/bazel/commit/364a867df255c57c8edc4a8aae8f78cb54900a54 69 70And the linux and macOS **nojdk x86-64** binaries are available from: 71 72* `https://storage.googleapis.com/bazel-builds/metadata/<commit>.json` 73 * e.g. https://storage.googleapis.com/bazel-builds/metadata/364a867df255c57c8edc4a8aae8f78cb54900a54.json 74