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.

116 lines
3.3 KiB

# Protobuf PHP runtime
#
# See also code generation logic under /src/google/protobuf/compiler/php.
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("//build_defs:internal_shell.bzl", "inline_sh_binary")
load("//conformance:defs.bzl", "conformance_test")
filegroup(
name = "source_files",
visibility = [
"//conformance:__pkg__",
"//php:__pkg__",
],
srcs = glob([
"ext/google/protobuf/*.h",
"ext/google/protobuf/*.c",
"src/GPBMetadata/Google/Protobuf/**/*.php",
"src/Google/Protobuf/**/*.php",
]) + [
"composer.json",
"ext/google/protobuf/wkt.inc",
"ext/google/protobuf/config.m4",
"ext/google/protobuf/package.xml",
],
)
################################################################################
# PHP Extension
################################################################################
inline_sh_binary(
name = "build_extension",
cmd = """
mkdir -p php/ext/google/protobuf/third_party/utf8_range
cp third_party/utf8_range/* php/ext/google/protobuf/third_party/utf8_range
pushd php/ext/google/protobuf
phpize
./configure --with-php-config=$$(which php-config)
make
popd
""",
)
genrule(
name = "extension",
srcs = [
":source_files",
"//third_party/utf8_range:all_files",
],
tools = [":build_extension"],
outs = ["protobuf.so"],
cmd = """
./$(execpath :build_extension) $@
cp php/ext/google/protobuf/modules/protobuf.so $(OUTS)
""",
visibility = ["//visibility:public"],
)
################################################################################
# Tests
################################################################################
conformance_test(
name = "conformance_test",
failure_list = "//conformance:failure_list_php.txt",
testee = "//conformance:conformance_php",
text_format_failure_list = "//conformance:text_format_failure_list_php.txt",
target_compatible_with = select({
"@platforms//os:osx": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
)
conformance_test(
name = "conformance_test_c",
failure_list = "//conformance:failure_list_php_c.txt",
testee = "//conformance:conformance_php_c",
text_format_failure_list = "//conformance:text_format_failure_list_php.txt",
target_compatible_with = select({
"@platforms//os:osx": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
)
################################################################################
# Distribution files
################################################################################
pkg_files(
name = "dist_files",
srcs = glob([
"ext/google/protobuf/**/*",
"tests/*.php",
"tests/*.sh",
3 years ago
"tests/generated_previous/**/*.php",
"tests/proto/**/*.proto",
3 years ago
"tests/proto_previous/*.proto",
]) + [
":source_files",
"BUILD.bazel",
"README.md",
"REFCOUNTING.md",
"composer.json",
"generate_descriptor_protos.sh",
"generate_test_protos.sh",
"release.sh",
"src/phpdoc.dist.xml",
"tests/valgrind.supp",
],
prefix = "php",
strip_prefix = strip_prefix.from_pkg(""),
visibility = ["//pkg:__pkg__"],
)