Add Bazel 8.5.0 build support for simple_switch_grpc + CI workflow#1354
Add Bazel 8.5.0 build support for simple_switch_grpc + CI workflow#1354kunal9812 wants to merge 2 commits intop4lang:mainfrom
Conversation
- Add MODULE.bazel with bzlmod dependencies (protobuf, grpc, boost, jsoncpp, fmt, googletest) - Add WORKSPACE.bzlmod to enable bzlmod mode - Add BUILD files for bmv2_core and simple_switch_grpc targets - Vendor PI library headers and sources into third_party/PI - Vendor GMP and jsoncpp into third_party/ - Add pre-generated protobuf/gRPC sources for services/ - Add GitHub Actions CI workflow (.github/workflows/ci-bazel.yml) - Fix fmt::MemoryWriter compatibility with modern fmt versions - Fix find_lowest_bit template specialization for macOS ARM64 Build verified: bazelisk build //targets/simple_switch_grpc:simple_switch_grpc Tests: 23/26 pass (3 gNMI/multicast tests require network environment) CMake build pre-existing failure confirmed unrelated to this PR GSoC 2026 qualification task for Project 1.1: BMv2 Packet Trace Support Signed-off-by: Kunal Yadav <kunalyadav49101@gmail.com>
970d88a to
88e0819
Compare
|
You should not vendor the dependencies in third party. If we need PI, it makes sense to create a Bazel build there first. |
|
@kunal9812 Please make sure all the existing CIs pass. And besides that, please add a new CI to test the Bazel build and demonstrate it passes as well. |
|
Thank you for the feedback! I understand — vendoring PI sources was a pragmatic workaround to get the build working. |
|
+1 to what @fruffy mentioned. We should not be vendoring our dependencies in 3rd party. These should be gracefully handled using Bazel Please make sure all the builds are working |
|
Thanks for your PR @kunal9812 None of the PRs will be carefully reviewed until Apr 1 (once the contributor deadline is over). Starting today (March 16th), the GSoC contributor application will open. Please make sure you submit your application before the deadline. During the first week of April, after applications and PRs are reviewed, candidates who will be considered will be sent an interview. The contributor who gets admitted into GSoC will have their PR pushed to head cc: @qobilidop |
PI is now referenced as an external Bazel bzlmod dependency via git_override in MODULE.bazel, pointing to p4lang/PI with bzlmod support. This addresses reviewer feedback from fruffy: 'You should not vendor the dependencies in third party. If we need PI, it makes sense to create a Bazel build there first.' PI bzlmod support PR: https://github.com/kunal9812/PI/pull/1
|
Hi @fruffy and @qobilidop — thank you for the feedback!
|
Summary
This PR adds Bazel 8.5.0 build support for
simple_switch_grpcas part ofthe GSoC 2026 qualification task for Project 1.1: BMv2 Packet Trace Support.
What This PR Does
MODULE.bazelwith bzlmod dependencies (protobuf 29.1, grpc 1.71,boost, jsoncpp, fmt, googletest)
WORKSPACE.bzlmodto enable Bazel bzlmod modeBUILDfile at root forbmv2_corelibraryBUILDfile fortargets/simple_switch_grpcthird_party/PI.github/workflows/ci-bazel.yml— builds and tests via BazelVerification
bazelisk build //targets/simple_switch_grpc:simple_switch_grpcpassesbazelisk test //targets/simple_switch_grpc:simple_switch_grpc_test— 23/26 pass (3 gNMI/multicast tests require a running network service)Notes
gNMI.PortOperStatusUpdates,gNMI.PortCounters,Clone.SingletonAndMulticast) require a live gNMI/multicast environment and fail the same way on the original codebaseRelated
GSoC 2026 Project 1.1 qualification task.
Reference repos:
p4lang/p4runtime(Bazel structure),p4lang/p4c(CI workflow).