Skip to content

Commit 75a8747

Browse files
Willy Zhangtimothytrippel
authored andcommitted
Finalize Bzlmod migration and remove WORKSPACE
Signed-off-by: Willy Zhang <[email protected]>
1 parent ab185fd commit 75a8747

File tree

9 files changed

+38
-20
lines changed

9 files changed

+38
-20
lines changed

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ build --@rules_rust//cargo/settings:use_default_shell_env=False
2323

2424
# Import site-specific configuration.
2525
try-import .bazelrc-site
26+
27+
# Bzlmod
28+
common --enable_bzlmod
29+
common --noenable_workspace

BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ load("@bazel_gazelle//:def.bzl", "gazelle")
66
load("@io_bazel_rules_go//go:def.bzl", "nogo")
77

88
exports_files([
9-
"WORKSPACE",
9+
"MODULE.bazel",
1010
])
1111

1212
config_setting(

MODULE.bazel.lock

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WORKSPACE

Lines changed: 0 additions & 3 deletions
This file was deleted.

quality/BUILD.bazel

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ package(default_visibility = ["//visibility:public"])
2222
# Bazel BUILD file lint/formatting
2323
################################################################################
2424
buildifier_exclude = [
25-
"./WORKSPACE", # Prevent Buildifier from inserting unnecessary newlines.
25+
"./MODULE.bazel", # Prevent Buildifier from inserting unnecessary newlines.
2626
]
2727

2828
buildifier_test(
@@ -33,7 +33,7 @@ buildifier_test(
3333
no_sandbox = True,
3434
tags = ["lint"],
3535
verbose = True,
36-
workspace = "//:WORKSPACE",
36+
workspace = "//:MODULE.bazel",
3737
)
3838

3939
buildifier(
@@ -54,7 +54,7 @@ clang_format_check(
5454
exclude_patterns = clang_format_exclude,
5555
mode = "diff",
5656
tags = ["lint"],
57-
workspace = "//:WORKSPACE",
57+
workspace = "//:MODULE.bazel",
5858
)
5959

6060
clang_format_fix(
@@ -70,7 +70,7 @@ gofmt_check(
7070
name = "gofmt_check",
7171
mode = "diff",
7272
tags = ["lint"],
73-
workspace = "//:WORKSPACE",
73+
workspace = "//:MODULE.bazel",
7474
)
7575

7676
gofmt_fix(
@@ -85,7 +85,7 @@ include_guard_check(
8585
name = "include_guard_check",
8686
mode = "diff",
8787
tags = ["lint"],
88-
workspace = "//:WORKSPACE",
88+
workspace = "//:MODULE.bazel",
8989
)
9090

9191
include_guard_fix(
@@ -116,7 +116,7 @@ licence_test(
116116
SPDX-License-Identifier: Apache-2.0
117117
""",
118118
tags = ["lint"],
119-
workspace = "//:WORKSPACE",
119+
workspace = "//:MODULE.bazel",
120120
)
121121

122122
################################################################################
@@ -126,7 +126,7 @@ protolint_check(
126126
name = "protolint_check",
127127
mode = "diff",
128128
tags = ["lint"],
129-
workspace = "//:WORKSPACE",
129+
workspace = "//:MODULE.bazel",
130130
)
131131

132132
protolint_fix(

rules/quality.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ gofmt_attrs = {
6666
),
6767
"workspace": attr.label(
6868
allow_single_file = True,
69-
doc = "Label of the WORKSPACE file",
69+
doc = "Label of the MODULE.bazel file",
7070
),
7171
"_runner": attr.label(
7272
default = "//rules/scripts:gofmt.sh",
@@ -122,7 +122,7 @@ clang_format_attrs = {
122122
),
123123
"workspace": attr.label(
124124
allow_single_file = True,
125-
doc = "Label of the WORKSPACE file",
125+
doc = "Label of the MODULE.bazel file",
126126
),
127127
"_runner": attr.label(
128128
default = "//rules/scripts:clang_format.sh",
@@ -178,7 +178,7 @@ protolint_attrs = {
178178
),
179179
"workspace": attr.label(
180180
allow_single_file = True,
181-
doc = "Label of the WORKSPACE file",
181+
doc = "Label of the MODULE.bazel file",
182182
),
183183
"_runner": attr.label(
184184
default = "//rules/scripts:protolint.sh",
@@ -234,7 +234,7 @@ include_guard_attrs = {
234234
),
235235
"workspace": attr.label(
236236
allow_single_file = True,
237-
doc = "Label of the WORKSPACE file",
237+
doc = "Label of the MODULE.bazel file",
238238
),
239239
"_runner": attr.label(
240240
default = "//rules/scripts:include_guard.sh",

rules/scripts/general_lint.template.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ elif [[ -n "${BUILD_WORKSPACE_DIRECTORY+is_set}" ]]; then
2020
cd "${BUILD_WORKSPACE_DIRECTORY}" || exit 1
2121
else
2222
echo "Neither WORKSPACE nor BUILD_WORKSPACE_DIRECTORY were set."
23-
echo "If this is a test rule, add 'workspace = \"//:WORKSPACE\"' to your rule."
23+
echo "If this is a test rule, add 'workspace = \"//:MODULE.bazel\"' to your rule."
2424
exit 1
2525
fi
2626

setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ sed -e '/^$/d' -e '/^#/d' -e 's/#.*//' \
1414
| sudo xargs apt install -y
1515
sudo apt clean
1616

17-
go install github.com/bazelbuild/bazelisk@v1.10.1
17+
go install github.com/bazelbuild/bazelisk@v1.27.0
1818

1919
# Create Project config settings directory.
2020
if [ ! -d "${OPENTITAN_VAR_DIR}" ]; then

third_party/crt/rules/pkg_win.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ load("//third_party/crt/rules:transition.bzl", "platform_rule")
66
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain")
77

88
def _get_toolchain_dir(cc_toolchain):
9-
workspace = [f for f in cc_toolchain.all_files.to_list() if f.basename == "WORKSPACE"]
9+
workspace = [f for f in cc_toolchain.all_files.to_list() if f.basename == "WORKSPACE" or f.basename == "MODULE.bazel"]
1010
if not workspace:
11-
fail("Could not find the WORKSPACE of the cc_toolchain")
11+
fail("Could not find the WORKSPACE or MODULE.bazel of the cc_toolchain")
1212
return workspace[0]
1313

1414
def _pkg_win_impl(ctx):

0 commit comments

Comments
 (0)