Skip to content

Commit

Permalink
chore: upgrade to Bazel 8 (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje authored Dec 22, 2024
1 parent e407c18 commit e7ba24b
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4.1
8.0.0
2 changes: 1 addition & 1 deletion .bcr/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
bcr_test_module:
module_path: "examples/gem"
matrix:
bazel: ["7.x", "6.x"]
bazel: ["8.x", "7.x", "6.x"]
# NB: Windows is removed due to https://github.com/bazel-contrib/rules_ruby/issues/64
platform: ["debian10", "macos", "ubuntu2004"]
tasks:
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.9.1
- uses: bazel-contrib/setup-bazel@0.10.0
with:
bazelrc: common --announce_rc --color=yes
repository-cache: true
Expand Down Expand Up @@ -53,11 +53,6 @@ jobs:
# Previews are unavailable on Windows.
- os: windows-latest
ruby: 3.4.0-preview2
# JRuby with bzlmod fails with long path issues on Windows.
# See #64
- os: windows-latest
ruby: jruby-9.4.9.0
mode: bzlmod
# TruffleRuby doesn't work on Windows.
- os: windows-latest
ruby: truffleruby-24.1.1
Expand All @@ -66,9 +61,11 @@ jobs:
working-directory: examples/gem
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.9.1
- uses: bazel-contrib/setup-bazel@0.10.0
with:
bazelrc: common --announce_rc --color=yes ${{ matrix.mode == 'WORKSPACE' && '--noenable_bzlmod' || '' }}
bazelrc: common --announce_rc --color=yes ${{ matrix.mode == 'WORKSPACE' && '--enable_workspace' || '' }}
# Workaround for long path issues: https://github.com/jruby/jruby/issues/3995.
output-base: ${{ matrix.os == 'windows-latest' && 'D:/b' || '' }}
repository-cache: examples/gem/${{ matrix.mode == 'WORKSPACE' && 'WORKSPACE' || 'MODULE.bazel' }}
- run: echo ${{ matrix.ruby }} > .ruby-version
- if: matrix.ruby == 'system'
Expand Down Expand Up @@ -102,7 +99,7 @@ jobs:
working-directory: examples/jekyll
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.9.1
- uses: bazel-contrib/setup-bazel@0.10.0
with:
bazelrc: common --announce_rc --color=yes
repository-cache: examples/jekyll/MODULE.bazel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')

# The stdout of this program will be used as the top of the release notes for this release.
cat << EOF
## Using Bzlmod with Bazel 7
## Using Bzlmod with Bazel 7-8
1. Add to your \`MODULE.bazel\` file:
Expand Down
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
load("@gazelle//:def.bzl", "gazelle", "gazelle_binary")

gazelle_binary(
name = "gazelle_bin",
Expand Down
11 changes: 11 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,15 @@ module(
bazel_dep(name = "bazel_skylib", version = "1.3.0")
bazel_dep(name = "platforms", version = "0.0.5")

# Ruleset development dependencies.
bazel_dep(name = "aspect_bazel_lib", version = "2.10.0", dev_dependency = True)
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.40.0", dev_dependency = True)
bazel_dep(name = "rules_go", version = "0.51.0", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.7.2", dev_dependency = True)

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk", dev_dependency = True)
go_sdk.download(version = "1.23.1")

# TODO: should we register any toolchain by default?
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ This repository hosts [Ruby][1] language ruleset for [Bazel][2].

The ruleset is known to work with:

- Bazel 7 using WORKSPACE and Bzlmod *(tested on CI)*;
- Bazel 8 using WORKSPACE and Bzlmod *(tested on CI)*;
- Bazel 7 using WORKSPACE and Bzlmod *(no longer tested on CI)*;
- Bazel 6 using WORKSPACE and Bzlmod *(no longer tested on CI)*;
- Bazel 5 using WORKSPACE *(no longer tested on CI)*.

Expand Down
111 changes: 0 additions & 111 deletions WORKSPACE

This file was deleted.

12 changes: 10 additions & 2 deletions docs/repository_rules.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions docs/rules.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions examples/gem/.aspect/bazelrc/correctness.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ build --incompatible_strict_action_env
# Without this option, you rely on rules authors to manually check the tags you passed
# and apply relevant ones to the actions they create.
# See https://github.com/bazelbuild/bazel/issues/8830 for details.
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_allow_tags_propagation
build --experimental_allow_tags_propagation
fetch --experimental_allow_tags_propagation
query --experimental_allow_tags_propagation
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_allow_tags_propagation
build --incompatible_allow_tags_propagation
fetch --incompatible_allow_tags_propagation
query --incompatible_allow_tags_propagation

# Do not automatically create `__init__.py` files in the runfiles of Python targets. Fixes the wrong
# default that comes from Google's internal monorepo by using `__init__.py` to delimit a Python
Expand Down
1 change: 1 addition & 0 deletions examples/gem/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ GEM

PLATFORMS
arm64-darwin-23
arm64-darwin-24
java
ruby
universal-java-1.8
Expand Down
11 changes: 7 additions & 4 deletions examples/jekyll/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ package(default_visibility = ["//visibility:public"])

filegroup(
name = "sources",
srcs = glob([
"_posts/**/*",
"_layouts/**/*",
]) + [
srcs = glob(
[
"_posts/**/*",
"_layouts/**/*",
],
allow_empty = True,
) + [
"404.html",
"about.md",
"index.md",
Expand Down
1 change: 1 addition & 0 deletions examples/jekyll/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ GEM

PLATFORMS
arm64-darwin-23
arm64-darwin-24
x86_64-darwin-21
x86_64-linux

Expand Down
2 changes: 1 addition & 1 deletion examples/jekyll/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"Bazel dependencies"

bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "aspect_bazel_lib", version = "2.3.0", dev_dependency = True)
bazel_dep(name = "aspect_bazel_lib", version = "2.9.4", dev_dependency = True)
bazel_dep(name = "rules_ruby", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "rules_ruby",
Expand Down

0 comments on commit e7ba24b

Please sign in to comment.