Skip to content

Commit 59bf7db

Browse files
smolkajclaude
andcommitted
Support Bazel 9
Bazel 9 is now released. The only blocker is that BCR `p4runtime 1.5.0` declares `bazel_compatibility < 9.0.0`. Suppress the check via `--check_bazel_compatibility=off` until a new p4runtime BCR release is cut (tracked in p4lang/p4runtime#597). Unlike `git_override`, this flag works for modules published to the BCR. Also add a Bazel version matrix to CI (7.x and 9.x), and fix macOS builds: use Command Line Tools clang to avoid requiring a full Xcode install, and set `macos_minimum_os=10.15` which is the minimum for `std::filesystem` support in libc++. Signed-off-by: Steffen Smolka <steffen.smolka@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1999cd9 commit 59bf7db

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

.bazelrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
22
common --enable_bzlmod
33
common --noenable_workspace
44

5+
# p4runtime 1.5.0 declares bazel_compatibility < 9.0.0 in its BCR entry.
6+
# That restriction is overly conservative; the fix is tracked upstream at
7+
# https://github.com/p4lang/p4runtime/pull/597. Until a new p4runtime BCR
8+
# release is cut, suppress the compatibility check.
9+
common --check_bazel_compatibility=off
10+
511
# Use C++20.
612
build --cxxopt=-std=c++20
713
build --host_cxxopt=-std=c++20
814

915
# Force the use of Clang for all builds.
1016
build --action_env=CC=clang
1117
build --action_env=CXX=clang++
18+
19+
# macOS: use Command Line Tools clang (avoids requiring a full Xcode install)
20+
# and raise the deployment target to 10.15, which is the minimum for
21+
# std::filesystem support in libc++.
22+
build --repo_env=CC=/usr/bin/clang
23+
build --macos_minimum_os=10.15

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.5.0
1+
9.0.0

.github/workflows/ci-bazel.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ jobs:
3636
build_direct: # Build p4c directly.
3737
needs: format_bazel_files
3838
runs-on: ubuntu-latest
39+
strategy:
40+
matrix:
41+
# Test oldest and newest supported Bazel; assume versions in between also work.
42+
bazel_version: [7.x, 9.x]
43+
fail-fast: false
44+
env:
45+
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
3946
steps:
4047
- uses: actions/checkout@v6
4148
with:
@@ -45,9 +52,9 @@ jobs:
4552
uses: actions/cache/restore@v5
4653
with:
4754
path: ~/.cache/bazel
48-
key: ${{ runner.os }}-bazel-direct-${{ hashFiles('**/*.bazel*', '**/*.bzl') }}
55+
key: ${{ runner.os }}-bazel-${{ matrix.bazel_version }}-direct-${{ hashFiles('**/*.bazel*', '**/*.bzl') }}
4956
restore-keys: |
50-
${{ runner.os }}-bazel-direct-
57+
${{ runner.os }}-bazel-${{ matrix.bazel_version }}-direct-
5158
5259
- name: Save start time
5360
run: echo "START_TIME=$(date +%s)" >> "$GITHUB_ENV"
@@ -68,11 +75,18 @@ jobs:
6875
if: always() && (github.ref_name == 'main' || env.duration > 180)
6976
with:
7077
path: ~/.cache/bazel
71-
key: ${{ runner.os }}-bazel-direct-${{ hashFiles('**/*.bazel*', '**/*.bzl') }}-${{ github.run_id }}
78+
key: ${{ runner.os }}-bazel-${{ matrix.bazel_version }}-direct-${{ hashFiles('**/*.bazel*', '**/*.bzl') }}-${{ github.run_id }}
7279

7380
build_indirect: # Build 3rd party Bazel project depending on p4c as a subproject.
7481
needs: format_bazel_files
7582
runs-on: ubuntu-latest
83+
strategy:
84+
matrix:
85+
# Test oldest and newest supported Bazel; assume versions in between also work.
86+
bazel_version: [7.x, 9.x]
87+
fail-fast: false
88+
env:
89+
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
7690
steps:
7791
- uses: actions/checkout@v6
7892
with:
@@ -82,9 +96,9 @@ jobs:
8296
uses: actions/cache/restore@v5
8397
with:
8498
path: ~/.cache/bazel
85-
key: ${{ runner.os }}-bazel-indirect-${{ hashFiles('**/*.bazel*', '**/*.bzl') }}
99+
key: ${{ runner.os }}-bazel-${{ matrix.bazel_version }}-indirect-${{ hashFiles('**/*.bazel*', '**/*.bzl') }}
86100
restore-keys: |
87-
${{ runner.os }}-bazel-indirect-
101+
${{ runner.os }}-bazel-${{ matrix.bazel_version }}-indirect-
88102
89103
- name: Save start time
90104
run: echo "START_TIME=$(date +%s)" >> "$GITHUB_ENV"
@@ -107,4 +121,4 @@ jobs:
107121
if: always() && (github.ref_name == 'main' || env.duration > 180)
108122
with:
109123
path: ~/.cache/bazel
110-
key: ${{ runner.os }}-bazel-indirect-${{ hashFiles('**/*.bazel*', '**/*.bzl') }}-${{ github.run_id }}
124+
key: ${{ runner.os }}-bazel-${{ matrix.bazel_version }}-indirect-${{ hashFiles('**/*.bazel*', '**/*.bzl') }}-${{ github.run_id }}

0 commit comments

Comments
 (0)