Skip to content

Commit 27363c8

Browse files
smolkajclaude
andcommitted
Support Bazel 9
Bazel 9 is now released. The only Bzlmod blocker for p4c is that BCR `p4runtime 1.5.0` declares `bazel_compatibility < 9.0.0`. Override it with the tip of the `bazel9-support` branch which lifts that restriction. Update `.bazelversion` so the default Bazel used locally and in CI is 9. Also add a Bazel version matrix to CI (testing 7.x and 9.x) and macOS build fixes: use Command Line Tools clang to avoid requiring a full Xcode install, and raise `macos_minimum_os` to 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 27363c8

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

.bazelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ build --host_cxxopt=-std=c++20
99
# Force the use of Clang for all builds.
1010
build --action_env=CC=clang
1111
build --action_env=CXX=clang++
12+
13+
# macOS: use Command Line Tools clang (avoids requiring a full Xcode install)
14+
# and raise the deployment target to 10.15, which is the minimum for
15+
# std::filesystem support in libc++.
16+
build --repo_env=CC=/usr/bin/clang
17+
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 }}

MODULE.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ bazel_dep(name = "rules_m4", version = "0.3")
2727
bazel_dep(name = "rules_proto", version = "7.1.0")
2828
bazel_dep(name = "z3", version = "4.15.2")
2929
bazel_dep(name = "p4runtime", version = "1.5.0")
30+
git_override(
31+
module_name = "p4runtime",
32+
commit = "0599472658102ceb6853444f2614a443bf8f9bd8",
33+
remote = "https://github.com/p4lang/p4runtime.git",
34+
)
3035

3136
p4c_repositories = use_extension("//bazel:repositories.bzl", "p4c_repositories")
3237
use_repo(

0 commit comments

Comments
 (0)