Skip to content

Commit bacb769

Browse files
authored
Merge pull request #2301 from hzeller/feature-20241215-drop-workspace
Drop support for bazel5; switch to all bzlmod.
2 parents b0aaf2c + d7b1639 commit bacb769

File tree

10 files changed

+63
-288
lines changed

10 files changed

+63
-288
lines changed

.bazelrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# bazel < 7 needs explicit enabling of bzlmod dependencies.
2+
build --enable_bzlmod
3+
14
# Enable support for absl types like string_view in gtest.
25
build --define="absl=1"
36

@@ -26,6 +29,17 @@ common:macos --features=-supports_dynamic_linker --linkopt=-framework --linkopt=
2629
# Since we use designated initializers (C99 ... but >= c++20), compiler really wants the c++20 mode
2730
common:windows --compiler=clang-cl --cxxopt=/std:c++20 --host_cxxopt=/std:c++20 --client_env=BAZEL_CXXOPTS=/std:c++20
2831

32+
build --cxxopt="-Wno-unknown-warning-option" --host_cxxopt="-Wno-unknown-warning-option"
33+
# TODO: this looks like benign where it happens but to be explored further
34+
build --cxxopt="-Wno-dangling-reference" --host_cxxopt="-Wno-dangling-reference"
35+
# Newer bisons create an unused label.
36+
build --cxxopt="-Wno-unused-label" --host_cxxopt="-Wno-unused-label"
37+
38+
# For 3rd party code: Disable warnings entirely.
39+
# They are not actionable and just create noise.
40+
build --per_file_copt=external/.*@-w
41+
build --host_per_file_copt=external/.*@-w
42+
2943
# Address sanitizer settings.
3044
build:asan --strip=never
3145
build:asan --copt -fsanitize=address

.github/bin/run-clang-format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ find . -name "*.h" -o -name "*.cc" \
3232
# If we have buildifier installed, use that on BUILD files
3333
if command -v ${BUILDIFIER} >/dev/null; then
3434
echo "Run $(buildifier --version)"
35-
${BUILDIFIER} -lint=fix WORKSPACE MODULE.bazel $(find . -name BUILD -o -name "*.bzl")
35+
${BUILDIFIER} -lint=fix MODULE.bazel $(find . -name BUILD -o -name "*.bzl")
3636
fi
3737

3838
# Check if we got any diff

.github/settings.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export BAZEL_CXXOPTS="-std=c++17"
3232
export BAZEL_OPTS="-c opt --noshow_progress"
3333

3434
# Used to fetch the BAZEL version where needed.
35-
export BAZEL_VERSION=5.4.1
35+
export BAZEL_VERSION=6.5.0
3636

3737
# Kythe version for extracting xRefs
3838
export KYTHE_VERSION=v0.0.52

.github/workflows/verible-ci.yml

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -103,20 +103,20 @@ jobs:
103103
path: |
104104
/root/.cache/clang-tidy
105105
/root/.cache/bazel
106-
key: clang-tidy-${{ steps.cache_timestamp.outputs.time }}
107-
restore-keys: clang-tidy-
106+
key: clang-tidy2-${{ steps.cache_timestamp.outputs.time }}
107+
restore-keys: clang-tidy2-
108108

109109
- name: Build Project genrules
110110
run: |
111111
# Fetch all dependencies and run genrules for bant to see every file
112-
# that makes it into the compile to build comile DB.f
113-
bazel fetch ...
112+
# that makes it into the compile to build comile DB.
114113
bazel build \
115114
//verible/common/analysis:command-file-lexer \
116115
//verible/verilog/parser:verilog-lex \
117116
//verible/verilog/parser:verilog-y \
118117
//verible/verilog/parser:verilog-y-final \
119-
//verible/common/analysis:command-file-lexer_test
118+
//verible/common/analysis:command-file-lexer_test \
119+
//verible/common/lsp:lsp-text-buffer
120120
bazel build $(bin/bant -q genrule-outputs | awk '{print $2}') \
121121
$(bin/bant list-targets | grep cc_proto_library | awk '{print $3}')
122122
@@ -164,7 +164,6 @@ jobs:
164164
run: |
165165
# Fetch all dependencies and run genrules for bant to see every file
166166
# that makes it into the compile. Use bant itself to find genrules.
167-
bazel fetch ...
168167
bazel build $(bin/bant -q genrule-outputs | awk '{print $2}') \
169168
//verible/common/analysis:command-file-lexer \
170169
//verible/verilog/parser:verilog-lex \
@@ -195,7 +194,6 @@ jobs:
195194
- compile-clang
196195
- compile-static
197196
- compile-static-clang
198-
- coverage
199197
- clean
200198
arch:
201199
- x86_64
@@ -211,8 +209,6 @@ jobs:
211209
arch: arm64
212210
- mode: asan-clang
213211
arch: arm64
214-
- mode: coverage
215-
arch: arm64
216212
env:
217213
MODE: ${{ matrix.mode }}
218214
ARCH: ${{ matrix.arch }}
@@ -238,8 +234,8 @@ jobs:
238234
if: matrix.mode != 'clean' && matrix.mode != 'coverage'
239235
with:
240236
path: "/root/.cache/bazel"
241-
key: bazelcache3_${{ matrix.arch }}_${{ matrix.mode }}_${{ steps.cache_timestamp.outputs.time }}
242-
restore-keys: bazelcache3_${{ matrix.arch }}_${{ matrix.mode }}_
237+
key: bazelcache_${{ matrix.arch }}_${{ matrix.mode }}_${{ steps.cache_timestamp.outputs.time }}
238+
restore-keys: bazelcache_${{ matrix.arch }}_${{ matrix.mode }}_
243239

244240
- name: Install Dependencies
245241
run: |
@@ -274,15 +270,6 @@ jobs:
274270
- name: ${{ matrix.mode }} Verible
275271
run: ./.github/bin/build-and-test.sh
276272

277-
- name: Upload coverage
278-
# will show up under https://app.codecov.io/gh/chipsalliance/verible
279-
if: matrix.mode == 'coverage'
280-
uses: codecov/codecov-action@v2
281-
with:
282-
files: bazel-out/_coverage/_coverage_report.dat
283-
verbose: true
284-
continue-on-error: true
285-
286273
- name: Gather and pack binaries
287274
if: matrix.mode == 'compile' && matrix.arch == 'x86_64'
288275
run: |
@@ -397,8 +384,8 @@ jobs:
397384
with:
398385
path: |
399386
/private/var/tmp/_bazel_runner
400-
key: bazelcache_macos_${{ steps.cache_timestamp.outputs.time }}
401-
restore-keys: bazelcache_macos_
387+
key: bazelcache_macos1_${{ steps.cache_timestamp.outputs.time }}
388+
restore-keys: bazelcache_macos1_
402389

403390
- name: Tests
404391
# MacOS has a broken patch utility:
@@ -451,14 +438,14 @@ jobs:
451438
uses: actions/cache@v3
452439
with:
453440
path: "c:/users/runneradmin/_bazel_runneradmin"
454-
key: bazelcache_windows_${{ steps.cache_timestamp.outputs.time }}
455-
restore-keys: bazelcache_windows_
441+
key: bazelcache_windows3_${{ steps.cache_timestamp.outputs.time }}
442+
restore-keys: bazelcache_windows3_
456443

457444
- name: Install dependencies
458445
run: |
459-
choco install bazel --force --version=6.4.0
446+
choco install bazel --force --version=6.5.0
460447
choco install winflexbison3
461-
choco install llvm --allow-downgrade --version=16.0.6
448+
choco install llvm --allow-downgrade --version=17.0.6
462449
463450
- name: Debug bazel directory settings
464451
# We need to explicitly call the bazel binary from choco, otherwise

MODULE.bazel

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ module(
22
name = "verible",
33
)
44

5-
bazel_dep(name = "platforms", version = "0.0.8")
6-
bazel_dep(name = "bazel_skylib", version = "1.5.0")
7-
bazel_dep(name = "rules_license", version = "0.0.8")
8-
bazel_dep(name = "rules_proto", version = "6.0.0-rc2")
9-
bazel_dep(name = "rules_cc", version = "0.0.9")
5+
bazel_dep(name = "platforms", version = "0.0.10")
6+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
7+
bazel_dep(name = "rules_license", version = "1.0.0")
8+
bazel_dep(name = "nlohmann_json", version = "3.11.3.bcr.1", repo_name = "jsonhpp")
9+
bazel_dep(name = "re2", version = "2024-07-02.bcr.1", repo_name = "com_googlesource_code_re2")
10+
bazel_dep(name = "zlib", version = "1.3.1.bcr.3")
1011

11-
# Register m4 rules and toolchain.
12+
# Register m4/flex/bison rules and toolchains
1213
bazel_dep(name = "rules_m4", version = "0.2.3")
1314

1415
m4 = use_extension(
@@ -24,23 +25,6 @@ use_repo(m4, "m4")
2425

2526
register_toolchains("@m4//:toolchain")
2627

27-
# Register bison rules and toolchain.
28-
bazel_dep(name = "rules_bison", version = "0.3")
29-
30-
bison = use_extension(
31-
"@rules_bison//bison/extensions:bison_repository_ext.bzl",
32-
"bison_repository_ext",
33-
)
34-
bison.repository(
35-
name = "bison",
36-
extra_copts = ["-O3"],
37-
version = "3.3.2",
38-
)
39-
use_repo(bison, "bison")
40-
41-
register_toolchains("@bison//:toolchain")
42-
43-
# Register flex rules and toolchain.
4428
bazel_dep(name = "rules_flex", version = "0.3")
4529

4630
flex = use_extension(
@@ -56,9 +40,25 @@ use_repo(flex, "flex")
5640

5741
register_toolchains("@flex//:toolchain")
5842

43+
bazel_dep(name = "rules_bison", version = "0.3")
44+
45+
bison = use_extension(
46+
"@rules_bison//bison/extensions:bison_repository_ext.bzl",
47+
"bison_repository_ext",
48+
)
49+
bison.repository(
50+
name = "bison",
51+
extra_copts = ["-O3"],
52+
version = "3.3.2",
53+
)
54+
use_repo(bison, "bison")
55+
56+
register_toolchains("@bison//:toolchain")
57+
5958
# abseil-cpp and googletest can not be updated beyond the following currently,
6059
# as newer googletest is not compatible with bazel 6 anymore, and abseil-cpp
61-
# depends on it :( -- to support all active bazel's, we're stuck till Dec 2025.
60+
# depends on it :( -- to support all active bazel's, we're stuck till EOL bazel6
61+
bazel_dep(name = "googletest", version = "1.14.0.bcr.1", repo_name = "com_google_googletest")
6262
bazel_dep(name = "abseil-cpp", version = "20240116.2", repo_name = "com_google_absl")
6363
single_version_override(
6464
module_name = "abseil-cpp",
@@ -67,8 +67,10 @@ single_version_override(
6767
version = "20240116.2",
6868
)
6969

70-
bazel_dep(name = "googletest", version = "1.14.0.bcr.1", repo_name = "com_google_googletest")
71-
bazel_dep(name = "nlohmann_json", version = "3.11.3.bcr.1", repo_name = "jsonhpp")
72-
bazel_dep(name = "protobuf", version = "26.0", repo_name = "com_google_protobuf")
73-
bazel_dep(name = "re2", version = "2023-09-01", repo_name = "com_googlesource_code_re2")
74-
bazel_dep(name = "zlib", version = "1.3.1")
70+
# Last protobuf version working with windows without strange linking errors.
71+
# This also means that we unfortunately can't use the @protobuf//bazel rules
72+
# but have to use rules_cc and rules_proto.
73+
# TODO: figure out how we can make proto compile beyond 24.4 on Windows.
74+
bazel_dep(name = "protobuf", version = "24.4", repo_name = "com_google_protobuf")
75+
bazel_dep(name = "rules_cc", version = "0.0.9")
76+
bazel_dep(name = "rules_proto", version = "6.0.0-rc2")

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ the nix package manager simply run `nix-shell` to get a build environment.
183183

184184
```bash
185185
# Build all tools and libraries
186-
# bazel 5/6/7
186+
# bazel 6/7/8
187187
bazel build -c opt //...
188188
```
189189

0 commit comments

Comments
 (0)