blob: 5951297816b19f3e270dffc4a350bc388382542d [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 Kruskalca4b0632022-08-11 20:55:01 -07008load(":protobuf.bzl", "internal_objc_proto_library", "internal_php_proto_library", "internal_py_proto_library", "internal_ruby_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
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700153internal_ruby_proto_library(
154 name = "well_known_ruby_protos",
155 srcs = [":well_known_protos"],
Mike Kruskal633e8f72023-01-03 12:11:31 -0800156 default_runtime = "",
Adam Cozzette501ecec2023-09-26 14:36:20 -0700157 includes = ["src"],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700158 visibility = [
159 "//conformance:__pkg__",
160 "//ruby:__subpackages__",
161 ],
162)
163
Jakob Buchgraber699c0eb2017-09-05 17:15:10 +0200164################################################################################
Jorge Canizalesd5d7bb32015-06-28 15:23:02 -0700165# Protocol Buffers Compiler
166################################################################################
167
Protobuf Team Bot7787f3e2022-12-16 03:07:20 -0800168alias(
169 name = "protoc_lib",
170 actual = "//src/google/protobuf/compiler:protoc_lib",
171 visibility = ["//visibility:public"],
172)
173
Jisi Liud19604f2015-06-17 17:37:58 -0700174cc_binary(
175 name = "protoc",
Mike Kruskald220b432022-08-29 18:19:38 -0400176 copts = COPTS,
Mike Kruskal723bd4c2023-02-28 14:07:48 -0800177 linkopts = LINK_OPTS,
178 visibility = ["//visibility:public"],
179 deps = ["//src/google/protobuf/compiler:protoc_lib"],
180)
181
182cc_binary(
183 name = "protoc_static",
184 copts = COPTS,
Mike Kruskal723bd4c2023-02-28 14:07:48 -0800185 features = select({
Adam Cozzette501ecec2023-09-26 14:36:20 -0700186 # This isn't possible on mac because there is no static library for lcrt0.o
187 "@platforms//os:osx": [],
188 "//build_defs:config_osx": [],
189 # When cross-compiling we need to statically link all C++ libraries.
190 "//conditions:default": ["fully_static_link"],
Mike Kruskal723bd4c2023-02-28 14:07:48 -0800191 }),
Adam Cozzette501ecec2023-09-26 14:36:20 -0700192 linkopts = LINK_OPTS,
Jisi Liud19604f2015-06-17 17:37:58 -0700193 visibility = ["//visibility:public"],
David L. Jonescbd1adc2022-05-17 16:39:47 -0700194 deps = ["//src/google/protobuf/compiler:protoc_lib"],
Jisi Liud19604f2015-06-17 17:37:58 -0700195)
196
Jisi Liud19604f2015-06-17 17:37:58 -0700197################################################################################
David L. Jones171a6b12022-05-18 13:45:22 -0700198# C++ runtime
Jisi Liud19604f2015-06-17 17:37:58 -0700199################################################################################
200
Protobuf Team Bot5b6c2452023-09-14 12:04:25 -0700201# Expose the runtime for the proto_lang_toolchain so that it can also be used in
202# a user-defined proto_lang_toolchain.
203alias(
Adam Cozzette501ecec2023-09-26 14:36:20 -0700204 name = "protobuf_nowkt",
205 actual = "//src/google/protobuf:protobuf_nowkt",
206 visibility = ["//visibility:public"],
Protobuf Team Bot5b6c2452023-09-14 12:04:25 -0700207)
208
David L. Jones171a6b12022-05-18 13:45:22 -0700209# The "lite" runtime works for .proto files that specify the option:
210# optimize_for = LITE_RUNTIME;
211#
212# The lite runtime does not include the `Reflection` APIs (including
213# `Descriptor` and related types) or Well-Known Types.
214#
215# See also:
216# https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#message
217# https://developers.google.com/protocol-buffers/docs/reference/google.protobuf
218alias(
219 name = "protobuf_lite",
220 actual = "//src/google/protobuf:protobuf_lite",
221 visibility = ["//visibility:public"],
David L. Jonescbd1adc2022-05-17 16:39:47 -0700222)
Jisi Liud19604f2015-06-17 17:37:58 -0700223
David L. Jonescbd1adc2022-05-17 16:39:47 -0700224cc_library(
David L. Jones171a6b12022-05-18 13:45:22 -0700225 name = "protobuf",
David L. Jonesc2c770e2022-05-17 13:26:46 -0700226 copts = COPTS,
David L. Jones171a6b12022-05-18 13:45:22 -0700227 linkopts = LINK_OPTS,
228 visibility = ["//visibility:public"],
Jisi Liu7a0c4312015-06-18 16:45:27 -0700229 deps = [
David L. Jones171a6b12022-05-18 13:45:22 -0700230 "//src/google/protobuf",
231 "//src/google/protobuf/compiler:importer",
232 "//src/google/protobuf/util:delimited_message_util",
233 "//src/google/protobuf/util:differencer",
234 "//src/google/protobuf/util:field_mask_util",
235 "//src/google/protobuf/util:json_util",
236 "//src/google/protobuf/util:time_util",
237 "//src/google/protobuf/util:type_resolver_util",
Yannic Bonenbergera3aecac2021-03-10 10:20:39 +0100238 ],
Jisi Liu7a0c4312015-06-18 16:45:27 -0700239)
240
David L. Jones171a6b12022-05-18 13:45:22 -0700241# This provides just the header files for use in projects that need to build
242# shared libraries for dynamic loading. This target is available until Bazel
243# adds native support for such use cases.
Sandy Zhang81068e82023-09-18 15:13:49 -0700244# TODO: Remove this target once the support gets added to Bazel.
David L. Jones171a6b12022-05-18 13:45:22 -0700245alias(
246 name = "protobuf_headers",
247 actual = "//src/google/protobuf:protobuf_headers",
248 visibility = ["//visibility:public"],
Jisi Liu7a0c4312015-06-18 16:45:27 -0700249)
Jisi Liu993fb702015-10-19 17:19:49 -0700250
Mike Kruskal32bea522022-10-06 16:48:39 -0700251alias(
252 name = "json",
253 actual = "//src/google/protobuf/json",
254 visibility = ["//visibility:public"],
255)
256
Jisi Liu993fb702015-10-19 17:19:49 -0700257################################################################################
258# Java support
259################################################################################
Yannicf0cb9cd2020-02-13 22:04:14 +0100260
Yannicf0cb9cd2020-02-13 22:04:14 +0100261alias(
Jisi Liu166e9bb2015-10-21 10:56:38 -0700262 name = "protobuf_java",
Yannicf0cb9cd2020-02-13 22:04:14 +0100263 actual = "//java/core",
Jisi Liu993fb702015-10-19 17:19:49 -0700264 visibility = ["//visibility:public"],
265)
266
Yannicf0cb9cd2020-02-13 22:04:14 +0100267alias(
Carmi Grushko5c25f412019-05-24 17:26:07 +0300268 name = "protobuf_javalite",
Yannicf0cb9cd2020-02-13 22:04:14 +0100269 actual = "//java/lite",
Jisi Liu993fb702015-10-19 17:19:49 -0700270 visibility = ["//visibility:public"],
271)
272
Yannicf0cb9cd2020-02-13 22:04:14 +0100273alias(
Steven Parkesa9244ca2016-03-10 17:50:25 -0800274 name = "protobuf_java_util",
Yannicf0cb9cd2020-02-13 22:04:14 +0100275 actual = "//java/util",
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800276 visibility = ["//visibility:public"],
Yannicf0cb9cd2020-02-13 22:04:14 +0100277)
278
279alias(
280 name = "java_toolchain",
281 actual = "//java/core:toolchain",
282 visibility = ["//visibility:public"],
283)
284
285alias(
286 name = "javalite_toolchain",
287 actual = "//java/lite:toolchain",
288 visibility = ["//visibility:public"],
Steven Parkesa9244ca2016-03-10 17:50:25 -0800289)
290
Jisi Liu993fb702015-10-19 17:19:49 -0700291################################################################################
292# Python support
293################################################################################
294
David L. Jonesb3cbea12022-05-12 19:48:58 -0700295alias(
Joshua Habermana6901f02022-04-25 22:00:57 +0000296 name = "protobuf_python",
David L. Jonesb3cbea12022-05-12 19:48:58 -0700297 actual = "//python:protobuf_python",
298 visibility = ["//visibility:public"],
Jisi Liu993fb702015-10-19 17:19:49 -0700299)
300
David L. Jonesb3cbea12022-05-12 19:48:58 -0700301alias(
302 name = "python_srcs",
303 actual = "//python:python_srcs",
Adam Cozzette501ecec2023-09-26 14:36:20 -0700304 visibility = ["//python:__subpackages__"],
David Z. Chen02cd45c2016-05-20 16:49:04 -0700305)
306
David L. Jonesb3cbea12022-05-12 19:48:58 -0700307alias(
308 name = "python_test_srcs",
309 actual = "//python:python_test_srcs",
Adam Cozzette501ecec2023-09-26 14:36:20 -0700310 visibility = ["//python:__subpackages__"],
David L. Jonesb3cbea12022-05-12 19:48:58 -0700311)
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800312
David L. Jonesb3cbea12022-05-12 19:48:58 -0700313alias(
314 name = "well_known_types_py_pb2",
315 actual = "//python:well_known_types_py_pb2",
Adam Cozzette41762562022-07-21 23:38:04 +0000316 visibility = ["//visibility:public"],
David L. Jonesb3cbea12022-05-12 19:48:58 -0700317)
David Z. Chen02cd45c2016-05-20 16:49:04 -0700318
David L. Jonesb3cbea12022-05-12 19:48:58 -0700319alias(
Jisi Liu993fb702015-10-19 17:19:49 -0700320 name = "python_common_test_protos",
David L. Jonesb3cbea12022-05-12 19:48:58 -0700321 actual = "//python:python_common_test_protos",
Joshua Habermana6901f02022-04-25 22:00:57 +0000322 visibility = ["//visibility:public"],
Jisi Liu993fb702015-10-19 17:19:49 -0700323)
324
David L. Jonesb3cbea12022-05-12 19:48:58 -0700325alias(
Jisi Liu993fb702015-10-19 17:19:49 -0700326 name = "python_specific_test_protos",
David L. Jonesb3cbea12022-05-12 19:48:58 -0700327 actual = "//python:python_specific_test_protos",
Joshua Habermana6901f02022-04-25 22:00:57 +0000328 visibility = ["//visibility:public"],
Thomas Colthurst7c651422018-05-29 18:26:11 -0400329)
330
cgrushko45d92ae2016-12-02 19:40:50 -0500331proto_lang_toolchain(
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800332 name = "cc_toolchain",
David L. Jones5ebde5b2022-05-05 13:29:47 -0700333 blacklisted_protos = [
Protobuf Team Bot64ae02c2022-12-20 10:02:34 -0800334 "//:compiler_plugin_proto",
335 "//:descriptor_proto",
David L. Jones5ebde5b2022-05-05 13:29:47 -0700336 ],
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800337 command_line = "--cpp_out=$(OUT)",
Mike Kruskalf5192302023-04-06 13:18:30 -0700338 runtime = "//src/google/protobuf:protobuf_nowkt",
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800339 visibility = ["//visibility:public"],
cgrushko45d92ae2016-12-02 19:40:50 -0500340)
cgrushkoe4baf3f2017-01-12 12:51:04 -0500341
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700342################################################################################
343# Objective-C support
344################################################################################
345
Thomas Van Lenten18aa2962018-11-01 09:37:14 -0400346alias(
347 name = "objectivec",
Yannic Bonenberger8b93b8e2020-07-08 17:21:38 +0200348 actual = "//objectivec",
David L. Jones67823fe2022-05-04 17:30:23 -0700349 tags = ["manual"],
Thomas Van Lenten18aa2962018-11-01 09:37:14 -0400350 visibility = ["//visibility:public"],
351)
makdharma286f0592017-05-01 09:49:26 -0700352
Yannic Bonenberger8b93b8e2020-07-08 17:21:38 +0200353alias(
Thomas Van Lenten18aa2962018-11-01 09:37:14 -0400354 name = "protobuf_objc",
Yannic Bonenberger8b93b8e2020-07-08 17:21:38 +0200355 actual = "//objectivec",
David L. Jones67823fe2022-05-04 17:30:23 -0700356 tags = ["manual"],
makdharma286f0592017-05-01 09:49:26 -0700357 visibility = ["//visibility:public"],
358)
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700359
360################################################################################
David L. Jones171a6b12022-05-18 13:45:22 -0700361# Test protos
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700362################################################################################
363
David L. Jones171a6b12022-05-18 13:45:22 -0700364alias(
Mike Kruskal81e35132022-09-19 11:08:21 -0700365 name = "lite_test_proto_srcs",
366 actual = "//src/google/protobuf:lite_test_proto_srcs", # proto_library
367 visibility = ["//:__subpackages__"],
368)
369
370alias(
David L. Jones171a6b12022-05-18 13:45:22 -0700371 name = "lite_test_protos",
372 actual = "//src/google/protobuf:lite_test_protos", # proto_library
373 visibility = ["//:__subpackages__"],
374)
375
376alias(
377 name = "test_proto_srcs",
378 actual = "//src/google/protobuf:test_proto_srcs", # filegroup
379 visibility = ["//:__subpackages__"],
380)
381
382alias(
383 name = "test_protos",
384 actual = "//src/google/protobuf:test_protos", # proto_library
385 visibility = ["//:__subpackages__"],
386)
387
388# Validate generated proto source inputs:
389
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700390genrule(
391 name = "generated_protos",
David L. Jones171a6b12022-05-18 13:45:22 -0700392 testonly = 1,
393 srcs = ["//src/google/protobuf:test_proto_srcs"],
David L. Jones67823fe2022-05-04 17:30:23 -0700394 outs = ["unittest_gen_import.proto"],
David L. Jones171a6b12022-05-18 13:45:22 -0700395 cmd = "cat src/google/protobuf/unittest_import.proto > $@",
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700396)
397
398proto_library(
399 name = "generated_protos_proto",
David L. Jones171a6b12022-05-18 13:45:22 -0700400 testonly = 1,
David L. Jonesb3cbea12022-05-12 19:48:58 -0700401 srcs = [":generated_protos"],
David L. Jones171a6b12022-05-18 13:45:22 -0700402 deps = ["//src/google/protobuf:generic_test_protos"],
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700403)
404
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700405internal_py_proto_library(
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700406 name = "generated_protos_py",
David L. Jones171a6b12022-05-18 13:45:22 -0700407 testonly = 1,
David L. Jonesb3cbea12022-05-12 19:48:58 -0700408 srcs = [":generated_protos"],
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700409 default_runtime = "",
410 protoc = ":protoc",
David L. Jonesb3cbea12022-05-12 19:48:58 -0700411 deps = ["//python:python_common_test_protos"],
Fahrzin Hemmati0d68b292018-03-26 19:08:26 -0700412)
Josh Haberman6dec8cf2018-11-03 12:59:45 -0700413
414################################################################################
415# Conformance tests
416################################################################################
417
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700418cc_proto_library(
419 name = "test_messages_proto2_cc_proto",
420 visibility = [
421 "//conformance:__pkg__",
422 "//src:__subpackages__",
423 ],
424 deps = ["//src/google/protobuf:test_messages_proto2_proto"],
David L. Jones637a6992022-05-06 13:30:48 -0700425)
426
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700427cc_proto_library(
428 name = "test_messages_proto3_cc_proto",
429 visibility = [
430 "//conformance:__pkg__",
431 "//src:__subpackages__",
432 ],
433 deps = ["//src/google/protobuf:test_messages_proto3_proto"],
Josh Haberman6dec8cf2018-11-03 12:59:45 -0700434)
435
Deanna Garciaab4585a2022-02-01 18:24:53 +0000436java_proto_library(
Derek Perezbc45f922021-04-20 11:36:32 -0700437 name = "test_messages_proto2_java_proto",
438 visibility = [
David L. Jones637a6992022-05-06 13:30:48 -0700439 "//conformance:__pkg__",
Derek Perezbc45f922021-04-20 11:36:32 -0700440 "//java:__subpackages__",
441 ],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700442 deps = ["//src/google/protobuf:test_messages_proto2_proto"],
Derek Perezbc45f922021-04-20 11:36:32 -0700443)
444
445java_proto_library(
446 name = "test_messages_proto3_java_proto",
447 visibility = [
David L. Jones637a6992022-05-06 13:30:48 -0700448 "//conformance:__pkg__",
Derek Perezbc45f922021-04-20 11:36:32 -0700449 "//java:__subpackages__",
Tamir Duberstein7e97fd42021-08-04 08:03:24 -0400450 ],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700451 deps = ["//src/google/protobuf:test_messages_proto3_proto"],
Derek Perezbc45f922021-04-20 11:36:32 -0700452)
453
Derek Perezbc45f922021-04-20 11:36:32 -0700454java_lite_proto_library(
455 name = "test_messages_proto2_java_proto_lite",
456 visibility = [
David L. Jones637a6992022-05-06 13:30:48 -0700457 "//conformance:__pkg__",
Derek Perezbc45f922021-04-20 11:36:32 -0700458 "//java:__subpackages__",
459 ],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700460 deps = ["//src/google/protobuf:test_messages_proto2_proto"],
Derek Perezbc45f922021-04-20 11:36:32 -0700461)
462
463java_lite_proto_library(
Derek Perezbc45f922021-04-20 11:36:32 -0700464 name = "test_messages_proto3_java_proto_lite",
465 visibility = [
David L. Jones637a6992022-05-06 13:30:48 -0700466 "//conformance:__pkg__",
Derek Perezbc45f922021-04-20 11:36:32 -0700467 "//java:__subpackages__",
468 ],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700469 deps = ["//src/google/protobuf:test_messages_proto3_proto"],
470)
471
472internal_objc_proto_library(
473 name = "test_messages_proto2_objc_proto",
Mike Kruskalca4b0632022-08-11 20:55:01 -0700474 testonly = 1,
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700475 srcs = ["//src/google/protobuf:test_messages_proto2.proto"],
476 includes = ["src/google/protobuf"],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700477 visibility = [
478 "//conformance:__pkg__",
479 "//objectivec:__subpackages__",
480 ],
481)
482
483internal_objc_proto_library(
484 name = "test_messages_proto3_objc_proto",
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700485 testonly = 1,
Mike Kruskalca4b0632022-08-11 20:55:01 -0700486 srcs = ["//src/google/protobuf:test_messages_proto3.proto"],
487 includes = [
Mike Kruskalca4b0632022-08-11 20:55:01 -0700488 "src/google/protobuf",
Mike Kruskalba6d1732022-08-12 10:44:59 -0700489 # The above must come first.
490 "src",
Mike Kruskalca4b0632022-08-11 20:55:01 -0700491 ],
492 proto_deps = [":well_known_protos"],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700493 visibility = [
494 "//conformance:__pkg__",
495 "//objectivec:__subpackages__",
496 ],
497)
498
499internal_php_proto_library(
500 name = "test_messages_proto3_php_proto",
Mike Kruskalca4b0632022-08-11 20:55:01 -0700501 testonly = 1,
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700502 srcs = ["//src/google/protobuf:test_messages_proto3.proto"],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700503 outs = [
Mike Kruskalca4b0632022-08-11 20:55:01 -0700504 "GPBMetadata/TestMessagesProto3.php",
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700505 "Protobuf_test_messages/Proto3/EnumOnlyProto3.php",
506 "Protobuf_test_messages/Proto3/EnumOnlyProto3/PBBool.php",
507 "Protobuf_test_messages/Proto3/ForeignEnum.php",
508 "Protobuf_test_messages/Proto3/ForeignMessage.php",
509 "Protobuf_test_messages/Proto3/NullHypothesisProto3.php",
510 "Protobuf_test_messages/Proto3/TestAllTypesProto3.php",
511 "Protobuf_test_messages/Proto3/TestAllTypesProto3/AliasedEnum.php",
512 "Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedEnum.php",
513 "Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedMessage.php",
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700514 ],
Mike Kruskalca4b0632022-08-11 20:55:01 -0700515 includes = [
Mike Kruskalca4b0632022-08-11 20:55:01 -0700516 "src/google/protobuf",
Mike Kruskalba6d1732022-08-12 10:44:59 -0700517 # The above must come first.
518 "src",
Mike Kruskalca4b0632022-08-11 20:55:01 -0700519 ],
520 proto_deps = [":well_known_protos"],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700521 visibility = [
522 "//conformance:__pkg__",
523 "//php:__subpackages__",
524 ],
525)
526
527internal_ruby_proto_library(
528 name = "test_messages_proto2_ruby_proto",
Mike Kruskalca4b0632022-08-11 20:55:01 -0700529 testonly = 1,
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700530 srcs = ["//src/google/protobuf:test_messages_proto2.proto"],
531 includes = ["src/google/protobuf"],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700532 visibility = [
533 "//conformance:__pkg__",
534 "//ruby:__subpackages__",
535 ],
536)
537
538internal_ruby_proto_library(
539 name = "test_messages_proto3_ruby_proto",
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700540 testonly = 1,
Mike Kruskalca4b0632022-08-11 20:55:01 -0700541 srcs = ["//src/google/protobuf:test_messages_proto3.proto"],
542 includes = [
Mike Kruskalca4b0632022-08-11 20:55:01 -0700543 "src/google/protobuf",
Mike Kruskalba6d1732022-08-12 10:44:59 -0700544 # The above must come first.
545 "src",
Mike Kruskalca4b0632022-08-11 20:55:01 -0700546 ],
Mike Kruskaled5c57a2022-08-10 22:51:29 -0700547 visibility = [
548 "//conformance:__pkg__",
549 "//ruby:__subpackages__",
550 ],
Adam Cozzette501ecec2023-09-26 14:36:20 -0700551 deps = [":well_known_ruby_protos"],
Derek Perezbc45f922021-04-20 11:36:32 -0700552)
553
UebelAndreae26a812021-08-06 08:08:32 -0700554filegroup(
555 name = "bzl_srcs",
556 srcs = glob(["**/*.bzl"]),
557 visibility = ["//visibility:public"],
558)
Deanna Garciaab4585a2022-02-01 18:24:53 +0000559
David L. Jonesd76f8c82022-04-22 16:58:16 -0700560################################################################################
561# Packaging rules
562################################################################################
563
564# Files included in all source distributions
565pkg_files(
566 name = "common_dist_files",
David L. Jones67823fe2022-05-04 17:30:23 -0700567 srcs = glob(
568 [
569 "*.bzl",
570 "cmake/*.cmake",
571 "cmake/*.in",
572 "editors/*",
David L. Jones67823fe2022-05-04 17:30:23 -0700573 ],
574 allow_empty = True,
575 ) + [
David L. Jones95da0ba2022-04-29 17:57:55 -0700576 "BUILD.bazel",
David L. Jonesd76f8c82022-04-22 16:58:16 -0700577 "CMakeLists.txt",
578 "CONTRIBUTORS.txt",
579 "LICENSE",
David L. Jonesd76f8c82022-04-22 16:58:16 -0700580 "README.md",
581 "WORKSPACE",
David L. Jonesd76f8c82022-04-22 16:58:16 -0700582 "cmake/README.md",
583 "generate_descriptor_proto.sh",
584 "maven_install.json",
David L. Jones354aba82022-05-09 16:32:59 -0700585 "//third_party:BUILD.bazel",
David L. Jonesd76f8c82022-04-22 16:58:16 -0700586 "//third_party:zlib.BUILD",
David L. Jonesd76f8c82022-04-22 16:58:16 -0700587 ],
588 strip_prefix = strip_prefix.from_root(""),
589 visibility = ["//pkg:__pkg__"],
590)
591
David L. Jonesd76f8c82022-04-22 16:58:16 -0700592# Additional files for C#
593pkg_files(
594 name = "csharp_dist_files",
595 srcs = [
596 "global.json",
597 ],
598 visibility = ["//pkg:__pkg__"],
599)
600
601# Additional files for ObjC
602pkg_files(
603 name = "objectivec_dist_files",
604 srcs = [
605 "Protobuf.podspec",
606 ],
607 visibility = ["//pkg:__pkg__"],
608)