blob: 6a245bc94523101f9d6082e6936e1b456f54471d [file] [log] [blame]
Laszlo Csomor55171682017-12-01 12:05:32 +01001# Bazel (https://bazel.build/) BUILD file for Protobuf.
Jisi Liud19604f2015-06-17 17:37:58 -07002
Mike Kruskalca4b0632022-08-11 20:55:01 -07003load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library")
Adam Cozzette501ecec2023-09-26 14:36:20 -07004load("@rules_java//java:defs.bzl", "java_lite_proto_library", "java_proto_library")
David L. Jonesd76f8c82022-04-22 16:58:16 -07005load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
Yannic Bonenberger6e899192019-07-23 16:28:57 +02006load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
Mike Kruskal723bd4c2023-02-28 14:07:48 -08007load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS")
Mike Kruskal571b7272023-11-21 12:08:51 -08008load(":protobuf.bzl", "internal_objc_proto_library", "internal_php_proto_library", "internal_py_proto_library")
David L. Jones46710ca2022-04-20 16:26:44 -07009
Jisi Liud19604f2015-06-17 17:37:58 -070010licenses(["notice"])
11
Piotr Sikorafaea19c2016-08-04 15:32:14 -070012exports_files(["LICENSE"])
13
Jorge Canizalesd5d7bb32015-06-28 15:23:02 -070014################################################################################
Jakob Buchgraber699c0eb2017-09-05 17:15:10 +020015# Well Known Types Proto Library Rules
16#
David L. Jones5ebde5b2022-05-05 13:29:47 -070017# https://developers.google.com/protocol-buffers/docs/reference/google.protobuf
18################################################################################
Jakob Buchgraber699c0eb2017-09-05 17:15:10 +020019# These proto_library rules can be used with one of the language specific proto
20# library rules i.e. java_proto_library:
21#
22# java_proto_library(
23# name = "any_java_proto",
YJ2bc5f952022-06-10 04:27:39 +080024# deps = ["@com_google_protobuf//:any_proto"],
Jakob Buchgraber699c0eb2017-09-05 17:15:10 +020025# )
26################################################################################
27
David L. Jones171a6b12022-05-18 13:45:22 -070028alias(
David L. Jones5ebde5b2022-05-05 13:29:47 -070029 name = "any_proto",
David L. Jones171a6b12022-05-18 13:45:22 -070030 actual = "//src/google/protobuf:any_proto",
Jakob Buchgraber699c0eb2017-09-05 17:15:10 +020031 visibility = ["//visibility:public"],
David L. Jones5ebde5b2022-05-05 13:29:47 -070032)
Jakob Buchgraber699c0eb2017-09-05 17:15:10 +020033
David L. Jones171a6b12022-05-18 13:45:22 -070034alias(
David L. Jones5ebde5b2022-05-05 13:29:47 -070035 name = "api_proto",
David L. Jones171a6b12022-05-18 13:45:22 -070036 actual = "//src/google/protobuf:api_proto",
David L. Jones5ebde5b2022-05-05 13:29:47 -070037 visibility = ["//visibility:public"],
David L. Jones5ebde5b2022-05-05 13:29:47 -070038)
39
David L. Jones171a6b12022-05-18 13:45:22 -070040alias(
David L. Jones5ebde5b2022-05-05 13:29:47 -070041 name = "duration_proto",
David L. Jones171a6b12022-05-18 13:45:22 -070042 actual = "//src/google/protobuf:duration_proto",
David L. Jones5ebde5b2022-05-05 13:29:47 -070043 visibility = ["//visibility:public"],
44)
45
David L. Jones171a6b12022-05-18 13:45:22 -070046alias(
David L. Jones5ebde5b2022-05-05 13:29:47 -070047 name = "empty_proto",
David L. Jones171a6b12022-05-18 13:45:22 -070048 actual = "//src/google/protobuf:empty_proto",
David L. Jones5ebde5b2022-05-05 13:29:47 -070049 visibility = ["//visibility:public"],
50)
51
David L. Jones171a6b12022-05-18 13:45:22 -070052alias(
David L. Jones5ebde5b2022-05-05 13:29:47 -070053 name = "field_mask_proto",
David L. Jones171a6b12022-05-18 13:45:22 -070054 actual = "//src/google/protobuf:field_mask_proto",
David L. Jones5ebde5b2022-05-05 13:29:47 -070055 visibility = ["//visibility:public"],
56)
57
David L. Jones171a6b12022-05-18 13:45:22 -070058alias(
David L. Jones5ebde5b2022-05-05 13:29:47 -070059 name = "source_context_proto",
David L. Jones171a6b12022-05-18 13:45:22 -070060 actual = "//src/google/protobuf:source_context_proto",
David L. Jones5ebde5b2022-05-05 13:29:47 -070061 visibility = ["//visibility:public"],
62)
63
David L. Jones171a6b12022-05-18 13:45:22 -070064alias(
David L. Jones5ebde5b2022-05-05 13:29:47 -070065 name = "struct_proto",
David L. Jones171a6b12022-05-18 13:45:22 -070066 actual = "//src/google/protobuf:struct_proto",
David L. Jones5ebde5b2022-05-05 13:29:47 -070067 visibility = ["//visibility:public"],
68)
69
David L. Jones171a6b12022-05-18 13:45:22 -070070alias(
David L. Jones5ebde5b2022-05-05 13:29:47 -070071 name = "timestamp_proto",
David L. Jones171a6b12022-05-18 13:45:22 -070072 actual = "//src/google/protobuf:timestamp_proto",
David L. Jones5ebde5b2022-05-05 13:29:47 -070073 visibility = ["//visibility:public"],
74)
75
David L. Jones171a6b12022-05-18 13:45:22 -070076alias(
David L. Jones5ebde5b2022-05-05 13:29:47 -070077 name = "type_proto",
David L. Jones171a6b12022-05-18 13:45:22 -070078 actual = "//src/google/protobuf:type_proto",
David L. Jones5ebde5b2022-05-05 13:29:47 -070079 visibility = ["//visibility:public"],
David L. Jones5ebde5b2022-05-05 13:29:47 -070080)
81
David L. Jones171a6b12022-05-18 13:45:22 -070082alias(
David L. Jones5ebde5b2022-05-05 13:29:47 -070083 name = "wrappers_proto",
David L. Jones171a6b12022-05-18 13:45:22 -070084 actual = "//src/google/protobuf:wrappers_proto",
David L. Jones5ebde5b2022-05-05 13:29:47 -070085 visibility = ["//visibility:public"],
86)
87
David L. Jones171a6b12022-05-18 13:45:22 -070088# Source files: these are aliases to a filegroup, not a `proto_library`.
89#
90# (This is _probably_ not what you want.)
91alias(
92 name = "lite_well_known_protos",
93 actual = "//src/google/protobuf:well_known_type_protos", # filegroup
94 visibility = ["//visibility:public"],
95)
96
97alias(
98 name = "well_known_type_protos",
99 actual = "//src/google/protobuf:well_known_type_protos", # filegroup
100 visibility = ["//visibility:public"],
101)
102
103# Built-in runtime protos: these are part of protobuf's internal
104# implementation, but are not Well-Known Types.
105
106alias(
Mike Kruskal4f9e4172023-06-30 20:14:50 -0700107 name = "cpp_features_proto",
108 actual = "//src/google/protobuf:cpp_features_proto", # proto_library
109 visibility = ["//visibility:public"],
110)
111
112alias(
David L. Jones171a6b12022-05-18 13:45:22 -0700113 name = "descriptor_proto",
114 actual = "//src/google/protobuf:descriptor_proto", # proto_library
115 visibility = ["//visibility:public"],
116)
117
118alias(
119 name = "descriptor_proto_srcs",
120 actual = "//src/google/protobuf:descriptor_proto_srcs", # filegroup
121 visibility = ["//visibility:public"],
122)
David L. Jones5ebde5b2022-05-05 13:29:47 -0700123
David L. Jonescbd1adc2022-05-17 16:39:47 -0700124alias(
David L. Jones5ebde5b2022-05-05 13:29:47 -0700125 name = "compiler_plugin_proto",
David L. Jones171a6b12022-05-18 13:45:22 -0700126 actual = "//src/google/protobuf/compiler:plugin_proto", # proto_library
David L. Jones5ebde5b2022-05-05 13:29:47 -0700127 visibility = ["//visibility:public"],
David L. Jones5ebde5b2022-05-05 13:29:47 -0700128)
129
David L. Jones171a6b12022-05-18 13:45:22 -0700130cc_library(
131 name = "cc_wkt_protos",
132 deprecation = "Only for backward compatibility. Do not use.",
David L. Jones5ebde5b2022-05-05 13:29:47 -0700133 visibility = ["//visibility:public"],
134)
135
David L. Jonesceaae1b2022-05-26 16:32:15 -0700136# Source protos that are typically part of the protobuf runtime.
137#
138# DEPRECATED: Prefer :well_known_type_protos for the Well-Known Types
139# (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf)
140# or :descriptor_proto(_srcs) for descriptor.proto (source), or
141# :compiler_plugin_proto for compiler/plugin.proto.
142filegroup(
143 name = "well_known_protos",
144 srcs = [
145 ":descriptor_proto_srcs",
146 ":well_known_type_protos",
147 "//src/google/protobuf/compiler:plugin.proto",
148 ],
149 deprecation = "Prefer :well_known_type_protos instead.",
150 visibility = ["//visibility:public"],
151)
152
Jakob Buchgraber699c0eb2017-09-05 17:15:10 +0200153################################################################################
Jorge Canizalesd5d7bb32015-06-28 15:23:02 -0700154# Protocol Buffers Compiler
155################################################################################
156
Protobuf Team Bot7787f3e2022-12-16 03:07:20 -0800157alias(
158 name = "protoc_lib",
159 actual = "//src/google/protobuf/compiler:protoc_lib",
160 visibility = ["//visibility:public"],
161)
162
Jisi Liud19604f2015-06-17 17:37:58 -0700163cc_binary(
164 name = "protoc",
Mike Kruskald220b432022-08-29 18:19:38 -0400165 copts = COPTS,
Mike Kruskal723bd4c2023-02-28 14:07:48 -0800166 linkopts = LINK_OPTS,
167 visibility = ["//visibility:public"],
168 deps = ["//src/google/protobuf/compiler:protoc_lib"],
169)
170
171cc_binary(
172 name = "protoc_static",
173 copts = COPTS,
Mike Kruskal723bd4c2023-02-28 14:07:48 -0800174 features = select({
Adam Cozzette501ecec2023-09-26 14:36:20 -0700175 # This isn't possible on mac because there is no static library for lcrt0.o
176 "@platforms//os:osx": [],
177 "//build_defs:config_osx": [],
178 # When cross-compiling we need to statically link all C++ libraries.
179 "//conditions:default": ["fully_static_link"],
Mike Kruskal723bd4c2023-02-28 14:07:48 -0800180 }),
Adam Cozzette501ecec2023-09-26 14:36:20 -0700181 linkopts = LINK_OPTS,
Jisi Liud19604f2015-06-17 17:37:58 -0700182 visibility = ["//visibility:public"],
David L. Jonescbd1adc2022-05-17 16:39:47 -0700183 deps = ["//src/google/protobuf/compiler:protoc_lib"],
Jisi Liud19604f2015-06-17 17:37:58 -0700184)
185
Jisi Liud19604f2015-06-17 17:37:58 -0700186################################################################################
David L. Jones171a6b12022-05-18 13:45:22 -0700187# C++ runtime
Jisi Liud19604f2015-06-17 17:37:58 -0700188################################################################################
189
Protobuf Team Bot5b6c2452023-09-14 12:04:25 -0700190# Expose the runtime for the proto_lang_toolchain so that it can also be used in
191# a user-defined proto_lang_toolchain.
192alias(
Adam Cozzette501ecec2023-09-26 14:36:20 -0700193 name = "protobuf_nowkt",
194 actual = "//src/google/protobuf:protobuf_nowkt",
195 visibility = ["//visibility:public"],
Protobuf Team Bot5b6c2452023-09-14 12:04:25 -0700196)
197
David L. Jones171a6b12022-05-18 13:45:22 -0700198# The "lite" runtime works for .proto files that specify the option:
199# optimize_for = LITE_RUNTIME;
200#
201# The lite runtime does not include the `Reflection` APIs (including
202# `Descriptor` and related types) or Well-Known Types.
203#
204# See also:
205# https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#message
206# https://developers.google.com/protocol-buffers/docs/reference/google.protobuf
207alias(
208 name = "protobuf_lite",
209 actual = "//src/google/protobuf:protobuf_lite",
210 visibility = ["//visibility:public"],
David L. Jonescbd1adc2022-05-17 16:39:47 -0700211)
Jisi Liud19604f2015-06-17 17:37:58 -0700212
David L. Jonescbd1adc2022-05-17 16:39:47 -0700213cc_library(
David L. Jones171a6b12022-05-18 13:45:22 -0700214 name = "protobuf",
David L. Jonesc2c770e2022-05-17 13:26:46 -0700215 copts = COPTS,
David L. Jones171a6b12022-05-18 13:45:22 -0700216 linkopts = LINK_OPTS,
217 visibility = ["//visibility:public"],
Jisi Liu7a0c4312015-06-18 16:45:27 -0700218 deps = [
David L. Jones171a6b12022-05-18 13:45:22 -0700219 "//src/google/protobuf",
220 "//src/google/protobuf/compiler:importer",
221 "//src/google/protobuf/util:delimited_message_util",
222 "//src/google/protobuf/util:differencer",
223 "//src/google/protobuf/util:field_mask_util",
224 "//src/google/protobuf/util:json_util",
225 "//src/google/protobuf/util:time_util",
226 "//src/google/protobuf/util:type_resolver_util",
Yannic Bonenbergera3aecac2021-03-10 10:20:39 +0100227 ],
Jisi Liu7a0c4312015-06-18 16:45:27 -0700228)
229
David L. Jones171a6b12022-05-18 13:45:22 -0700230# This provides just the header files for use in projects that need to build
231# shared libraries for dynamic loading. This target is available until Bazel
232# adds native support for such use cases.
Sandy Zhang81068e82023-09-18 15:13:49 -0700233# TODO: Remove this target once the support gets added to Bazel.
David L. Jones171a6b12022-05-18 13:45:22 -0700234alias(
235 name = "protobuf_headers",
236 actual = "//src/google/protobuf:protobuf_headers",
237 visibility = ["//visibility:public"],
Jisi Liu7a0c4312015-06-18 16:45:27 -0700238)
Jisi Liu993fb702015-10-19 17:19:49 -0700239
Mike Kruskal32bea522022-10-06 16:48:39 -0700240alias(
241 name = "json",
242 actual = "//src/google/protobuf/json",
243 visibility = ["//visibility:public"],
244)
245
Jisi Liu993fb702015-10-19 17:19:49 -0700246################################################################################
247# Java support
248################################################################################
Yannicf0cb9cd2020-02-13 22:04:14 +0100249
Yannicf0cb9cd2020-02-13 22:04:14 +0100250alias(
Jisi Liu166e9bb2015-10-21 10:56:38 -0700251 name = "protobuf_java",
Yannicf0cb9cd2020-02-13 22:04:14 +0100252 actual = "//java/core",
Jisi Liu993fb702015-10-19 17:19:49 -0700253 visibility = ["//visibility:public"],
254)
255
Yannicf0cb9cd2020-02-13 22:04:14 +0100256alias(
Carmi Grushko5c25f412019-05-24 17:26:07 +0300257 name = "protobuf_javalite",
Yannicf0cb9cd2020-02-13 22:04:14 +0100258 actual = "//java/lite",
Jisi Liu993fb702015-10-19 17:19:49 -0700259 visibility = ["//visibility:public"],
260)
261
Yannicf0cb9cd2020-02-13 22:04:14 +0100262alias(
Steven Parkesa9244ca2016-03-10 17:50:25 -0800263 name = "protobuf_java_util",
Yannicf0cb9cd2020-02-13 22:04:14 +0100264 actual = "//java/util",
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800265 visibility = ["//visibility:public"],
Yannicf0cb9cd2020-02-13 22:04:14 +0100266)
267
268alias(
269 name = "java_toolchain",
270 actual = "//java/core:toolchain",
271 visibility = ["//visibility:public"],
272)
273
274alias(
275 name = "javalite_toolchain",
276 actual = "//java/lite:toolchain",
277 visibility = ["//visibility:public"],
Steven Parkesa9244ca2016-03-10 17:50:25 -0800278)
279
Jisi Liu993fb702015-10-19 17:19:49 -0700280################################################################################
281# Python support
282################################################################################
283
David L. Jonesb3cbea12022-05-12 19:48:58 -0700284alias(
Joshua Habermana6901f02022-04-25 22:00:57 +0000285 name = "protobuf_python",
David L. Jonesb3cbea12022-05-12 19:48:58 -0700286 actual = "//python:protobuf_python",
287 visibility = ["//visibility:public"],
Jisi Liu993fb702015-10-19 17:19:49 -0700288)
289
David L. Jonesb3cbea12022-05-12 19:48:58 -0700290alias(
291 name = "python_srcs",
292 actual = "//python:python_srcs",
Adam Cozzette501ecec2023-09-26 14:36:20 -0700293 visibility = ["//python:__subpackages__"],
David Z. Chen02cd45c2016-05-20 16:49:04 -0700294)
295
David L. Jonesb3cbea12022-05-12 19:48:58 -0700296alias(
297 name = "python_test_srcs",
298 actual = "//python:python_test_srcs",
Adam Cozzette501ecec2023-09-26 14:36:20 -0700299 visibility = ["//python:__subpackages__"],
David L. Jonesb3cbea12022-05-12 19:48:58 -0700300)
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800301
David L. Jonesb3cbea12022-05-12 19:48:58 -0700302alias(
303 name = "well_known_types_py_pb2",
304 actual = "//python:well_known_types_py_pb2",
Adam Cozzette41762562022-07-21 23:38:04 +0000305 visibility = ["//visibility:public"],
David L. Jonesb3cbea12022-05-12 19:48:58 -0700306)
David Z. Chen02cd45c2016-05-20 16:49:04 -0700307
David L. Jonesb3cbea12022-05-12 19:48:58 -0700308alias(
Jisi Liu993fb702015-10-19 17:19:49 -0700309 name = "python_common_test_protos",
David L. Jonesb3cbea12022-05-12 19:48:58 -0700310 actual = "//python:python_common_test_protos",
Joshua Habermana6901f02022-04-25 22:00:57 +0000311 visibility = ["//visibility:public"],
Jisi Liu993fb702015-10-19 17:19:49 -0700312)
313
David L. Jonesb3cbea12022-05-12 19:48:58 -0700314alias(
Jisi Liu993fb702015-10-19 17:19:49 -0700315 name = "python_specific_test_protos",
David L. Jonesb3cbea12022-05-12 19:48:58 -0700316 actual = "//python:python_specific_test_protos",
Joshua Habermana6901f02022-04-25 22:00:57 +0000317 visibility = ["//visibility:public"],
Thomas Colthurst7c651422018-05-29 18:26:11 -0400318)
319
cgrushko45d92ae2016-12-02 19:40:50 -0500320proto_lang_toolchain(
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800321 name = "cc_toolchain",
David L. Jones5ebde5b2022-05-05 13:29:47 -0700322 blacklisted_protos = [
Protobuf Team Bot64ae02c2022-12-20 10:02:34 -0800323 "//:compiler_plugin_proto",
324 "//:descriptor_proto",
David L. Jones5ebde5b2022-05-05 13:29:47 -0700325 ],
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800326 command_line = "--cpp_out=$(OUT)",
Mike Kruskalf5192302023-04-06 13:18:30 -0700327 runtime = "//src/google/protobuf:protobuf_nowkt",
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800328 visibility = ["//visibility:public"],
cgrushko45d92ae2016-12-02 19:40:50 -0500329)
cgrushkoe4baf3f2017-01-12 12:51:04 -0500330
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700331################################################################################
332# Objective-C support
333################################################################################
334
Thomas Van Lenten18aa2962018-11-01 09:37:14 -0400335alias(
336 name = "objectivec",
Yannic Bonenberger8b93b8e2020-07-08 17:21:38 +0200337 actual = "//objectivec",
David L. Jones67823fe2022-05-04 17:30:23 -0700338 tags = ["manual"],
Thomas Van Lenten18aa2962018-11-01 09:37:14 -0400339 visibility = ["//visibility:public"],
340)
makdharma286f0592017-05-01 09:49:26 -0700341
Yannic Bonenberger8b93b8e2020-07-08 17:21:38 +0200342alias(
Thomas Van Lenten18aa2962018-11-01 09:37:14 -0400343 name = "protobuf_objc",
Yannic Bonenberger8b93b8e2020-07-08 17:21:38 +0200344 actual = "//objectivec",
David L. Jones67823fe2022-05-04 17:30:23 -0700345 tags = ["manual"],
makdharma286f0592017-05-01 09:49:26 -0700346 visibility = ["//visibility:public"],
347)
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700348
349################################################################################
David L. Jones171a6b12022-05-18 13:45:22 -0700350# Test protos
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700351################################################################################
352
David L. Jones171a6b12022-05-18 13:45:22 -0700353alias(
Mike Kruskal81e35132022-09-19 11:08:21 -0700354 name = "lite_test_proto_srcs",
355 actual = "//src/google/protobuf:lite_test_proto_srcs", # proto_library
356 visibility = ["//:__subpackages__"],
357)
358
359alias(
David L. Jones171a6b12022-05-18 13:45:22 -0700360 name = "lite_test_protos",
361 actual = "//src/google/protobuf:lite_test_protos", # proto_library
362 visibility = ["//:__subpackages__"],
363)
364
365alias(
366 name = "test_proto_srcs",
367 actual = "//src/google/protobuf:test_proto_srcs", # filegroup
368 visibility = ["//:__subpackages__"],
369)
370
371alias(
372 name = "test_protos",
373 actual = "//src/google/protobuf:test_protos", # proto_library
374 visibility = ["//:__subpackages__"],
375)
376
377# Validate generated proto source inputs:
378
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700379genrule(
380 name = "generated_protos",
David L. Jones171a6b12022-05-18 13:45:22 -0700381 testonly = 1,
382 srcs = ["//src/google/protobuf:test_proto_srcs"],
David L. Jones67823fe2022-05-04 17:30:23 -0700383 outs = ["unittest_gen_import.proto"],
David L. Jones171a6b12022-05-18 13:45:22 -0700384 cmd = "cat src/google/protobuf/unittest_import.proto > $@",
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700385)
386
387proto_library(
388 name = "generated_protos_proto",
David L. Jones171a6b12022-05-18 13:45:22 -0700389 testonly = 1,
David L. Jonesb3cbea12022-05-12 19:48:58 -0700390 srcs = [":generated_protos"],
David L. Jones171a6b12022-05-18 13:45:22 -0700391 deps = ["//src/google/protobuf:generic_test_protos"],
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700392)
393
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700394internal_py_proto_library(
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700395 name = "generated_protos_py",
David L. Jones171a6b12022-05-18 13:45:22 -0700396 testonly = 1,
David L. Jonesb3cbea12022-05-12 19:48:58 -0700397 srcs = [":generated_protos"],
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700398 default_runtime = "",
399 protoc = ":protoc",
David L. Jonesb3cbea12022-05-12 19:48:58 -0700400 deps = ["//python:python_common_test_protos"],
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700401)
Josh Haberman6dec8cf2018-11-03 12:59:45 -0700402
403################################################################################
404# Conformance tests
405################################################################################
406
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700407cc_proto_library(
408 name = "test_messages_proto2_cc_proto",
409 visibility = [
410 "//conformance:__pkg__",
411 "//src:__subpackages__",
412 ],
413 deps = ["//src/google/protobuf:test_messages_proto2_proto"],
David L. Jones637a6992022-05-06 13:30:48 -0700414)
415
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700416cc_proto_library(
417 name = "test_messages_proto3_cc_proto",
418 visibility = [
419 "//conformance:__pkg__",
420 "//src:__subpackages__",
421 ],
422 deps = ["//src/google/protobuf:test_messages_proto3_proto"],
Josh Haberman6dec8cf2018-11-03 12:59:45 -0700423)
424
Deanna Garciaab4585a2022-02-01 18:24:53 +0000425java_proto_library(
Derek Perezbc45f922021-04-20 11:36:32 -0700426 name = "test_messages_proto2_java_proto",
427 visibility = [
David L. Jones637a6992022-05-06 13:30:48 -0700428 "//conformance:__pkg__",
Derek Perezbc45f922021-04-20 11:36:32 -0700429 "//java:__subpackages__",
430 ],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700431 deps = ["//src/google/protobuf:test_messages_proto2_proto"],
Derek Perezbc45f922021-04-20 11:36:32 -0700432)
433
434java_proto_library(
435 name = "test_messages_proto3_java_proto",
436 visibility = [
David L. Jones637a6992022-05-06 13:30:48 -0700437 "//conformance:__pkg__",
Derek Perezbc45f922021-04-20 11:36:32 -0700438 "//java:__subpackages__",
Tamir Duberstein7e97fd42021-08-04 08:03:24 -0400439 ],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700440 deps = ["//src/google/protobuf:test_messages_proto3_proto"],
Derek Perezbc45f922021-04-20 11:36:32 -0700441)
442
Derek Perezbc45f922021-04-20 11:36:32 -0700443java_lite_proto_library(
444 name = "test_messages_proto2_java_proto_lite",
445 visibility = [
David L. Jones637a6992022-05-06 13:30:48 -0700446 "//conformance:__pkg__",
Derek Perezbc45f922021-04-20 11:36:32 -0700447 "//java:__subpackages__",
448 ],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700449 deps = ["//src/google/protobuf:test_messages_proto2_proto"],
Derek Perezbc45f922021-04-20 11:36:32 -0700450)
451
452java_lite_proto_library(
Derek Perezbc45f922021-04-20 11:36:32 -0700453 name = "test_messages_proto3_java_proto_lite",
454 visibility = [
David L. Jones637a6992022-05-06 13:30:48 -0700455 "//conformance:__pkg__",
Derek Perezbc45f922021-04-20 11:36:32 -0700456 "//java:__subpackages__",
457 ],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700458 deps = ["//src/google/protobuf:test_messages_proto3_proto"],
459)
460
461internal_objc_proto_library(
462 name = "test_messages_proto2_objc_proto",
Mike Kruskalca4b0632022-08-11 20:55:01 -0700463 testonly = 1,
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700464 srcs = ["//src/google/protobuf:test_messages_proto2.proto"],
465 includes = ["src/google/protobuf"],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700466 visibility = [
467 "//conformance:__pkg__",
468 "//objectivec:__subpackages__",
469 ],
470)
471
472internal_objc_proto_library(
473 name = "test_messages_proto3_objc_proto",
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700474 testonly = 1,
Mike Kruskalca4b0632022-08-11 20:55:01 -0700475 srcs = ["//src/google/protobuf:test_messages_proto3.proto"],
476 includes = [
Mike Kruskalca4b0632022-08-11 20:55:01 -0700477 "src/google/protobuf",
Mike Kruskalba6d1732022-08-12 10:44:59 -0700478 # The above must come first.
479 "src",
Mike Kruskalca4b0632022-08-11 20:55:01 -0700480 ],
481 proto_deps = [":well_known_protos"],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700482 visibility = [
483 "//conformance:__pkg__",
484 "//objectivec:__subpackages__",
485 ],
486)
487
488internal_php_proto_library(
489 name = "test_messages_proto3_php_proto",
Mike Kruskalca4b0632022-08-11 20:55:01 -0700490 testonly = 1,
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700491 srcs = ["//src/google/protobuf:test_messages_proto3.proto"],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700492 outs = [
Mike Kruskalca4b0632022-08-11 20:55:01 -0700493 "GPBMetadata/TestMessagesProto3.php",
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700494 "Protobuf_test_messages/Proto3/EnumOnlyProto3.php",
495 "Protobuf_test_messages/Proto3/EnumOnlyProto3/PBBool.php",
496 "Protobuf_test_messages/Proto3/ForeignEnum.php",
497 "Protobuf_test_messages/Proto3/ForeignMessage.php",
498 "Protobuf_test_messages/Proto3/NullHypothesisProto3.php",
499 "Protobuf_test_messages/Proto3/TestAllTypesProto3.php",
500 "Protobuf_test_messages/Proto3/TestAllTypesProto3/AliasedEnum.php",
501 "Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedEnum.php",
502 "Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedMessage.php",
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700503 ],
Mike Kruskalca4b0632022-08-11 20:55:01 -0700504 includes = [
Mike Kruskalca4b0632022-08-11 20:55:01 -0700505 "src/google/protobuf",
Mike Kruskalba6d1732022-08-12 10:44:59 -0700506 # The above must come first.
507 "src",
Mike Kruskalca4b0632022-08-11 20:55:01 -0700508 ],
509 proto_deps = [":well_known_protos"],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700510 visibility = [
511 "//conformance:__pkg__",
512 "//php:__subpackages__",
513 ],
514)
515
UebelAndreae26a812021-08-06 08:08:32 -0700516filegroup(
517 name = "bzl_srcs",
518 srcs = glob(["**/*.bzl"]),
519 visibility = ["//visibility:public"],
520)
Deanna Garciaab4585a2022-02-01 18:24:53 +0000521
David L. Jonesd76f8c82022-04-22 16:58:16 -0700522################################################################################
523# Packaging rules
524################################################################################
525
526# Files included in all source distributions
527pkg_files(
528 name = "common_dist_files",
David L. Jones67823fe2022-05-04 17:30:23 -0700529 srcs = glob(
530 [
531 "*.bzl",
532 "cmake/*.cmake",
533 "cmake/*.in",
534 "editors/*",
David L. Jones67823fe2022-05-04 17:30:23 -0700535 ],
536 allow_empty = True,
537 ) + [
David L. Jones95da0ba2022-04-29 17:57:55 -0700538 "BUILD.bazel",
David L. Jonesd76f8c82022-04-22 16:58:16 -0700539 "CMakeLists.txt",
540 "CONTRIBUTORS.txt",
541 "LICENSE",
David L. Jonesd76f8c82022-04-22 16:58:16 -0700542 "README.md",
543 "WORKSPACE",
David L. Jonesd76f8c82022-04-22 16:58:16 -0700544 "cmake/README.md",
545 "generate_descriptor_proto.sh",
546 "maven_install.json",
David L. Jones354aba82022-05-09 16:32:59 -0700547 "//third_party:BUILD.bazel",
David L. Jonesd76f8c82022-04-22 16:58:16 -0700548 "//third_party:zlib.BUILD",
David L. Jonesd76f8c82022-04-22 16:58:16 -0700549 ],
550 strip_prefix = strip_prefix.from_root(""),
551 visibility = ["//pkg:__pkg__"],
552)
553
David L. Jonesd76f8c82022-04-22 16:58:16 -0700554# Additional files for C#
555pkg_files(
556 name = "csharp_dist_files",
557 srcs = [
558 "global.json",
559 ],
560 visibility = ["//pkg:__pkg__"],
561)
562
563# Additional files for ObjC
564pkg_files(
565 name = "objectivec_dist_files",
566 srcs = [
567 "Protobuf.podspec",
568 ],
569 visibility = ["//pkg:__pkg__"],
570)