Laszlo Csomor | 5517168 | 2017-12-01 12:05:32 +0100 | [diff] [blame] | 1 | # Bazel (https://bazel.build/) BUILD file for Protobuf. |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 2 | |
Mike Kruskal | ca4b063 | 2022-08-11 20:55:01 -0700 | [diff] [blame] | 3 | load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library") |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 4 | load("@rules_java//java:defs.bzl", "java_lite_proto_library", "java_proto_library") |
David L. Jones | d76f8c8 | 2022-04-22 16:58:16 -0700 | [diff] [blame] | 5 | load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") |
Yannic Bonenberger | 6e89919 | 2019-07-23 16:28:57 +0200 | [diff] [blame] | 6 | load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library") |
Mike Kruskal | 723bd4c | 2023-02-28 14:07:48 -0800 | [diff] [blame] | 7 | load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS") |
Mike Kruskal | 571b727 | 2023-11-21 12:08:51 -0800 | [diff] [blame] | 8 | load(":protobuf.bzl", "internal_objc_proto_library", "internal_php_proto_library", "internal_py_proto_library") |
David L. Jones | 46710ca | 2022-04-20 16:26:44 -0700 | [diff] [blame] | 9 | |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 10 | licenses(["notice"]) |
| 11 | |
Piotr Sikora | faea19c | 2016-08-04 15:32:14 -0700 | [diff] [blame] | 12 | exports_files(["LICENSE"]) |
| 13 | |
Jorge Canizales | d5d7bb3 | 2015-06-28 15:23:02 -0700 | [diff] [blame] | 14 | ################################################################################ |
Jakob Buchgraber | 699c0eb | 2017-09-05 17:15:10 +0200 | [diff] [blame] | 15 | # Well Known Types Proto Library Rules |
| 16 | # |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 17 | # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf |
| 18 | ################################################################################ |
Jakob Buchgraber | 699c0eb | 2017-09-05 17:15:10 +0200 | [diff] [blame] | 19 | # 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", |
YJ | 2bc5f95 | 2022-06-10 04:27:39 +0800 | [diff] [blame] | 24 | # deps = ["@com_google_protobuf//:any_proto"], |
Jakob Buchgraber | 699c0eb | 2017-09-05 17:15:10 +0200 | [diff] [blame] | 25 | # ) |
| 26 | ################################################################################ |
| 27 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 28 | alias( |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 29 | name = "any_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 30 | actual = "//src/google/protobuf:any_proto", |
Jakob Buchgraber | 699c0eb | 2017-09-05 17:15:10 +0200 | [diff] [blame] | 31 | visibility = ["//visibility:public"], |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 32 | ) |
Jakob Buchgraber | 699c0eb | 2017-09-05 17:15:10 +0200 | [diff] [blame] | 33 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 34 | alias( |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 35 | name = "api_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 36 | actual = "//src/google/protobuf:api_proto", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 37 | visibility = ["//visibility:public"], |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 38 | ) |
| 39 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 40 | alias( |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 41 | name = "duration_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 42 | actual = "//src/google/protobuf:duration_proto", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 43 | visibility = ["//visibility:public"], |
| 44 | ) |
| 45 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 46 | alias( |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 47 | name = "empty_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 48 | actual = "//src/google/protobuf:empty_proto", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 49 | visibility = ["//visibility:public"], |
| 50 | ) |
| 51 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 52 | alias( |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 53 | name = "field_mask_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 54 | actual = "//src/google/protobuf:field_mask_proto", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 55 | visibility = ["//visibility:public"], |
| 56 | ) |
| 57 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 58 | alias( |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 59 | name = "source_context_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 60 | actual = "//src/google/protobuf:source_context_proto", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 61 | visibility = ["//visibility:public"], |
| 62 | ) |
| 63 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 64 | alias( |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 65 | name = "struct_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 66 | actual = "//src/google/protobuf:struct_proto", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 67 | visibility = ["//visibility:public"], |
| 68 | ) |
| 69 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 70 | alias( |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 71 | name = "timestamp_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 72 | actual = "//src/google/protobuf:timestamp_proto", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 73 | visibility = ["//visibility:public"], |
| 74 | ) |
| 75 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 76 | alias( |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 77 | name = "type_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 78 | actual = "//src/google/protobuf:type_proto", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 79 | visibility = ["//visibility:public"], |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 80 | ) |
| 81 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 82 | alias( |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 83 | name = "wrappers_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 84 | actual = "//src/google/protobuf:wrappers_proto", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 85 | visibility = ["//visibility:public"], |
| 86 | ) |
| 87 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 88 | # Source files: these are aliases to a filegroup, not a `proto_library`. |
| 89 | # |
| 90 | # (This is _probably_ not what you want.) |
| 91 | alias( |
| 92 | name = "lite_well_known_protos", |
| 93 | actual = "//src/google/protobuf:well_known_type_protos", # filegroup |
| 94 | visibility = ["//visibility:public"], |
| 95 | ) |
| 96 | |
| 97 | alias( |
| 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 | |
| 106 | alias( |
Mike Kruskal | 4f9e417 | 2023-06-30 20:14:50 -0700 | [diff] [blame] | 107 | name = "cpp_features_proto", |
| 108 | actual = "//src/google/protobuf:cpp_features_proto", # proto_library |
| 109 | visibility = ["//visibility:public"], |
| 110 | ) |
| 111 | |
| 112 | alias( |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 113 | name = "descriptor_proto", |
| 114 | actual = "//src/google/protobuf:descriptor_proto", # proto_library |
| 115 | visibility = ["//visibility:public"], |
| 116 | ) |
| 117 | |
| 118 | alias( |
| 119 | name = "descriptor_proto_srcs", |
| 120 | actual = "//src/google/protobuf:descriptor_proto_srcs", # filegroup |
| 121 | visibility = ["//visibility:public"], |
| 122 | ) |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 123 | |
David L. Jones | cbd1adc | 2022-05-17 16:39:47 -0700 | [diff] [blame] | 124 | alias( |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 125 | name = "compiler_plugin_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 126 | actual = "//src/google/protobuf/compiler:plugin_proto", # proto_library |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 127 | visibility = ["//visibility:public"], |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 128 | ) |
| 129 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 130 | cc_library( |
| 131 | name = "cc_wkt_protos", |
| 132 | deprecation = "Only for backward compatibility. Do not use.", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 133 | visibility = ["//visibility:public"], |
| 134 | ) |
| 135 | |
David L. Jones | ceaae1b | 2022-05-26 16:32:15 -0700 | [diff] [blame] | 136 | # 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. |
| 142 | filegroup( |
| 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 Buchgraber | 699c0eb | 2017-09-05 17:15:10 +0200 | [diff] [blame] | 153 | ################################################################################ |
Jorge Canizales | d5d7bb3 | 2015-06-28 15:23:02 -0700 | [diff] [blame] | 154 | # Protocol Buffers Compiler |
| 155 | ################################################################################ |
| 156 | |
Protobuf Team Bot | 7787f3e | 2022-12-16 03:07:20 -0800 | [diff] [blame] | 157 | alias( |
| 158 | name = "protoc_lib", |
| 159 | actual = "//src/google/protobuf/compiler:protoc_lib", |
| 160 | visibility = ["//visibility:public"], |
| 161 | ) |
| 162 | |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 163 | cc_binary( |
| 164 | name = "protoc", |
Mike Kruskal | d220b43 | 2022-08-29 18:19:38 -0400 | [diff] [blame] | 165 | copts = COPTS, |
Mike Kruskal | 723bd4c | 2023-02-28 14:07:48 -0800 | [diff] [blame] | 166 | linkopts = LINK_OPTS, |
| 167 | visibility = ["//visibility:public"], |
| 168 | deps = ["//src/google/protobuf/compiler:protoc_lib"], |
| 169 | ) |
| 170 | |
| 171 | cc_binary( |
| 172 | name = "protoc_static", |
| 173 | copts = COPTS, |
Mike Kruskal | 723bd4c | 2023-02-28 14:07:48 -0800 | [diff] [blame] | 174 | features = select({ |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 175 | # 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 Kruskal | 723bd4c | 2023-02-28 14:07:48 -0800 | [diff] [blame] | 180 | }), |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 181 | linkopts = LINK_OPTS, |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 182 | visibility = ["//visibility:public"], |
David L. Jones | cbd1adc | 2022-05-17 16:39:47 -0700 | [diff] [blame] | 183 | deps = ["//src/google/protobuf/compiler:protoc_lib"], |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 184 | ) |
| 185 | |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 186 | ################################################################################ |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 187 | # C++ runtime |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 188 | ################################################################################ |
| 189 | |
Protobuf Team Bot | 5b6c245 | 2023-09-14 12:04:25 -0700 | [diff] [blame] | 190 | # Expose the runtime for the proto_lang_toolchain so that it can also be used in |
| 191 | # a user-defined proto_lang_toolchain. |
| 192 | alias( |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 193 | name = "protobuf_nowkt", |
| 194 | actual = "//src/google/protobuf:protobuf_nowkt", |
| 195 | visibility = ["//visibility:public"], |
Protobuf Team Bot | 5b6c245 | 2023-09-14 12:04:25 -0700 | [diff] [blame] | 196 | ) |
| 197 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 198 | # 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 |
| 207 | alias( |
| 208 | name = "protobuf_lite", |
| 209 | actual = "//src/google/protobuf:protobuf_lite", |
| 210 | visibility = ["//visibility:public"], |
David L. Jones | cbd1adc | 2022-05-17 16:39:47 -0700 | [diff] [blame] | 211 | ) |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 212 | |
David L. Jones | cbd1adc | 2022-05-17 16:39:47 -0700 | [diff] [blame] | 213 | cc_library( |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 214 | name = "protobuf", |
David L. Jones | c2c770e | 2022-05-17 13:26:46 -0700 | [diff] [blame] | 215 | copts = COPTS, |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 216 | linkopts = LINK_OPTS, |
| 217 | visibility = ["//visibility:public"], |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 218 | deps = [ |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 219 | "//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 Bonenberger | a3aecac | 2021-03-10 10:20:39 +0100 | [diff] [blame] | 227 | ], |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 228 | ) |
| 229 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 230 | # 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 Zhang | 81068e8 | 2023-09-18 15:13:49 -0700 | [diff] [blame] | 233 | # TODO: Remove this target once the support gets added to Bazel. |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 234 | alias( |
| 235 | name = "protobuf_headers", |
| 236 | actual = "//src/google/protobuf:protobuf_headers", |
| 237 | visibility = ["//visibility:public"], |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 238 | ) |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 239 | |
Mike Kruskal | 32bea52 | 2022-10-06 16:48:39 -0700 | [diff] [blame] | 240 | alias( |
| 241 | name = "json", |
| 242 | actual = "//src/google/protobuf/json", |
| 243 | visibility = ["//visibility:public"], |
| 244 | ) |
| 245 | |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 246 | ################################################################################ |
| 247 | # Java support |
| 248 | ################################################################################ |
Yannic | f0cb9cd | 2020-02-13 22:04:14 +0100 | [diff] [blame] | 249 | |
Yannic | f0cb9cd | 2020-02-13 22:04:14 +0100 | [diff] [blame] | 250 | alias( |
Jisi Liu | 166e9bb | 2015-10-21 10:56:38 -0700 | [diff] [blame] | 251 | name = "protobuf_java", |
Yannic | f0cb9cd | 2020-02-13 22:04:14 +0100 | [diff] [blame] | 252 | actual = "//java/core", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 253 | visibility = ["//visibility:public"], |
| 254 | ) |
| 255 | |
Yannic | f0cb9cd | 2020-02-13 22:04:14 +0100 | [diff] [blame] | 256 | alias( |
Carmi Grushko | 5c25f41 | 2019-05-24 17:26:07 +0300 | [diff] [blame] | 257 | name = "protobuf_javalite", |
Yannic | f0cb9cd | 2020-02-13 22:04:14 +0100 | [diff] [blame] | 258 | actual = "//java/lite", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 259 | visibility = ["//visibility:public"], |
| 260 | ) |
| 261 | |
Yannic | f0cb9cd | 2020-02-13 22:04:14 +0100 | [diff] [blame] | 262 | alias( |
Steven Parkes | a9244ca | 2016-03-10 17:50:25 -0800 | [diff] [blame] | 263 | name = "protobuf_java_util", |
Yannic | f0cb9cd | 2020-02-13 22:04:14 +0100 | [diff] [blame] | 264 | actual = "//java/util", |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 265 | visibility = ["//visibility:public"], |
Yannic | f0cb9cd | 2020-02-13 22:04:14 +0100 | [diff] [blame] | 266 | ) |
| 267 | |
| 268 | alias( |
| 269 | name = "java_toolchain", |
| 270 | actual = "//java/core:toolchain", |
| 271 | visibility = ["//visibility:public"], |
| 272 | ) |
| 273 | |
| 274 | alias( |
| 275 | name = "javalite_toolchain", |
| 276 | actual = "//java/lite:toolchain", |
| 277 | visibility = ["//visibility:public"], |
Steven Parkes | a9244ca | 2016-03-10 17:50:25 -0800 | [diff] [blame] | 278 | ) |
| 279 | |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 280 | ################################################################################ |
| 281 | # Python support |
| 282 | ################################################################################ |
| 283 | |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 284 | alias( |
Joshua Haberman | a6901f0 | 2022-04-25 22:00:57 +0000 | [diff] [blame] | 285 | name = "protobuf_python", |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 286 | actual = "//python:protobuf_python", |
| 287 | visibility = ["//visibility:public"], |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 288 | ) |
| 289 | |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 290 | alias( |
| 291 | name = "python_srcs", |
| 292 | actual = "//python:python_srcs", |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 293 | visibility = ["//python:__subpackages__"], |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 294 | ) |
| 295 | |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 296 | alias( |
| 297 | name = "python_test_srcs", |
| 298 | actual = "//python:python_test_srcs", |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 299 | visibility = ["//python:__subpackages__"], |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 300 | ) |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 301 | |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 302 | alias( |
| 303 | name = "well_known_types_py_pb2", |
| 304 | actual = "//python:well_known_types_py_pb2", |
Adam Cozzette | 4176256 | 2022-07-21 23:38:04 +0000 | [diff] [blame] | 305 | visibility = ["//visibility:public"], |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 306 | ) |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 307 | |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 308 | alias( |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 309 | name = "python_common_test_protos", |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 310 | actual = "//python:python_common_test_protos", |
Joshua Haberman | a6901f0 | 2022-04-25 22:00:57 +0000 | [diff] [blame] | 311 | visibility = ["//visibility:public"], |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 312 | ) |
| 313 | |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 314 | alias( |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 315 | name = "python_specific_test_protos", |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 316 | actual = "//python:python_specific_test_protos", |
Joshua Haberman | a6901f0 | 2022-04-25 22:00:57 +0000 | [diff] [blame] | 317 | visibility = ["//visibility:public"], |
Thomas Colthurst | 7c65142 | 2018-05-29 18:26:11 -0400 | [diff] [blame] | 318 | ) |
| 319 | |
cgrushko | 45d92ae | 2016-12-02 19:40:50 -0500 | [diff] [blame] | 320 | proto_lang_toolchain( |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 321 | name = "cc_toolchain", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 322 | blacklisted_protos = [ |
Protobuf Team Bot | 64ae02c | 2022-12-20 10:02:34 -0800 | [diff] [blame] | 323 | "//:compiler_plugin_proto", |
| 324 | "//:descriptor_proto", |
David L. Jones | 5ebde5b | 2022-05-05 13:29:47 -0700 | [diff] [blame] | 325 | ], |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 326 | command_line = "--cpp_out=$(OUT)", |
Mike Kruskal | f519230 | 2023-04-06 13:18:30 -0700 | [diff] [blame] | 327 | runtime = "//src/google/protobuf:protobuf_nowkt", |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 328 | visibility = ["//visibility:public"], |
cgrushko | 45d92ae | 2016-12-02 19:40:50 -0500 | [diff] [blame] | 329 | ) |
cgrushko | e4baf3f | 2017-01-12 12:51:04 -0500 | [diff] [blame] | 330 | |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 331 | ################################################################################ |
| 332 | # Objective-C support |
| 333 | ################################################################################ |
| 334 | |
Thomas Van Lenten | 18aa296 | 2018-11-01 09:37:14 -0400 | [diff] [blame] | 335 | alias( |
| 336 | name = "objectivec", |
Yannic Bonenberger | 8b93b8e | 2020-07-08 17:21:38 +0200 | [diff] [blame] | 337 | actual = "//objectivec", |
David L. Jones | 67823fe | 2022-05-04 17:30:23 -0700 | [diff] [blame] | 338 | tags = ["manual"], |
Thomas Van Lenten | 18aa296 | 2018-11-01 09:37:14 -0400 | [diff] [blame] | 339 | visibility = ["//visibility:public"], |
| 340 | ) |
makdharma | 286f059 | 2017-05-01 09:49:26 -0700 | [diff] [blame] | 341 | |
Yannic Bonenberger | 8b93b8e | 2020-07-08 17:21:38 +0200 | [diff] [blame] | 342 | alias( |
Thomas Van Lenten | 18aa296 | 2018-11-01 09:37:14 -0400 | [diff] [blame] | 343 | name = "protobuf_objc", |
Yannic Bonenberger | 8b93b8e | 2020-07-08 17:21:38 +0200 | [diff] [blame] | 344 | actual = "//objectivec", |
David L. Jones | 67823fe | 2022-05-04 17:30:23 -0700 | [diff] [blame] | 345 | tags = ["manual"], |
makdharma | 286f059 | 2017-05-01 09:49:26 -0700 | [diff] [blame] | 346 | visibility = ["//visibility:public"], |
| 347 | ) |
Fahrzin Hemmati | 0d68b29 | 2018-03-26 19:08:26 -0700 | [diff] [blame] | 348 | |
| 349 | ################################################################################ |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 350 | # Test protos |
Fahrzin Hemmati | 0d68b29 | 2018-03-26 19:08:26 -0700 | [diff] [blame] | 351 | ################################################################################ |
| 352 | |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 353 | alias( |
Mike Kruskal | 81e3513 | 2022-09-19 11:08:21 -0700 | [diff] [blame] | 354 | name = "lite_test_proto_srcs", |
| 355 | actual = "//src/google/protobuf:lite_test_proto_srcs", # proto_library |
| 356 | visibility = ["//:__subpackages__"], |
| 357 | ) |
| 358 | |
| 359 | alias( |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 360 | name = "lite_test_protos", |
| 361 | actual = "//src/google/protobuf:lite_test_protos", # proto_library |
| 362 | visibility = ["//:__subpackages__"], |
| 363 | ) |
| 364 | |
| 365 | alias( |
| 366 | name = "test_proto_srcs", |
| 367 | actual = "//src/google/protobuf:test_proto_srcs", # filegroup |
| 368 | visibility = ["//:__subpackages__"], |
| 369 | ) |
| 370 | |
| 371 | alias( |
| 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 Hemmati | 0d68b29 | 2018-03-26 19:08:26 -0700 | [diff] [blame] | 379 | genrule( |
| 380 | name = "generated_protos", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 381 | testonly = 1, |
| 382 | srcs = ["//src/google/protobuf:test_proto_srcs"], |
David L. Jones | 67823fe | 2022-05-04 17:30:23 -0700 | [diff] [blame] | 383 | outs = ["unittest_gen_import.proto"], |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 384 | cmd = "cat src/google/protobuf/unittest_import.proto > $@", |
Fahrzin Hemmati | 0d68b29 | 2018-03-26 19:08:26 -0700 | [diff] [blame] | 385 | ) |
| 386 | |
| 387 | proto_library( |
| 388 | name = "generated_protos_proto", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 389 | testonly = 1, |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 390 | srcs = [":generated_protos"], |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 391 | deps = ["//src/google/protobuf:generic_test_protos"], |
Fahrzin Hemmati | 0d68b29 | 2018-03-26 19:08:26 -0700 | [diff] [blame] | 392 | ) |
| 393 | |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 394 | internal_py_proto_library( |
Fahrzin Hemmati | 0d68b29 | 2018-03-26 19:08:26 -0700 | [diff] [blame] | 395 | name = "generated_protos_py", |
David L. Jones | 171a6b1 | 2022-05-18 13:45:22 -0700 | [diff] [blame] | 396 | testonly = 1, |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 397 | srcs = [":generated_protos"], |
Fahrzin Hemmati | 0d68b29 | 2018-03-26 19:08:26 -0700 | [diff] [blame] | 398 | default_runtime = "", |
| 399 | protoc = ":protoc", |
David L. Jones | b3cbea1 | 2022-05-12 19:48:58 -0700 | [diff] [blame] | 400 | deps = ["//python:python_common_test_protos"], |
Fahrzin Hemmati | 0d68b29 | 2018-03-26 19:08:26 -0700 | [diff] [blame] | 401 | ) |
Josh Haberman | 6dec8cf | 2018-11-03 12:59:45 -0700 | [diff] [blame] | 402 | |
| 403 | ################################################################################ |
| 404 | # Conformance tests |
| 405 | ################################################################################ |
| 406 | |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 407 | cc_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. Jones | 637a699 | 2022-05-06 13:30:48 -0700 | [diff] [blame] | 414 | ) |
| 415 | |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 416 | cc_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 Haberman | 6dec8cf | 2018-11-03 12:59:45 -0700 | [diff] [blame] | 423 | ) |
| 424 | |
Deanna Garcia | ab4585a | 2022-02-01 18:24:53 +0000 | [diff] [blame] | 425 | java_proto_library( |
Derek Perez | bc45f92 | 2021-04-20 11:36:32 -0700 | [diff] [blame] | 426 | name = "test_messages_proto2_java_proto", |
| 427 | visibility = [ |
David L. Jones | 637a699 | 2022-05-06 13:30:48 -0700 | [diff] [blame] | 428 | "//conformance:__pkg__", |
Derek Perez | bc45f92 | 2021-04-20 11:36:32 -0700 | [diff] [blame] | 429 | "//java:__subpackages__", |
| 430 | ], |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 431 | deps = ["//src/google/protobuf:test_messages_proto2_proto"], |
Derek Perez | bc45f92 | 2021-04-20 11:36:32 -0700 | [diff] [blame] | 432 | ) |
| 433 | |
| 434 | java_proto_library( |
| 435 | name = "test_messages_proto3_java_proto", |
| 436 | visibility = [ |
David L. Jones | 637a699 | 2022-05-06 13:30:48 -0700 | [diff] [blame] | 437 | "//conformance:__pkg__", |
Derek Perez | bc45f92 | 2021-04-20 11:36:32 -0700 | [diff] [blame] | 438 | "//java:__subpackages__", |
Tamir Duberstein | 7e97fd4 | 2021-08-04 08:03:24 -0400 | [diff] [blame] | 439 | ], |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 440 | deps = ["//src/google/protobuf:test_messages_proto3_proto"], |
Derek Perez | bc45f92 | 2021-04-20 11:36:32 -0700 | [diff] [blame] | 441 | ) |
| 442 | |
Derek Perez | bc45f92 | 2021-04-20 11:36:32 -0700 | [diff] [blame] | 443 | java_lite_proto_library( |
| 444 | name = "test_messages_proto2_java_proto_lite", |
| 445 | visibility = [ |
David L. Jones | 637a699 | 2022-05-06 13:30:48 -0700 | [diff] [blame] | 446 | "//conformance:__pkg__", |
Derek Perez | bc45f92 | 2021-04-20 11:36:32 -0700 | [diff] [blame] | 447 | "//java:__subpackages__", |
| 448 | ], |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 449 | deps = ["//src/google/protobuf:test_messages_proto2_proto"], |
Derek Perez | bc45f92 | 2021-04-20 11:36:32 -0700 | [diff] [blame] | 450 | ) |
| 451 | |
| 452 | java_lite_proto_library( |
Derek Perez | bc45f92 | 2021-04-20 11:36:32 -0700 | [diff] [blame] | 453 | name = "test_messages_proto3_java_proto_lite", |
| 454 | visibility = [ |
David L. Jones | 637a699 | 2022-05-06 13:30:48 -0700 | [diff] [blame] | 455 | "//conformance:__pkg__", |
Derek Perez | bc45f92 | 2021-04-20 11:36:32 -0700 | [diff] [blame] | 456 | "//java:__subpackages__", |
| 457 | ], |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 458 | deps = ["//src/google/protobuf:test_messages_proto3_proto"], |
| 459 | ) |
| 460 | |
| 461 | internal_objc_proto_library( |
| 462 | name = "test_messages_proto2_objc_proto", |
Mike Kruskal | ca4b063 | 2022-08-11 20:55:01 -0700 | [diff] [blame] | 463 | testonly = 1, |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 464 | srcs = ["//src/google/protobuf:test_messages_proto2.proto"], |
| 465 | includes = ["src/google/protobuf"], |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 466 | visibility = [ |
| 467 | "//conformance:__pkg__", |
| 468 | "//objectivec:__subpackages__", |
| 469 | ], |
| 470 | ) |
| 471 | |
| 472 | internal_objc_proto_library( |
| 473 | name = "test_messages_proto3_objc_proto", |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 474 | testonly = 1, |
Mike Kruskal | ca4b063 | 2022-08-11 20:55:01 -0700 | [diff] [blame] | 475 | srcs = ["//src/google/protobuf:test_messages_proto3.proto"], |
| 476 | includes = [ |
Mike Kruskal | ca4b063 | 2022-08-11 20:55:01 -0700 | [diff] [blame] | 477 | "src/google/protobuf", |
Mike Kruskal | ba6d173 | 2022-08-12 10:44:59 -0700 | [diff] [blame] | 478 | # The above must come first. |
| 479 | "src", |
Mike Kruskal | ca4b063 | 2022-08-11 20:55:01 -0700 | [diff] [blame] | 480 | ], |
| 481 | proto_deps = [":well_known_protos"], |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 482 | visibility = [ |
| 483 | "//conformance:__pkg__", |
| 484 | "//objectivec:__subpackages__", |
| 485 | ], |
| 486 | ) |
| 487 | |
| 488 | internal_php_proto_library( |
| 489 | name = "test_messages_proto3_php_proto", |
Mike Kruskal | ca4b063 | 2022-08-11 20:55:01 -0700 | [diff] [blame] | 490 | testonly = 1, |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 491 | srcs = ["//src/google/protobuf:test_messages_proto3.proto"], |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 492 | outs = [ |
Mike Kruskal | ca4b063 | 2022-08-11 20:55:01 -0700 | [diff] [blame] | 493 | "GPBMetadata/TestMessagesProto3.php", |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 494 | "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 Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 503 | ], |
Mike Kruskal | ca4b063 | 2022-08-11 20:55:01 -0700 | [diff] [blame] | 504 | includes = [ |
Mike Kruskal | ca4b063 | 2022-08-11 20:55:01 -0700 | [diff] [blame] | 505 | "src/google/protobuf", |
Mike Kruskal | ba6d173 | 2022-08-12 10:44:59 -0700 | [diff] [blame] | 506 | # The above must come first. |
| 507 | "src", |
Mike Kruskal | ca4b063 | 2022-08-11 20:55:01 -0700 | [diff] [blame] | 508 | ], |
| 509 | proto_deps = [":well_known_protos"], |
Mike Kruskal | ed5c57a | 2022-08-10 22:51:29 -0700 | [diff] [blame] | 510 | visibility = [ |
| 511 | "//conformance:__pkg__", |
| 512 | "//php:__subpackages__", |
| 513 | ], |
| 514 | ) |
| 515 | |
UebelAndre | ae26a81 | 2021-08-06 08:08:32 -0700 | [diff] [blame] | 516 | filegroup( |
| 517 | name = "bzl_srcs", |
| 518 | srcs = glob(["**/*.bzl"]), |
| 519 | visibility = ["//visibility:public"], |
| 520 | ) |
Deanna Garcia | ab4585a | 2022-02-01 18:24:53 +0000 | [diff] [blame] | 521 | |
David L. Jones | d76f8c8 | 2022-04-22 16:58:16 -0700 | [diff] [blame] | 522 | ################################################################################ |
| 523 | # Packaging rules |
| 524 | ################################################################################ |
| 525 | |
| 526 | # Files included in all source distributions |
| 527 | pkg_files( |
| 528 | name = "common_dist_files", |
David L. Jones | 67823fe | 2022-05-04 17:30:23 -0700 | [diff] [blame] | 529 | srcs = glob( |
| 530 | [ |
| 531 | "*.bzl", |
| 532 | "cmake/*.cmake", |
| 533 | "cmake/*.in", |
| 534 | "editors/*", |
David L. Jones | 67823fe | 2022-05-04 17:30:23 -0700 | [diff] [blame] | 535 | ], |
| 536 | allow_empty = True, |
| 537 | ) + [ |
David L. Jones | 95da0ba | 2022-04-29 17:57:55 -0700 | [diff] [blame] | 538 | "BUILD.bazel", |
David L. Jones | d76f8c8 | 2022-04-22 16:58:16 -0700 | [diff] [blame] | 539 | "CMakeLists.txt", |
| 540 | "CONTRIBUTORS.txt", |
| 541 | "LICENSE", |
David L. Jones | d76f8c8 | 2022-04-22 16:58:16 -0700 | [diff] [blame] | 542 | "README.md", |
| 543 | "WORKSPACE", |
David L. Jones | d76f8c8 | 2022-04-22 16:58:16 -0700 | [diff] [blame] | 544 | "cmake/README.md", |
| 545 | "generate_descriptor_proto.sh", |
| 546 | "maven_install.json", |
David L. Jones | 354aba8 | 2022-05-09 16:32:59 -0700 | [diff] [blame] | 547 | "//third_party:BUILD.bazel", |
David L. Jones | d76f8c8 | 2022-04-22 16:58:16 -0700 | [diff] [blame] | 548 | "//third_party:zlib.BUILD", |
David L. Jones | d76f8c8 | 2022-04-22 16:58:16 -0700 | [diff] [blame] | 549 | ], |
| 550 | strip_prefix = strip_prefix.from_root(""), |
| 551 | visibility = ["//pkg:__pkg__"], |
| 552 | ) |
| 553 | |
David L. Jones | d76f8c8 | 2022-04-22 16:58:16 -0700 | [diff] [blame] | 554 | # Additional files for C# |
| 555 | pkg_files( |
| 556 | name = "csharp_dist_files", |
| 557 | srcs = [ |
| 558 | "global.json", |
| 559 | ], |
| 560 | visibility = ["//pkg:__pkg__"], |
| 561 | ) |
| 562 | |
| 563 | # Additional files for ObjC |
| 564 | pkg_files( |
| 565 | name = "objectivec_dist_files", |
| 566 | srcs = [ |
| 567 | "Protobuf.podspec", |
| 568 | ], |
| 569 | visibility = ["//pkg:__pkg__"], |
| 570 | ) |