Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
153 lines
5.1 KiB
153 lines
5.1 KiB
3 years ago
|
# Copyright (c) 2009-2022, Google LLC
|
||
|
# All rights reserved.
|
||
|
#
|
||
|
# Redistribution and use in source and binary forms, with or without
|
||
|
# modification, are permitted provided that the following conditions are met:
|
||
|
# * Redistributions of source code must retain the above copyright
|
||
|
# notice, this list of conditions and the following disclaimer.
|
||
|
# * Redistributions in binary form must reproduce the above copyright
|
||
|
# notice, this list of conditions and the following disclaimer in the
|
||
|
# documentation and/or other materials provided with the distribution.
|
||
|
# * Neither the name of Google LLC nor the
|
||
|
# names of its contributors may be used to endorse or promote products
|
||
|
# derived from this software without specific prior written permission.
|
||
|
#
|
||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||
|
# DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY
|
||
|
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||
|
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
|
||
|
load("//bazel:py_proto_library.bzl", "py_proto_library")
|
||
|
load(":dist.bzl", "py_dist", "py_dist_module")
|
||
|
load("@bazel_skylib//lib:selects.bzl", "selects")
|
||
|
load("@com_google_protobuf//:protobuf_version.bzl", "PROTOBUF_VERSION")
|
||
|
load("@rules_python//python:packaging.bzl", "py_wheel")
|
||
|
|
||
|
licenses(["notice"])
|
||
|
|
||
|
py_dist_module(
|
||
|
name = "message_mod",
|
||
|
extension = "//python:_message_binary",
|
||
|
module_name = "google.protobuf.pyext._message",
|
||
|
)
|
||
|
|
||
|
py_dist_module(
|
||
|
name = "api_implementation_mod",
|
||
|
extension = "//python:_api_implementation_binary",
|
||
|
module_name = "google.protobuf.internal.api_implementation",
|
||
|
)
|
||
|
|
||
|
py_proto_library(
|
||
|
name = "well_known_proto_py_pb2",
|
||
|
deps = [
|
||
|
"@com_google_protobuf//:any_proto",
|
||
|
"@com_google_protobuf//:api_proto",
|
||
|
"@com_google_protobuf//:compiler_plugin_proto",
|
||
|
"@com_google_protobuf//:descriptor_proto",
|
||
|
"@com_google_protobuf//:duration_proto",
|
||
|
"@com_google_protobuf//:empty_proto",
|
||
|
"@com_google_protobuf//:field_mask_proto",
|
||
|
"@com_google_protobuf//:source_context_proto",
|
||
|
"@com_google_protobuf//:struct_proto",
|
||
|
"@com_google_protobuf//:timestamp_proto",
|
||
|
"@com_google_protobuf//:type_proto",
|
||
|
"@com_google_protobuf//:wrappers_proto",
|
||
|
],
|
||
|
)
|
||
|
|
||
|
config_setting(
|
||
|
name = "aarch64_cpu",
|
||
|
values = {"cpu": "linux-aarch_64"},
|
||
|
)
|
||
|
|
||
|
config_setting(
|
||
|
name = "x86_64_cpu",
|
||
|
values = {"cpu": "linux-x86_64"},
|
||
|
)
|
||
|
|
||
|
config_setting(
|
||
|
name = "osx-x86_64_cpu",
|
||
|
values = {"cpu": "osx-x86_64"},
|
||
|
)
|
||
|
|
||
|
config_setting(
|
||
|
name = "win32_cpu",
|
||
|
values = {"cpu": "win32"},
|
||
|
)
|
||
|
|
||
|
config_setting(
|
||
|
name = "win64_cpu",
|
||
|
values = {"cpu": "win64"},
|
||
|
)
|
||
|
|
||
|
py_wheel(
|
||
|
name = "binary_wheel",
|
||
|
abi = select({
|
||
|
"//python:full_api_3.7": "cp37m",
|
||
|
"//python:full_api_3.8": "cp38",
|
||
|
"//python:full_api_3.9": "cp39",
|
||
|
"//conditions:default": "abi3",
|
||
|
}),
|
||
|
distribution = "protobuf",
|
||
|
platform = select({
|
||
|
":x86_64_cpu": "manylinux2014_x86_64",
|
||
|
":aarch64_cpu": "manylinux2014_aarch64",
|
||
|
":osx-x86_64_cpu": "macosx_10_9_universal",
|
||
|
":win32_cpu": "win32",
|
||
|
":win64_cpu": "win_amd64",
|
||
|
"//conditions:default": "any",
|
||
|
}),
|
||
|
python_tag = selects.with_or({
|
||
|
("//python:limited_api_3.7", "//python:full_api_3.7"): "cp37",
|
||
|
"//python:full_api_3.8": "cp38",
|
||
|
"//python:full_api_3.9": "cp39",
|
||
|
"//python:limited_api_3.10": "cp310",
|
||
|
"//conditions:default": "system",
|
||
|
}),
|
||
|
strip_path_prefixes = ["python/"],
|
||
|
version = PROTOBUF_VERSION,
|
||
|
deps = [
|
||
|
":message_mod",
|
||
|
":api_implementation_mod",
|
||
|
":well_known_proto_py_pb2",
|
||
|
#TODO(https://github.com/protocolbuffers/upb/issues/503): currently
|
||
|
# this includes the unit tests. We should filter these out so we are
|
||
|
# only distributing true source files.
|
||
|
"@com_google_protobuf//:python_srcs",
|
||
|
],
|
||
|
)
|
||
|
|
||
|
py_dist(
|
||
|
name = "dist",
|
||
|
binary_wheel = ":binary_wheel",
|
||
|
full_api_cpus = [
|
||
|
"win32",
|
||
|
"win64",
|
||
|
],
|
||
|
# Windows needs version-specific wheels until 3.10.
|
||
|
full_api_versions = [
|
||
|
"37",
|
||
|
"38",
|
||
|
"39",
|
||
|
],
|
||
|
# Limited API: these wheels will satisfy any Python version >= the
|
||
|
# given version.
|
||
|
#
|
||
|
# Technically the limited API doesn't have the functions we need until
|
||
|
# 3.10, but on Linux we can get away with using 3.7 (see ../python_api.h for
|
||
|
# details).
|
||
|
limited_api_wheels = {
|
||
|
"win32": "310",
|
||
|
"win64": "310",
|
||
|
"linux-x86_64": "37",
|
||
|
"linux-aarch_64": "37",
|
||
|
},
|
||
|
tags = ["manual"],
|
||
|
)
|