Skip to content

Commit 6efe573

Browse files
committed
Upgrade bazel to 5.0.0
These are the commands I used to generate the bazel xz file: $ wget 'https://github.com/bazelbuild/bazel/releases/download/5.0.0/bazel-5.0.0-linux-x86_64' $ xz bazel-5.0.0-linux-x86_64 $ mv bazel-5.0.0-linux-x86_64.xz bazel_5.0.0.xz I had to tweak `.bazelrc` a bit because some options were promoted from experimental status to non-experimental status. A couple of incompatible flags are gone now too. I had to change some of our Java setup as per bazelbuild/bazel#7849. It's not obvious to me that I did it correctly, but bazel doesn't seem to complain about the new options I added. The `--watchfs` in `tools/ci/buildkite.yaml` was generating this error: ERROR: --watchfs as startup option is deprecated, replace it with the equivalent command option. For example, instead of 'bazel --watchfs build //foo', run 'bazel build --watchfs //foo'. As far as I can tell, the `common --watchfs` option in our `.bazelrc` should cover this. So I deleted the option from our buildkite config. Signed-off-by: Philipp Schrader <[email protected]> Change-Id: Ie85e68a1437c924d6dd4e7c4089e7d3d4e4cab90
1 parent e83c14d commit 6efe573

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

.bazelrc

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ build --host_platform=//tools/platforms:linux_x86
1515
build --strip=never
1616

1717
build --noincompatible_disable_nocopts
18-
common --noincompatible_restrict_string_escapes
1918

2019
# Use the malloc we want.
2120
build --custom_malloc=//tools/cpp:malloc
@@ -78,7 +77,7 @@ build --show_result 5
7877
# Dump the output of the failing test to stdout.
7978
test --test_output=errors
8079

81-
build --experimental_sandbox_base=/dev/shm/
80+
build --sandbox_base=/dev/shm/
8281
build --experimental_multi_threaded_digest
8382

8483
build --sandbox_fake_hostname=true
@@ -92,15 +91,15 @@ common --watchfs
9291
startup --host_jvm_args=-Dbazel.DigestFunction=SHA256
9392

9493
build --spawn_strategy=linux-sandbox
95-
build --experimental_sandbox_default_allow_network=false
94+
build --sandbox_default_allow_network=false
9695

9796
build --strategy=TypeScriptCompile=worker --strategy=AngularTemplateCompile=worker
9897

9998
# Use our hermetic JDK.
10099
# Note that this doesn't quite work fully, but it should. See
101100
# https://github.com/bazelbuild/bazel/issues/6341 for ongoing discussion with
102101
# upstream about this.
103-
build --javabase=@openjdk_linux_archive//:jdk --host_javabase=@openjdk_linux_archive//:jdk
102+
build --java_runtime_version=openjdk_9 --tool_java_runtime_version=openjdk_9
104103

105104
# Prevent falling back to the host JDK.
106105
startup --noautodetect_server_javabase

WORKSPACE

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ workspace(name = "org_frc971")
22

33
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
44
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
5+
load("@bazel_tools//tools/jdk:remote_java_repository.bzl", "remote_java_repository")
56
load(
67
"//debian:python.bzl",
78
python_debs = "files",
@@ -614,20 +615,19 @@ http_archive(
614615
)
615616

616617
# Java9 JDK.
617-
http_archive(
618+
remote_java_repository(
618619
name = "openjdk_linux_archive",
619-
build_file_content = """
620-
java_runtime(
621-
name = 'jdk',
622-
srcs = glob(['**']),
623-
visibility = ['//visibility:public'],
624-
)
625-
""",
620+
exec_compatible_with = [
621+
"@platforms//cpu:x86_64",
622+
"@platforms//os:linux",
623+
],
624+
prefix = "openjdk",
626625
sha256 = "f27cb933de4f9e7fe9a703486cf44c84bc8e9f138be0c270c9e5716a32367e87",
627626
strip_prefix = "zulu9.0.7.1-jdk9.0.7-linux_x64-allmodules",
628627
urls = [
629628
"https://www.frc971.org/Build-Dependencies/zulu9.0.7.1-jdk9.0.7-linux_x64-allmodules.tar.gz",
630629
],
630+
version = "9",
631631
)
632632

633633
local_repository(

tools/bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if [[ -n "${BAZEL_OVERRIDE+x}" ]]; then
2424
exec "${BAZEL_OVERRIDE}" "$@"
2525
fi
2626

27-
readonly VERSION="4.2.2"
27+
readonly VERSION="5.0.0"
2828

2929
readonly DOWNLOAD_DIR="${HOME}/.cache/bazel"
3030
# Directory to unpack bazel into. This must change whenever bazel changes.

tools/ci/buildkite.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
env:
2-
STARTUP: --max_idle_secs=0 --watchfs
2+
STARTUP: --max_idle_secs=0
33
COMMON: -c opt --stamp=no --curses=yes --symlink_prefix=/ --disk_cache=~/.cache/bazel/disk_cache/ --repo_env=FRC971_RUNNING_IN_CI=1
44
TARGETS: //... @com_github_google_glog//... @com_google_ceres_solver//... @com_github_rawrtc_rawrtc//... @com_google_googletest//...
55
M4F_TARGETS: //...

0 commit comments

Comments
 (0)