Skip to content

Update Bazel to v8 on earlgrey_1.0.0 #27433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Jul 25, 2025

Conversation

jwnrt
Copy link
Contributor

@jwnrt jwnrt commented Jun 13, 2025

Depends on (and includes commits from) #27425. Only the last commit is new.

This PR bumps the Bazel version from 7.3.1 to 8.0.1, matching master.

$ ./ci/scripts/check-pr-changes-allowed.py <(git diff earlgrey_1.0.0 --name-only)
No unauthorized changes, clear to merge

@jwnrt jwnrt marked this pull request as ready for review June 13, 2025 17:24
@jwnrt jwnrt requested review from rswarbrick, a team, msfschaffner and cfrantz as code owners June 13, 2025 17:24
@jwnrt jwnrt requested review from moidx and removed request for a team, rswarbrick and msfschaffner June 13, 2025 17:24
@jwnrt jwnrt force-pushed the earlgrey-1.0.0-bazel-8 branch 3 times, most recently from 98abba6 to b7f8d65 Compare June 18, 2025 15:57
@jwnrt jwnrt force-pushed the earlgrey-1.0.0-bazel-8 branch from b7f8d65 to 3fc587d Compare July 8, 2025 08:30
@timothytrippel
Copy link
Contributor

same here, can you rebase on earlgrey_1.0.0 and fix CI?

@jwnrt jwnrt force-pushed the earlgrey-1.0.0-bazel-8 branch 2 times, most recently from 83066a7 to 08d6bd4 Compare July 9, 2025 15:58
jwnrt added 3 commits July 24, 2025 15:32
These are now handled by the `bazel sync` further above. They are
different under bzlmod, so we remove them here.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 52877a2)
This commit adds a `MODULE.bazel` file and enables the bzlmod feature,
but actually continues to use the existing `WORKSPACE` dependency
management by moving to `WORKSPACE.bzlmod`.

Dependencies can be gradually migrated from `WORKSPACE` to
`MODULE.bazel`.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 21d4988)
Required for some dependencies (such as Python and Git dependencies)
which are not downloaded by `bazel fetch` when using Bzlmod.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
@jwnrt jwnrt force-pushed the earlgrey-1.0.0-bazel-8 branch from 08d6bd4 to afa2519 Compare July 24, 2025 14:36
jwnrt added 8 commits July 24, 2025 15:55
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit dfaf5ba)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit f89ff56)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 8f9da38)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit ccf5884)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 0b75593)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit bf632c9)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 06341f4)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 87121de)
jwnrt added 24 commits July 24, 2025 16:01
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit fe148bb)
`BUILD` files should now be using `defs.bzl` for these, so we don't need
to export them from other files too.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit ea4702e)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit c04dbf5)
Deduplicates the implementation.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit a329756)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 0e24bd6)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 5ea5f04)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit afbee40)
No longer used.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 316cb43)
All features are now moved to the `rules/opentitan` directory.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 90c1f02)
Previously we were accessing the lowRISC toolchain indirectly via CRT,
but this isn't possible with Bzlmod. We need to pull the repo in
directly.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit bdc9c37)
Bazel is moving towards deprecating the `tool_path` style of CC
toolchain which allowed executables to be taken using the `*_executable`
parameters. The new method is `cc_common.get_tool_for_action` which
works with both the old and new toolchain style.

This commit changes all usages except for `objdump` which has no
associated action. A future commit will create a custom objdump action
for our toolchain and change this usage then.

The OTBN toolchain actually needs exact tools. Instead of pulling these
from the `cc_toolchain` it makes more sense to access the binaries
directly from our toolchain repo.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 12c7abd)
Matches the arguments used in `//third_party/coremark/top_earlgrey`.
Allows the feature-per-warning method from CRT to be replaced with one
set of warnings which is easier to manage.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 9466eb5)
This uses the new rules-based toolchain feature of `rules_cc` to define
the lowRISC toolchain with the same flags that the CRT toolchain had.

There are two differences:

1. The CRT toolchain does not have the `guards` feature enabled by
   default, we enable it in `.bazelrc`. This new one is enabled
   automatically.

2. The CRT toolchain has `-Wpedantic` enabled by default, but we disable
   it in `.bazelrc`. This new one has it disabled by default.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit af8209d)
This removes the dependency on CRT and registers the new rules-based
toolchain instead.

Since `guards` is now enabled by default and `pedantic` is now disabled
by default, we can remove those configurations from `.bazelrc`. The
configuration to disable `guards` is still present.

Without CRT, we also don't need to manually load the following repos
into the airgapped environment:

* `@python3_toolchains`
* `@ninja_1.11.0_linux`
* `@cmake-3.23.2-linux-x86_64`

We also now need to switch how we access objdump in our disassembly
rule to use the actions-based method. See previous commits.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit af824b6)
Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit c145262)
These rules still use `workspace` as their parameters but they accept
any file marking the root of the repository.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 17f7877)
For whatever reason they've changed `sync` to `fetch` with Bzlmod and
`sync` fully crashes Bazel when hybrid mode is disabled rather than
giving an error.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit c323ef3)
This command has been deprecated when using Bzlmod. It only works with
`WORKSPACE` and hybrid mode. For some reason Bazel completely crashes
with a JVM exception when you try to use it rather than printing a nice
warning.

This commit prints a warning that `sync` is deprecated and swaps the
command for `fetch` which has almost identical arguments.

This is a temporary measure to prevent breaking contributors who have
git post-checkout hooks installed which run `bazel sync --configure`.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 654a23f)
No longer needed now that all external dependencies are managed by
Bzlmod and downloaded using `bazel vendor`.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
With this change the repository fully supports Bzlmod and is no longer
in hybrid mode.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 4d99670)
Prevents this from being re-enabled by accident.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 7c906d6)
Future versions of Bazel will enable the
`--incompatible_disallow_empty_glob` flag by default. Globs which return
zero results must have the `allow_empty = True` parameter.

The file export in `hw/top_earlgrey/data` for `autogen/` was invalid:
`autogen` is now a package itself and the parent cannot export files
from it.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 677c57d)
For some reason the method of finding Python using `current_toolchain`
stopped working with Bazel 8.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
The `rules_python` version is corrected to `0.40` which Bazel pulls in.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
(cherry picked from commit 1b69573)
@jwnrt jwnrt force-pushed the earlgrey-1.0.0-bazel-8 branch from afa2519 to f8345e8 Compare July 24, 2025 15:03
@jwnrt
Copy link
Contributor Author

jwnrt commented Jul 24, 2025

Rebased and run the change blocker script manually again:

$ ./ci/scripts/check-pr-changes-allowed.py <(git diff earlgrey_1.0.0 --name-only) 
No unauthorized changes, clear to merge

@jwnrt jwnrt merged commit c3f0b84 into lowRISC:earlgrey_1.0.0 Jul 25, 2025
57 of 64 checks passed
@jwnrt
Copy link
Contributor Author

jwnrt commented Jul 25, 2025

usbdev_deep_disconnect_test is failing on earlgrey_1.0.0 so I skipped it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants