Skip to content

Commit

Permalink
Check in MODULE.bazel.lock.dist
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed May 7, 2024
1 parent 350b95b commit f042996
Show file tree
Hide file tree
Showing 5 changed files with 754 additions and 161 deletions.
24 changes: 18 additions & 6 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Bazel - Google's Build System

load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load("@rules_license//rules:license.bzl", "license")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("@rules_python//python:defs.bzl", "py_binary")
Expand Down Expand Up @@ -34,7 +35,6 @@ filegroup(
".*", # mainly .git* files
],
) + [
"//:MODULE.bazel.lock.dist",
"//:WORKSPACE.bzlmod.filtered",
"//examples:srcs",
"//scripts:srcs",
Expand Down Expand Up @@ -94,26 +94,38 @@ genrule(
"MODULE.bazel",
"//third_party/googleapis:MODULE.bazel",
"//third_party/remoteapis:MODULE.bazel",
"//third_party/upb:00_remove_toolchain_transition.patch",
],
outs = ["MODULE.bazel.lock.dist"],
outs = ["MODULE.bazel.lock.dist.gen"],
cmd = " && ".join([
"ROOT=$$PWD",
"TMPDIR=$$(mktemp -d)",
"trap 'rm -rf $$TMPDIR' EXIT",
"mkdir -p $$TMPDIR/workspace",
"touch $$TMPDIR/workspace/BUILD.bazel",
"for i in $(SRCS); do dir=$$TMPDIR/workspace/$$(dirname $$i); mkdir -p $$dir; cp $$i $$dir; done",
"for i in $(SRCS); do dir=$$TMPDIR/workspace/$$(dirname $$i); mkdir -p $$dir; touch $$dir/BUILD.bazel; cp $$i $$dir; done",
"cd $$TMPDIR/workspace",
# Instead of `bazel mod deps`, we run a simpler command like `bazel query :all` here
# so that we only trigger module resolution, not extension eval.
# Instead of `bazel mod deps`, we run a simpler command like `bazel query` here
# so that we only trigger module resolution and the few required extensions.
# Also use `--batch` so that Bazel doesn't keep a server process alive.
"$$ROOT/$(location //src:bazel) --batch --output_user_root=$$TMPDIR/output_user_root query --check_direct_dependencies=error --lockfile_mode=update :all",
"$$ROOT/$(location //src:bazel) --batch --output_user_root=$$TMPDIR/output_user_root query --check_direct_dependencies=error --lockfile_mode=update \
':all + deps(@com_github_grpc_grpc//:google_rpc_status_upb + @rules_kotlin//src/main/starlark/core/options:options, 1)'",
"mv MODULE.bazel.lock $$ROOT/$@",
]),
tags = ["requires-network"],
tools = ["//src:bazel"],
)

# TODO: Return to not checking in the file once Bazel is built with 7.2.0.
diff_test(
name = "dist_lockfile_test",
failure_message = """Update MODULE.bazel.lock.dist by running:
bazel build //:generate_dist_lockfile && cp "$(bazel info workspace)/bazel-bin/MODULE.bazel.lock.dist.gen" "$(bazel info workspace)/MODULE.bazel.lock.dist"
""",
file1 = "MODULE.bazel.lock.dist",
file2 = "MODULE.bazel.lock.dist.gen",
)

pkg_tar(
name = "bootstrap-jars",
srcs = [
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bazel_dep(name = "apple_support", version = "1.8.1")
bazel_dep(name = "abseil-cpp", version = "20230125.1")
bazel_dep(name = "c-ares", version = "1.15.0")
bazel_dep(name = "rules_go", version = "0.39.1")
bazel_dep(name = "rules_kotlin", version = "1.9.0")
bazel_dep(name = "rules_kotlin", version = "1.9.5")
bazel_dep(name = "upb", version = "0.0.0-20220923-a547704")
single_version_override(
module_name = "upb",
Expand Down
179 changes: 26 additions & 153 deletions MODULE.bazel.lock

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

Loading

0 comments on commit f042996

Please sign in to comment.