Skip to content

Commit 662e950

Browse files
committed
Add support for Bzlmod and Bazel 7/8 (fixes #515, fixes #516).
Signed-off-by: Steffen Smolka <smolkaj@google.com>
1 parent a41e728 commit 662e950

File tree

17 files changed

+126
-21
lines changed

17 files changed

+126
-21
lines changed

.github/workflows/ci-build-proto.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: "build protobufs"
22

33
on:
44
push:
5-
branches:
5+
branches:
66
- main
77
- '*-dev'
88
pull_request:
9-
branches:
9+
branches:
1010
- main
1111
- '*-dev'
1212
schedule:
@@ -21,7 +21,7 @@ jobs:
2121
- uses: actions/checkout@v2
2222
with:
2323
submodules: recursive
24-
24+
2525
- name: Mount bazel cache
2626
uses: actions/cache@v2
2727
with:
@@ -33,14 +33,11 @@ jobs:
3333
restore-keys: |
3434
bazel-${{ runner.os }}-build-
3535
36-
- name: Install bazelisk
37-
run: |
38-
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.15.0/$BAZEL"
39-
chmod +x $BAZEL
40-
sudo mv $BAZEL /usr/local/bin/bazel
41-
4236
- name: Build proto/
4337
run: cd proto && bazel build //... && bazel test //...
4438

45-
- name: Build bazel/example/
46-
run: cd bazel/example/ && bazel build //...
39+
- name: Build bazel/example/using-workspace/
40+
run: cd bazel/example/using-workspace && bazel build //...
41+
42+
- name: Build bazel/example/using-bzlmod/
43+
run: cd bazel/example/using-bzlmod && bazel build //...

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# Emacs
22
*~
33
docs/v1/build/
4-
bazel-*
54
.DS_Store
65
build
76
dist
87
*.egg-info
98
.eggs
109

11-
# rust
10+
# Rust
1211
target/
12+
13+
# Bazel
14+
bazel-*
15+
*.lock

bazel/example/.bazelrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

bazel/example/.bazelversion

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Use Bzlmod (`MODULE.bazel`) instead of `WORKSPACE.bazel`.
2+
common --enable_bzlmod
3+
common --noenable_workspace
4+
5+
# C++14 required for recent gRPC versions
6+
build --cxxopt='-std=c++14'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
bazel_dep(
2+
name = "p4runtime",
3+
repo_name = "com_github_p4lang_p4runtime",
4+
)
5+
6+
# In your own project, you will likely want to use `http_archive` instead
7+
# of `local_repository` to load p4runtime.
8+
local_path_override(
9+
module_name = "p4runtime",
10+
path = "../../../proto",
11+
)
12+
13+
# git_override(
14+
# module_name = "p4runtime",
15+
# strip_prefix = "p4runtime-1.4.1/proto",
16+
# urls = ["https://github.com/p4lang/p4runtime/archive/v1.4.1.tar.gz"],
17+
# # sha256 = "<insert hash value here>",
18+
# )
19+
20+
bazel_dep(
21+
name = "protobuf",
22+
version = "29.1",
23+
repo_name = "com_google_protobuf",
24+
)
File renamed without changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Use `WORKSPACE.bazel` instead of bzlmod (`MODULE.bazel`).
2+
common --enable_workspace
3+
common --noenable_bzlmod
4+
5+
# C++14 required for recent gRPC versions
6+
build --cxxopt='-std=c++14'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.4.1

0 commit comments

Comments
 (0)