Skip to content

Commit b5685c4

Browse files
Only respect the Starlark versions of --proto_toolchain_for*. This is a breaking change. (#26090) (#26091)
PiperOrigin-RevId: 874981673 Co-authored-by: Protobuf Team Bot <protobuf-github-bot@google.com>
1 parent 3dfa37f commit b5685c4

File tree

5 files changed

+10
-29
lines changed

5 files changed

+10
-29
lines changed

bazel/flags/flags.bzl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ _FLAGS = {
3535
native = lambda ctx: getattr(ctx.fragments.proto, "cc_proto_library_source_suffixes"),
3636
default = [".pb.cc"],
3737
),
38-
"proto_toolchain_for_java": struct(
39-
native = lambda ctx: getattr(ctx.attr, "_aspect_java_proto_toolchain"),
40-
default = "@bazel_tools//tools/proto:java_toolchain",
38+
"_proto_toolchain_for_java": struct(
39+
native = lambda ctx: "//:java_toolchain",
40+
default = "//:java_toolchain",
4141
),
42-
"proto_toolchain_for_javalite": struct(
43-
native = lambda ctx: getattr(ctx.attr, "_aspect_proto_toolchain_for_javalite"),
44-
default = "@bazel_tools//tools/proto:javalite_toolchain",
42+
"_proto_toolchain_for_javalite": struct(
43+
native = lambda ctx: "//:javalite_toolchain",
44+
default = "//:javalite_toolchain",
4545
),
46-
"proto_toolchain_for_cc": struct(
47-
native = lambda ctx: getattr(ctx.attr, "_aspect_cc_proto_toolchain"),
48-
default = "@bazel_tools//tools/proto:cc_toolchain",
46+
"_proto_toolchain_for_cc": struct(
47+
native = lambda ctx: "//:cc_toolchain",
48+
default = "//:cc_toolchain",
4949
),
5050
}
5151

bazel/private/java_lite_proto_library.bzl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ _java_lite_proto_aspect = aspect(
7272
implementation = _aspect_impl,
7373
attr_aspects = ["deps", "exports"],
7474
attrs = toolchains.if_legacy_toolchain({
75-
_PROTO_TOOLCHAIN_ATTR: attr.label(
76-
default = configuration_field(fragment = "proto", name = "proto_toolchain_for_java_lite"),
77-
),
7875
"_proto_toolchain_for_javalite": attr.label(
7976
default = Label("//bazel/flags/java:proto_toolchain_for_javalite"),
8077
),
@@ -171,9 +168,6 @@ The list of <a href="protocol-buffer.html#proto_library"><code>proto_library</co
171168
rules to generate Java code for.
172169
"""),
173170
} | toolchains.if_legacy_toolchain({
174-
_PROTO_TOOLCHAIN_ATTR: attr.label(
175-
default = configuration_field(fragment = "proto", name = "proto_toolchain_for_java_lite"),
176-
),
177171
"_proto_toolchain_for_javalite": attr.label(
178172
default = Label("//bazel/flags/java:proto_toolchain_for_javalite"),
179173
),

bazel/private/java_proto_library.bzl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ java_proto_aspect = aspect(
7373
implementation = _java_proto_aspect_impl,
7474
attrs = (
7575
toolchains.if_legacy_toolchain({
76-
"_aspect_java_proto_toolchain": attr.label(
77-
default = configuration_field(fragment = "proto", name = "proto_toolchain_for_java"),
78-
),
7976
"_proto_toolchain_for_java": attr.label(
8077
default = "//bazel/flags/java:proto_toolchain_for_java",
8178
),
@@ -163,9 +160,6 @@ rules to generate Java code for.
163160
# buildifier: disable=attr-license (calling attr.license())
164161
"licenses": attr.license() if hasattr(attr, "license") else attr.string_list(),
165162
} | toolchains.if_legacy_toolchain({
166-
"_aspect_java_proto_toolchain": attr.label(
167-
default = configuration_field(fragment = "proto", name = "proto_toolchain_for_java"),
168-
),
169163
"_proto_toolchain_for_java": attr.label(
170164
default = "//bazel/flags/java:proto_toolchain_for_java",
171165
),

bazel/private/oss/cc_proto_library.bzl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ cc_proto_aspect = aspect(
125125
),
126126
} |
127127
toolchains.if_legacy_toolchain({
128-
"_aspect_cc_proto_toolchain": attr.label(
129-
default = configuration_field(fragment = "proto", name = "proto_toolchain_for_cc"),
130-
),
131128
"_proto_toolchain_for_cc": attr.label(
132129
default = Label("//bazel/flags/cc:proto_toolchain_for_cc"),
133130
),
@@ -196,9 +193,6 @@ The list of <a href="protocol-buffer.html#proto_library"><code>proto_library</co
196193
rules to generate C++ code for.""",
197194
),
198195
} | toolchains.if_legacy_toolchain({
199-
"_aspect_cc_proto_toolchain": attr.label(
200-
default = configuration_field(fragment = "proto", name = "proto_toolchain_for_cc"),
201-
),
202196
"_proto_toolchain_for_cc": attr.label(
203197
default = "//bazel/flags/cc:proto_toolchain_for_cc",
204198
),

bazel/private/proto_lang_toolchain_rule.bzl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ Deprecated. Alias for <code>denylisted_protos</code>. Will be removed in a futur
156156
"_proto_compiler": attr.label(
157157
cfg = "exec",
158158
executable = True,
159-
allow_files = True,
160-
default = configuration_field("proto", "proto_compiler"),
159+
default = "//bazel/flags:proto_compiler",
161160
),
162161
}),
163162
provides = [ProtoLangToolchainInfo],

0 commit comments

Comments
 (0)