Apply buildifier to MODULE.bazel.
Also add a note about how to update the lockfile.
Closes #19796.
PiperOrigin-RevId: 573850818
Change-Id: Iee09ccad949b692359f1280ee42cf6752e9bd5ac
diff --git a/MODULE.bazel b/MODULE.bazel
index cf7433c..4068f2e 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -1,5 +1,8 @@
"""Bazel build and test dependencies."""
+# NOTE: When editing this file, also update the lockfile.
+# bazel mod deps --lockfile_mode=update
+
module(
name = "bazel",
version = "7.0.0-pre",
@@ -174,34 +177,44 @@
],
# Don't forget to change this to back to True before submitting your change.
fail_if_repin_required = True,
- strict_visibility = True,
lock_file = "//:maven_install.json",
repositories = [
"https://repo1.maven.org/maven2",
],
+ strict_visibility = True,
)
+
# Test only maven dependencies
-[maven.artifact(artifact = artifact, group = group, version = version, testonly = True)
- for group, artifact, version in [coord.split(":") for coord in [
- "com.google.guava:guava-testlib:31.1-jre",
- "com.google.jimfs:jimfs:1.2",
- "com.google.testing.compile:compile-testing:0.18",
- "com.google.testparameterinjector:test-parameter-injector:1.0",
- "com.google.truth:truth:1.1.3",
- "com.google.truth.extensions:truth-java8-extension:1.1.3",
- "com.google.truth.extensions:truth-liteproto-extension:1.1.3",
- "com.google.truth.extensions:truth-proto-extension:1.1.3",
- "org.mockito:mockito-core:5.4.0",
-]]]
+[
+ maven.artifact(
+ testonly = True,
+ artifact = artifact,
+ group = group,
+ version = version,
+ )
+ for group, artifact, version in [coord.split(":") for coord in [
+ "com.google.guava:guava-testlib:31.1-jre",
+ "com.google.jimfs:jimfs:1.2",
+ "com.google.testing.compile:compile-testing:0.18",
+ "com.google.testparameterinjector:test-parameter-injector:1.0",
+ "com.google.truth:truth:1.1.3",
+ "com.google.truth.extensions:truth-java8-extension:1.1.3",
+ "com.google.truth.extensions:truth-liteproto-extension:1.1.3",
+ "com.google.truth.extensions:truth-proto-extension:1.1.3",
+ "org.mockito:mockito-core:5.4.0",
+ ]]
+]
+
use_repo(maven, "maven", "unpinned_maven")
java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
-use_repo(java_toolchains,
+use_repo(
+ java_toolchains,
"local_jdk",
# The following are required for visibility from TEST_REPOS in distdir_deps.bzl
"remote_java_tools",
- "remote_java_tools_darwin_x86_64",
"remote_java_tools_darwin_arm64",
+ "remote_java_tools_darwin_x86_64",
"remote_java_tools_linux",
"remote_java_tools_windows",
"remotejdk11_linux",
@@ -246,8 +259,8 @@
bazel_build_deps = use_extension("//:extensions.bzl", "bazel_build_deps")
use_repo(
bazel_build_deps,
- "bootstrap_repo_cache",
"bazel_tools_repo_cache",
+ "bootstrap_repo_cache",
"debian_cc_deps",
"openjdk_linux_aarch64_vanilla",
"openjdk_linux_ppc64le_vanilla",
@@ -270,9 +283,9 @@
bazel_test_deps = use_extension("//:extensions.bzl", "bazel_test_deps")
use_repo(
bazel_test_deps,
+ "bazelci_rules",
"local_bazel_source_list",
"local_config_winsdk",
- "bazelci_rules",
)
bazel_rbe_deps = use_extension("//:rbe_extension.bzl", "bazel_rbe_deps")
diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock
index d895d0d..87f617b 100644
--- a/MODULE.bazel.lock
+++ b/MODULE.bazel.lock
@@ -1,6 +1,6 @@
{
"lockFileVersion": 3,
- "moduleFileHash": "d74b979a0d1f2f2a2e3968f8e67eee0a4bbee294ace422debf2ca527231eb8d4",
+ "moduleFileHash": "6d032b9aa1e4935f540fde37b07103eb118a3e714f27700643c2470d0669a7b8",
"flags": {
"cmdRegistries": [
"https://bcr.bazel.build/"
@@ -14,8 +14,8 @@
},
"localOverrideHashes": {
"bazel_tools": "0cc38516259ab87144b82461dd874e139f093d8e356667c3a3c5a52441ac448f",
- "googleapis": "2f11ff6746ba50aea110cc24a56afd91d138b55052991176fdc30034b0dbfa38",
- "remoteapis": "038a6397cee38ebe0df6f97a69049b7695044449f73b7721ae5e970e05828175"
+ "googleapis": "89bad67656f73e953cbf62f12165f56e97cf2cc17d56974c593de76200fa3471",
+ "remoteapis": "3862bfbe3d308e71852b8f025f4b33ea9c0dc8790829eda4a71425c5a2ca814e"
},
"moduleDepGraph": {
"<root>": {
@@ -38,7 +38,7 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
- "line": 63,
+ "line": 66,
"column": 22
},
"imports": {
@@ -157,152 +157,152 @@
"com.google.protobuf:protobuf-javalite"
],
"fail_if_repin_required": true,
- "strict_visibility": true,
"lock_file": "//:maven_install.json",
"repositories": [
"https://repo1.maven.org/maven2"
- ]
+ ],
+ "strict_visibility": true
},
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 64,
+ "line": 67,
"column": 14
}
},
{
"tagName": "artifact",
"attributeValues": {
+ "testonly": true,
"artifact": "guava-testlib",
"group": "com.google.guava",
- "version": "31.1-jre",
- "testonly": true
+ "version": "31.1-jre"
},
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 184,
- "column": 16
+ "line": 189,
+ "column": 19
}
},
{
"tagName": "artifact",
"attributeValues": {
+ "testonly": true,
"artifact": "jimfs",
"group": "com.google.jimfs",
- "version": "1.2",
- "testonly": true
+ "version": "1.2"
},
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 184,
- "column": 16
+ "line": 189,
+ "column": 19
}
},
{
"tagName": "artifact",
"attributeValues": {
+ "testonly": true,
"artifact": "compile-testing",
"group": "com.google.testing.compile",
- "version": "0.18",
- "testonly": true
+ "version": "0.18"
},
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 184,
- "column": 16
+ "line": 189,
+ "column": 19
}
},
{
"tagName": "artifact",
"attributeValues": {
+ "testonly": true,
"artifact": "test-parameter-injector",
"group": "com.google.testparameterinjector",
- "version": "1.0",
- "testonly": true
+ "version": "1.0"
},
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 184,
- "column": 16
+ "line": 189,
+ "column": 19
}
},
{
"tagName": "artifact",
"attributeValues": {
+ "testonly": true,
"artifact": "truth",
"group": "com.google.truth",
- "version": "1.1.3",
- "testonly": true
+ "version": "1.1.3"
},
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 184,
- "column": 16
+ "line": 189,
+ "column": 19
}
},
{
"tagName": "artifact",
"attributeValues": {
+ "testonly": true,
"artifact": "truth-java8-extension",
"group": "com.google.truth.extensions",
- "version": "1.1.3",
- "testonly": true
+ "version": "1.1.3"
},
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 184,
- "column": 16
+ "line": 189,
+ "column": 19
}
},
{
"tagName": "artifact",
"attributeValues": {
+ "testonly": true,
"artifact": "truth-liteproto-extension",
"group": "com.google.truth.extensions",
- "version": "1.1.3",
- "testonly": true
+ "version": "1.1.3"
},
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 184,
- "column": 16
+ "line": 189,
+ "column": 19
}
},
{
"tagName": "artifact",
"attributeValues": {
+ "testonly": true,
"artifact": "truth-proto-extension",
"group": "com.google.truth.extensions",
- "version": "1.1.3",
- "testonly": true
+ "version": "1.1.3"
},
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 184,
- "column": 16
+ "line": 189,
+ "column": 19
}
},
{
"tagName": "artifact",
"attributeValues": {
+ "testonly": true,
"artifact": "mockito-core",
"group": "org.mockito",
- "version": "5.4.0",
- "testonly": true
+ "version": "5.4.0"
},
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 184,
- "column": 16
+ "line": 189,
+ "column": 19
}
},
{
@@ -329,7 +329,7 @@
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 301,
+ "line": 314,
"column": 22
}
}
@@ -343,14 +343,14 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
- "line": 198,
+ "line": 210,
"column": 32
},
"imports": {
"local_jdk": "local_jdk",
"remote_java_tools": "remote_java_tools",
- "remote_java_tools_darwin_x86_64": "remote_java_tools_darwin_x86_64",
"remote_java_tools_darwin_arm64": "remote_java_tools_darwin_arm64",
+ "remote_java_tools_darwin_x86_64": "remote_java_tools_darwin_x86_64",
"remote_java_tools_linux": "remote_java_tools_linux",
"remote_java_tools_windows": "remote_java_tools_windows",
"remotejdk11_linux": "remotejdk11_linux",
@@ -383,7 +383,7 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
- "line": 231,
+ "line": 244,
"column": 23
},
"imports": {},
@@ -397,7 +397,7 @@
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 232,
+ "line": 245,
"column": 17
}
}
@@ -411,7 +411,7 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
- "line": 234,
+ "line": 247,
"column": 20
},
"imports": {
@@ -429,7 +429,7 @@
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
- "line": 235,
+ "line": 248,
"column": 10
}
}
@@ -443,12 +443,12 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
- "line": 246,
+ "line": 259,
"column": 33
},
"imports": {
- "bootstrap_repo_cache": "bootstrap_repo_cache",
"bazel_tools_repo_cache": "bazel_tools_repo_cache",
+ "bootstrap_repo_cache": "bootstrap_repo_cache",
"debian_cc_deps": "debian_cc_deps",
"openjdk_linux_aarch64_vanilla": "openjdk_linux_aarch64_vanilla",
"openjdk_linux_ppc64le_vanilla": "openjdk_linux_ppc64le_vanilla",
@@ -470,7 +470,7 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
- "line": 263,
+ "line": 276,
"column": 29
},
"imports": {
@@ -487,13 +487,13 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
- "line": 270,
+ "line": 283,
"column": 32
},
"imports": {
+ "bazelci_rules": "bazelci_rules",
"local_bazel_source_list": "local_bazel_source_list",
- "local_config_winsdk": "local_config_winsdk",
- "bazelci_rules": "bazelci_rules"
+ "local_config_winsdk": "local_config_winsdk"
},
"devImports": [],
"tags": [],
@@ -506,7 +506,7 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
- "line": 278,
+ "line": 291,
"column": 31
},
"imports": {
@@ -523,7 +523,7 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
- "line": 281,
+ "line": 294,
"column": 48
},
"imports": {
@@ -540,7 +540,7 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
- "line": 323,
+ "line": 336,
"column": 35
},
"imports": {
@@ -557,7 +557,7 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
- "line": 326,
+ "line": 339,
"column": 42
},
"imports": {
@@ -2128,7 +2128,7 @@
"general": {
"bzlTransitiveDigest": "yseV59Gli/QtNiWYztGw/BCEfbZOAJ97MKMy8mbTpbg=",
"accumulatedFileDigests": {
- "@@//src/test/tools/bzlmod:MODULE.bazel.lock": "e08da247a1b4200186a5118fcb0de3b1a39e8a402446607abfaaf420e543936f"
+ "@@//src/test/tools/bzlmod:MODULE.bazel.lock": "733ddc2ba09b9c42d8c3b30215077c7c87bbc0cf66cbe5c402c2e9cba9421eea"
},
"envVariables": {},
"generatedRepoSpecs": {
diff --git a/src/MODULE.tools b/src/MODULE.tools
index 7e87410..3399307 100644
--- a/src/MODULE.tools
+++ b/src/MODULE.tools
@@ -1,3 +1,6 @@
+# NOTE: When editing this file, also update the lockfile.
+# bazel run //src/test/tools/bzlmod:update_default_lock_file
+
module(name = "bazel_tools")
bazel_dep(name = "rules_cc", version = "0.0.9")
diff --git a/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh b/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh
index 5d6456e..a77b57d 100755
--- a/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh
+++ b/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh
@@ -103,7 +103,7 @@
JAVABASE=$(echo reduced*)
env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" ./compile.sh \
- || fail "Expected to be able to bootstrap bazel"
+ || fail "Expected to be able to bootstrap bazel. If you updated MODULE.bazel, see the NOTE in that file."
./output/bazel \
--server_javabase=$JAVABASE --host_jvm_args=--add-opens=java.base/java.nio=ALL-UNNAMED \
version --nognu_format &> "${TEST_log}" \
diff --git a/src/test/tools/bzlmod/MODULE.bazel.lock b/src/test/tools/bzlmod/MODULE.bazel.lock
index fb6c605..c396712 100644
--- a/src/test/tools/bzlmod/MODULE.bazel.lock
+++ b/src/test/tools/bzlmod/MODULE.bazel.lock
@@ -13,7 +13,7 @@
"compatibilityMode": "ERROR"
},
"localOverrideHashes": {
- "bazel_tools": "c68b253ceb07c1945e21b13d9785a8c46a0553432ea719552475687dd9481db1"
+ "bazel_tools": "32c7d903c5371feba2a1ab3f89f649918e55c40be0cff0c1aed01741a613938e"
},
"moduleDepGraph": {
"<root>": {
@@ -46,7 +46,7 @@
"usingModule": "bazel_tools@_",
"location": {
"file": "@@bazel_tools//:MODULE.bazel",
- "line": 13,
+ "line": 16,
"column": 29
},
"imports": {
@@ -64,7 +64,7 @@
"usingModule": "bazel_tools@_",
"location": {
"file": "@@bazel_tools//:MODULE.bazel",
- "line": 17,
+ "line": 20,
"column": 32
},
"imports": {
@@ -81,7 +81,7 @@
"usingModule": "bazel_tools@_",
"location": {
"file": "@@bazel_tools//:MODULE.bazel",
- "line": 20,
+ "line": 23,
"column": 32
},
"imports": {
@@ -103,7 +103,7 @@
"usingModule": "bazel_tools@_",
"location": {
"file": "@@bazel_tools//:MODULE.bazel",
- "line": 31,
+ "line": 34,
"column": 39
},
"imports": {
@@ -120,7 +120,7 @@
"usingModule": "bazel_tools@_",
"location": {
"file": "@@bazel_tools//:MODULE.bazel",
- "line": 35,
+ "line": 38,
"column": 48
},
"imports": {
@@ -137,7 +137,7 @@
"usingModule": "bazel_tools@_",
"location": {
"file": "@@bazel_tools//:MODULE.bazel",
- "line": 38,
+ "line": 41,
"column": 42
},
"imports": {
diff --git a/third_party/googleapis/MODULE.bazel b/third_party/googleapis/MODULE.bazel
index d623e12..b9e5f7d 100644
--- a/third_party/googleapis/MODULE.bazel
+++ b/third_party/googleapis/MODULE.bazel
@@ -1,11 +1,13 @@
+# NOTE: When editing this file, also update the lockfile.
+# bazel mod deps --lockfile_mode=update
+
module(
- name = "googleapis",
- version = "",
+ name = "googleapis",
+ version = "",
)
bazel_dep(name = "rules_license", version = "0.0.3")
bazel_dep(name = "rules_java", version = "4.0.0")
bazel_dep(name = "rules_proto", version = "4.0.0")
bazel_dep(name = "protobuf", version = "3.19.0", repo_name = "com_google_protobuf")
-
bazel_dep(name = "bazel", version = "", repo_name = "io_bazel")
diff --git a/third_party/remoteapis/MODULE.bazel b/third_party/remoteapis/MODULE.bazel
index c67b338..9459f6f 100644
--- a/third_party/remoteapis/MODULE.bazel
+++ b/third_party/remoteapis/MODULE.bazel
@@ -1,11 +1,13 @@
+# NOTE: When editing this file, also update the lockfile.
+# bazel mod deps --lockfile_mode=update
+
module(
- name = "remoteapis",
- version = "",
+ name = "remoteapis",
+ version = "",
)
bazel_dep(name = "rules_java", version = "4.0.0")
bazel_dep(name = "rules_proto", version = "4.0.0")
bazel_dep(name = "protobuf", version = "3.19.0", repo_name = "com_google_protobuf")
-
bazel_dep(name = "googleapis", version = "")
bazel_dep(name = "bazel", version = "", repo_name = "io_bazel")