Skip to content

Commit 3921c50

Browse files
authored
Fix BCR presubmit, update rules_python to 1.5.2 (#1760)
Resolves the Windows symlink breakage from bazelbuild/bazel-central-registry#5490 by replacing examples/crossbuild/protobuf.patch with a full copy. Bumps rules_python to 1.5.2 for both Bzlmod and legacy WORKSPACE builds. --- This is hopefully a temporary measure to unblock the next `rules_scala` release. This will probably require creating a v7.1.1 tag to trigger a new .bcr/presubmit.yml workflow. See bazelbuild/bazel-central-registry#5506 for details about the breakage. If and when bazelbuild/continuous-integration#2350 lands and makes its way to the BCR presubmit build, we could restore the symlink. Better yet, if protocolbuffers/protobuf#19679 ever lands, we could remove this symlink and all the others. Bumped `rules_python` to 1.5.2 for legacy `WORKSPACE` builds because it contains bazel-contrib/rules_python#3134, which fixes bazel-contrib/rules_python#3119.
1 parent 0aa4795 commit 3921c50

File tree

3 files changed

+95
-10
lines changed

3 files changed

+95
-10
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,5 +303,5 @@ use_repo(
303303
"org_golang_x_tools",
304304
)
305305

306-
bazel_dep(name = "rules_python", version = "1.5.1", dev_dependency = True)
306+
bazel_dep(name = "rules_python", version = "1.5.2", dev_dependency = True)
307307
bazel_dep(name = "rules_shell", version = "0.5.1", dev_dependency = True)

examples/crossbuild/protobuf.patch

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/crossbuild/protobuf.patch

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
diff --git a/protobuf.bzl b/protobuf.bzl
2+
index 283c85850..ad91faba6 100644
3+
--- a/protobuf.bzl
4+
+++ b/protobuf.bzl
5+
@@ -1,7 +1,9 @@
6+
load("@bazel_skylib//lib:versions.bzl", "versions")
7+
load("@rules_cc//cc:defs.bzl", "objc_library")
8+
load("@rules_python//python:defs.bzl", "py_library")
9+
+load("//bazel/common:proto_common.bzl", "proto_common")
10+
load("//bazel/common:proto_info.bzl", "ProtoInfo")
11+
+load("//bazel/private:toolchain_helpers.bzl", "toolchains")
12+
13+
def _GetPath(ctx, path):
14+
if ctx.label.workspace_root:
15+
@@ -71,6 +73,26 @@ def _CsharpOuts(srcs):
16+
for src in srcs
17+
]
18+
19+
+_PROTOC_ATTRS = toolchains.if_legacy_toolchain({
20+
+ "_proto_compiler": attr.label(
21+
+ cfg = "exec",
22+
+ executable = True,
23+
+ allow_files = True,
24+
+ default = configuration_field("proto", "proto_compiler"),
25+
+ ),
26+
+})
27+
+_PROTOC_FRAGMENTS = ["proto"]
28+
+_PROTOC_TOOLCHAINS = toolchains.use_toolchain(toolchains.PROTO_TOOLCHAIN)
29+
+
30+
+def _protoc_files_to_run(ctx):
31+
+ if proto_common.INCOMPATIBLE_ENABLE_PROTO_TOOLCHAIN_RESOLUTION:
32+
+ toolchain = ctx.toolchains[toolchains.PROTO_TOOLCHAIN]
33+
+ if not toolchain:
34+
+ fail("Protocol compiler toolchain could not be resolved.")
35+
+ return toolchain.proto.proto_compiler
36+
+ else:
37+
+ return ctx.attr._proto_compiler[DefaultInfo].files_to_run
38+
+
39+
ProtoGenInfo = provider(
40+
fields = ["srcs", "import_flags", "deps"],
41+
)
42+
@@ -310,7 +332,7 @@ def _internal_gen_well_known_protos_java_impl(ctx):
43+
args.add_all([src.path[offset:] for src in dep.direct_sources])
44+
45+
ctx.actions.run(
46+
- executable = ctx.executable._protoc,
47+
+ executable = _protoc_files_to_run(ctx),
48+
inputs = descriptors,
49+
outputs = [srcjar],
50+
arguments = [args],
51+
@@ -334,12 +356,9 @@ internal_gen_well_known_protos_java = rule(
52+
"javalite": attr.bool(
53+
default = False,
54+
),
55+
- "_protoc": attr.label(
56+
- executable = True,
57+
- cfg = "exec",
58+
- default = "//:protoc",
59+
- ),
60+
- },
61+
+ } | _PROTOC_ATTRS,
62+
+ fragments = _PROTOC_FRAGMENTS,
63+
+ toolchains = _PROTOC_TOOLCHAINS,
64+
)
65+
66+
def _internal_gen_kt_protos(ctx):
67+
@@ -373,7 +392,7 @@ def _internal_gen_kt_protos(ctx):
68+
args.add_all([src.path[offset:] for src in dep.direct_sources])
69+
70+
ctx.actions.run(
71+
- executable = ctx.executable._protoc,
72+
+ executable = _protoc_files_to_run(ctx),
73+
inputs = descriptors,
74+
outputs = [srcjar],
75+
arguments = [args],
76+
@@ -397,12 +416,9 @@ internal_gen_kt_protos = rule(
77+
"lite": attr.bool(
78+
default = False,
79+
),
80+
- "_protoc": attr.label(
81+
- executable = True,
82+
- cfg = "exec",
83+
- default = "//:protoc",
84+
- ),
85+
- },
86+
+ } | _PROTOC_ATTRS,
87+
+ fragments = _PROTOC_FRAGMENTS,
88+
+ toolchains = _PROTOC_TOOLCHAINS,
89+
)
90+
91+
def internal_objc_proto_library(

scala/latest_deps.bzl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,12 @@ def rules_scala_dependencies():
7171
),
7272
)
7373

74-
# Can't upgrade for now because https://github.com/bazel-contrib/rules_python/pull/2760
75-
# broke Bazel 7 WORKSPACE builds. It's really only a dev dep anyway.
76-
# If it's fixed per https://github.com/bazel-contrib/rules_python/issues/3119
77-
# (i.e., once https://github.com/bazel-contrib/rules_python/pull/3134 lands),
78-
# then we can upgrade.
7974
maybe(
8075
http_archive,
8176
name = "rules_python",
82-
sha256 = "9f9f3b300a9264e4c77999312ce663be5dee9a56e361a1f6fe7ec60e1beef9a3",
83-
strip_prefix = "rules_python-1.4.1",
84-
url = "https://github.com/bazelbuild/rules_python/releases/download/1.4.1/rules_python-1.4.1.tar.gz",
77+
sha256 = "0e68f851a6fcf317eeab5f6dc79803cb183d30c0c65fb52e2c4b731d13b73349",
78+
strip_prefix = "rules_python-1.5.2",
79+
url = "https://github.com/bazelbuild/rules_python/releases/download/1.5.2/rules_python-1.5.2.tar.gz",
8580
)
8681

8782
maybe(

0 commit comments

Comments
 (0)