Skip to content

Commit 970d887

Browse files
authored
Add p4runtime 1.5.0.bcr.1 (#7742)
## Motivation The 1.5.0 BCR entry declares `bazel_compatibility = [">=7.0.0", "<9.0.0"]`, blocking downstream users from upgrading to Bazel 9. The upper bound is overly conservative — no Bazel-9-specific incompatibilities were found. This entry adds a `.bcr.1` release that removes it so BCR users can adopt Bazel 9. The upstream fix is tracked at p4lang/p4runtime#597. ## Implementation A single patch (`fix_bazel_files.patch`) transforms the raw source tarball into the desired state, mirroring the structure of the existing `1.5.0` entry: - `MODULE.bazel`: remove upper bound and TODO comment, bump version to `1.5.0.bcr.1`, add `re2` dep (required by gRPC on Bazel 9), update `googleapis`/`grpc`/`protobuf` to latest BCR versions - `proto/p4/{config/v1,v1}/BUILD.bazel`: load `proto_library` from `@protobuf//bazel` rather than the deprecated `@rules_proto` - `presubmit.yml`: test on Bazel 7.x and 9.x
1 parent 445d1ea commit 970d887

File tree

5 files changed

+127
-1
lines changed

5 files changed

+127
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module(
2+
name = "p4runtime",
3+
bazel_compatibility = [">=7.0.0"],
4+
version = "1.5.0.bcr.1",
5+
)
6+
7+
bazel_dep(name = "bazel_skylib", version = "1.9.0")
8+
bazel_dep(name = "googleapis", version = "0.0.0-20260130-c0fcb356")
9+
bazel_dep(name = "googleapis-cc", version = "1.0.0")
10+
bazel_dep(name = "googleapis-go", version = "1.0.0")
11+
bazel_dep(name = "googleapis-python", version = "1.0.0")
12+
bazel_dep(name = "googleapis-grpc-cc", version = "1.0.0")
13+
bazel_dep(name = "grpc", version = "1.76.0")
14+
bazel_dep(name = "protobuf", version = "33.5")
15+
bazel_dep(name = "re2", version = "2025-11-05.bcr.1")
16+
bazel_dep(name = "rules_cc", version = "0.2.16")
17+
bazel_dep(name = "rules_go", version = "0.60.0")
18+
bazel_dep(name = "rules_license", version = "1.0.0")
19+
20+
# Including this allows us to autoformat all Bazel files by running
21+
# ```
22+
# bazel run -- @buildifier_prebuilt//:buildifier -lint=fix -r $(bazel info workspace)
23+
# ```
24+
bazel_dep(name = "buildifier_prebuilt", version = "8.2.1.1", dev_dependency = True)
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
diff --git MODULE.bazel MODULE.bazel
2+
index c68a9c2..f9eb9e0 100644
3+
--- MODULE.bazel
4+
+++ MODULE.bazel
5+
@@ -1,28 +1,21 @@
6+
module(
7+
name = "p4runtime",
8+
- # TODO(#582): Remove upper bound once we support Bazel 9.x.
9+
- bazel_compatibility = [">=7.0.0", "<9.0.0"],
10+
- version = "1.5.0",
11+
+ bazel_compatibility = [">=7.0.0"],
12+
+ version = "1.5.0.bcr.1",
13+
)
14+
15+
-bazel_dep(name = "bazel_skylib", version = "1.7.1")
16+
+bazel_dep(name = "bazel_skylib", version = "1.9.0")
17+
+bazel_dep(name = "googleapis", version = "0.0.0-20260130-c0fcb356")
18+
+bazel_dep(name = "googleapis-cc", version = "1.0.0")
19+
+bazel_dep(name = "googleapis-go", version = "1.0.0")
20+
+bazel_dep(name = "googleapis-python", version = "1.0.0")
21+
+bazel_dep(name = "googleapis-grpc-cc", version = "1.0.0")
22+
+bazel_dep(name = "grpc", version = "1.76.0")
23+
+bazel_dep(name = "protobuf", version = "33.5")
24+
+bazel_dep(name = "re2", version = "2025-11-05.bcr.1")
25+
bazel_dep(name = "rules_cc", version = "0.2.16")
26+
-bazel_dep(name = "googleapis", version = "0.0.0-20240819-fe8ba054a")
27+
-bazel_dep(name = "grpc", version = "1.68.0")
28+
-bazel_dep(name = "protobuf", version = "29.1")
29+
+bazel_dep(name = "rules_go", version = "0.60.0")
30+
bazel_dep(name = "rules_license", version = "1.0.0")
31+
-bazel_dep(name = "rules_proto", version = "7.0.2")
32+
-bazel_dep(name = "rules_go", version = "0.59.0")
33+
-bazel_dep(name = "gazelle", version = "0.45.0")
34+
-
35+
-switched_rules = use_extension("@googleapis//:extensions.bzl", "switched_rules")
36+
-switched_rules.use_languages(
37+
- cc = True,
38+
- go = True,
39+
- grpc = True,
40+
- python = True,
41+
-)
42+
-use_repo(switched_rules, googleapis_imports = "com_google_googleapis_imports")
43+
44+
# Including this allows us to autoformat all Bazel files by running
45+
# ```
46+
diff --git proto/p4/config/v1/BUILD.bazel proto/p4/config/v1/BUILD.bazel
47+
index 787e5de..8f09324 100644
48+
--- proto/p4/config/v1/BUILD.bazel
49+
+++ proto/p4/config/v1/BUILD.bazel
50+
@@ -2,7 +2,7 @@ load("@bazel_skylib//rules:build_test.bzl", "build_test")
51+
load("@grpc//bazel:python_rules.bzl", "py_proto_library")
52+
load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
53+
load("@rules_go//proto:def.bzl", "go_proto_library")
54+
-load("@rules_proto//proto:defs.bzl", "proto_library")
55+
+load("@protobuf//bazel:proto_library.bzl", "proto_library")
56+
57+
package(
58+
default_visibility = ["//visibility:public"],
59+
diff --git proto/p4/v1/BUILD.bazel proto/p4/v1/BUILD.bazel
60+
index a6608ab..57931bb 100644
61+
--- proto/p4/v1/BUILD.bazel
62+
+++ proto/p4/v1/BUILD.bazel
63+
@@ -3,7 +3,7 @@ load("@grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
64+
load("@grpc//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
65+
load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
66+
load("@rules_go//proto:def.bzl", "go_proto_library")
67+
-load("@rules_proto//proto:defs.bzl", "proto_library")
68+
+load("@protobuf//bazel:proto_library.bzl", "proto_library")
69+
70+
package(
71+
default_visibility = ["//visibility:public"],
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
matrix:
2+
platform: ["ubuntu2204", "ubuntu2404"]
3+
bazel: [7.x, 8.x, 9.x]
4+
5+
tasks:
6+
verify_targets:
7+
name: "Verify build targets"
8+
platform: ${{ platform }}
9+
bazel: ${{ bazel }}
10+
build_flags:
11+
# Required for Bazel 7, which defaults to C++14. Can be dropped once
12+
# Bazel 7 support is removed.
13+
- "--cxxopt=-std=c++17"
14+
- "--host_cxxopt=-std=c++17"
15+
# In Bazel 9, native C++ rules are no longer autoloaded by default.
16+
# Some gRPC bundled sources still use `native.cc_library` and
17+
# `native.cc_binary`. Restore the autoload until a fixed gRPC BCR
18+
# release is available. No-op on Bazel 7.
19+
- "--incompatible_autoload_externally=+cc_library,+cc_binary"
20+
build_targets:
21+
- "@p4runtime//..."
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"integrity": "sha256-Rnpiziy1n8Fr/gpD/ugWH9iI6joaCnFW137o5XHDOYM=",
3+
"strip_prefix": "p4runtime-1.5.0",
4+
"url": "https://github.com/p4lang/p4runtime/releases/download/v1.5.0/p4runtime-1.5.0.tar.gz",
5+
"patch_strip": 0,
6+
"patches": {
7+
"fix_bazel_files.patch": "sha256-uKPDZHEaVI6MofYylVnV40JhaljghR2l+oSf/Mp873g="
8+
}
9+
}

modules/p4runtime/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"github:p4lang/p4runtime"
2929
],
3030
"versions": [
31-
"1.5.0"
31+
"1.5.0",
32+
"1.5.0.bcr.1"
3233
]
3334
}

0 commit comments

Comments
 (0)