Skip to content

Commit f56e927

Browse files
susinmotioncopybara-github
authored andcommitted
Starlarkify Proto flags.
BEGIN_PUBLIC Internal Change END_PUBLIC PiperOrigin-RevId: 823942826 Change-Id: Ib8a060fc0faa377582a2600c91ed788c4baa91f6
1 parent bbd9187 commit f56e927

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

src/test/java/com/google/devtools/build/lib/packages/util/MockProtoSupport.java

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public static void setup(MockToolsConfig config) throws IOException {
4141
createNetProto2(config);
4242
setupWorkspace(config);
4343
registerProtoToolchain(config);
44+
// copybara:strip_begin(internal-only)
45+
createProtoFlags(config);
46+
// copybara:strip_end
4447
}
4548

4649
private static void registerProtoToolchain(MockToolsConfig config) throws IOException {
@@ -55,6 +58,79 @@ private static void registerProtoToolchain(MockToolsConfig config) throws IOExce
5558
+ "')");
5659
}
5760

61+
// copybara:strip_begin(internal-only)
62+
private static void createProtoFlags(MockToolsConfig config) throws IOException {
63+
config.create(
64+
"third_party/protobuf/bazel/flags/java/mutable/BUILD",
65+
"""
66+
label_flag(
67+
name = "proto_toolchain_for_javamutable",
68+
build_setting_default = "//tools/proto/toolchains:javamutable",
69+
)
70+
71+
label_flag(
72+
name = "proto_toolchain_for_javamutable_with_stubby1",
73+
build_setting_default = "//tools/proto/toolchains:javamutable_with_stubby1",
74+
)
75+
76+
label_flag(
77+
name = "proto_toolchain_for_javamutable_with_stubby3",
78+
build_setting_default = "//tools/proto/toolchains:javamutable_with_stubby3",
79+
)
80+
81+
label_flag(
82+
name = "proto_toolchain_for_javamutable_with_stubby13",
83+
build_setting_default = "//tools/proto/toolchains:javamutable_with_stubby13",
84+
)
85+
""");
86+
config.create(
87+
"third_party/protobuf/bazel/flags/BUILD",
88+
"""
89+
load("//third_party/bazel_skylib/rules:common_settings.bzl", "bool_flag")
90+
91+
cc_binary(
92+
name = "empty",
93+
srcs = ["empty_cc_plugin.cc"],
94+
)
95+
96+
bool_flag(
97+
name = "emit_proto_annotation_metadata",
98+
build_setting_default = False,
99+
)
100+
""");
101+
config.create(
102+
"third_party/protobuf/bazel/flags/cc/BUILD",
103+
"""
104+
load("//third_party/bazel_skylib/rules:common_settings.bzl", "bool_flag")
105+
106+
bool_flag(
107+
name = "dual_proto_modules",
108+
build_setting_default = False,
109+
)
110+
111+
label_flag(
112+
name = "protoc_cc_lib",
113+
build_setting_default = ":empty",
114+
)
115+
116+
label_flag(
117+
name = "protoc_cc_plugin",
118+
build_setting_default = ":empty",
119+
)
120+
121+
bool_flag(
122+
name = "experimental_proto_static_reflection_h",
123+
build_setting_default = False,
124+
)
125+
126+
sh_binary(
127+
name = "empty",
128+
srcs = ["empty.sh"],
129+
)
130+
""");
131+
}
132+
133+
// copybara:strip_end
58134
/**
59135
* Create a dummy net/proto2 compiler, a dummy protoc_minimal and proto APIs for all languages and
60136
* versions.

0 commit comments

Comments
 (0)