Skip to content

Commit

Permalink
Drop support for bazel5; switch to all bzlmod.
Browse files Browse the repository at this point in the history
bazel5 is EOL in 2 months. bazel6 and beyond all support bzlmod,
which means we can remove duplicate dependencies in WORKSPACE
and MODULE.bazel.
  • Loading branch information
hzeller committed Dec 16, 2024
1 parent b0aaf2c commit 2ddc596
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 166 deletions.
20 changes: 20 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# bazel < 7 needs explicit enabling of bzlmod dependencies.
build --enable_bzlmod

# Enable support for absl types like string_view in gtest.
build --define="absl=1"

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

# Turn warnings on...
build --copt "-Wall" --host_copt "-Wall"
build --copt "-Wextra" --host_copt "-Wextra"

# ... and disable the warnings we're not interested in.
build --copt "-Wno-sign-compare" --host_copt "-Wno-sign-compare"
build --copt "-Wno-unused-parameter" --host_copt "-Wno-unused-parameter"
build --copt "-Wno-missing-field-initializers" --host_copt "-Wno-missing-field-initializers"

# TODO: The code around this warning looks benign, but should be investigated
build --cxxopt "-Wno-dangling-reference" --host_cxxopt "-Wno-dangling-reference"

# For 3rd party code: Disable warnings entirely.
# They are not actionable and just create noise.
build --per_file_copt=external/.*@-w
build --host_per_file_copt=external/.*@-w

# Address sanitizer settings.
build:asan --strip=never
build:asan --copt -fsanitize=address
Expand Down
2 changes: 1 addition & 1 deletion .github/bin/run-clang-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ find . -name "*.h" -o -name "*.cc" \
# If we have buildifier installed, use that on BUILD files
if command -v ${BUILDIFIER} >/dev/null; then
echo "Run $(buildifier --version)"
${BUILDIFIER} -lint=fix WORKSPACE MODULE.bazel $(find . -name BUILD -o -name "*.bzl")
${BUILDIFIER} -lint=fix MODULE.bazel $(find . -name BUILD -o -name "*.bzl")
fi

# Check if we got any diff
Expand Down
2 changes: 1 addition & 1 deletion .github/settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export BAZEL_CXXOPTS="-std=c++17"
export BAZEL_OPTS="-c opt --noshow_progress"

# Used to fetch the BAZEL version where needed.
export BAZEL_VERSION=5.4.1
export BAZEL_VERSION=6.5.0

# Kythe version for extracting xRefs
export KYTHE_VERSION=v0.0.52
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/verible-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ jobs:
path: |
/root/.cache/clang-tidy
/root/.cache/bazel
key: clang-tidy-${{ steps.cache_timestamp.outputs.time }}
restore-keys: clang-tidy-
key: clang-tidy1-${{ steps.cache_timestamp.outputs.time }}
restore-keys: clang-tidy1-

- name: Build Project genrules
run: |
Expand Down Expand Up @@ -238,8 +238,8 @@ jobs:
if: matrix.mode != 'clean' && matrix.mode != 'coverage'
with:
path: "/root/.cache/bazel"
key: bazelcache3_${{ matrix.arch }}_${{ matrix.mode }}_${{ steps.cache_timestamp.outputs.time }}
restore-keys: bazelcache3_${{ matrix.arch }}_${{ matrix.mode }}_
key: bazelcache_${{ matrix.arch }}_${{ matrix.mode }}_${{ steps.cache_timestamp.outputs.time }}
restore-keys: bazelcache_${{ matrix.arch }}_${{ matrix.mode }}_

- name: Install Dependencies
run: |
Expand Down Expand Up @@ -397,8 +397,8 @@ jobs:
with:
path: |
/private/var/tmp/_bazel_runner
key: bazelcache_macos_${{ steps.cache_timestamp.outputs.time }}
restore-keys: bazelcache_macos_
key: bazelcache_macos1_${{ steps.cache_timestamp.outputs.time }}
restore-keys: bazelcache_macos1_

- name: Tests
# MacOS has a broken patch utility:
Expand Down Expand Up @@ -451,7 +451,7 @@ jobs:
uses: actions/cache@v3
with:
path: "c:/users/runneradmin/_bazel_runneradmin"
key: bazelcache_windows_${{ steps.cache_timestamp.outputs.time }}
key: bazelcache_windows1_${{ steps.cache_timestamp.outputs.time }}
restore-keys: bazelcache_windows_

- name: Install dependencies
Expand Down
157 changes: 0 additions & 157 deletions WORKSPACE

This file was deleted.

Empty file removed WORKSPACE.bzlmod
Empty file.

0 comments on commit 2ddc596

Please sign in to comment.