Skip to content

Commit

Permalink
Bump Bazel to 7.0 (#2006)
Browse files Browse the repository at this point in the history
Major change: Bump Bazel to the new LTS at 7.X

* Included a default Python toolchain 3.10

  There is a problem at the moment running lit using Python311 where it
  cannot find the module.

  Our CI system already enforces Python310 to get around it but we should
  set the toolchain in Bazel itself to avoid this problem.
  I had already filed llvm/llvm-project#75963

* I moved skylib to MODULE.bazel to test the MODULE portion of Bazel is
working. A remaining action item is to move LLVM itself to MODULE.bazel
which would preclude needing to define skylib since its a dependency of
LLVM.

* Workspace names are no longer named in Bazel 7+
  
  I had to change stablehlo to _main to fix the runfiles directory.
  Please see bazelbuild/bazel#18128

We should consider using
https://github.com/bazelbuild/rules_python/blob/main/python/runfiles/runfiles.py#L262
instead to get the runfiles directory for future proofing.

Fixes #1878

---------

Co-authored-by: mlevesquedion <[email protected]>
  • Loading branch information
fzakaria and mlevesquedion authored Feb 13, 2024
1 parent de5a7ab commit 4ac26f8
Show file tree
Hide file tree
Showing 8 changed files with 2,310 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
6.1.0
7.0.2
# Copyright 2023 The StableHLO Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
19 changes: 19 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################
bazel_dep(name = "bazel_skylib", version = "1.3.0")
bazel_dep(name = "rules_python", version = "0.30.0")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")

# There is a problem at the moment running lit using Python 3.11
# Our CI system enforces Python 3.10 to get around it but we should set the toolchain
# in Bazel itself to avoid this problem.
# https://github.com/llvm/llvm-project/issues/75963
python.toolchain(
is_default = True,
python_version = "3.10",
)
Loading

0 comments on commit 4ac26f8

Please sign in to comment.