sled/3party/protobuf-3.21.12/conformance/BUILD.bazel

184 lines
4.1 KiB
Python
Raw Normal View History

2024-03-13 18:11:02 +08:00
# Conformance testing for Protobuf.
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library")
load(
"@rules_pkg//:mappings.bzl",
"pkg_attributes",
"pkg_filegroup",
"pkg_files",
"strip_prefix",
)
exports_files([
"conformance_test_runner.sh",
"failure_list_java.txt",
"failure_list_java_lite.txt",
"text_format_failure_list_java.txt",
"text_format_failure_list_java_lite.txt",
])
cc_proto_library(
name = "test_messages_proto2_proto_cc",
deps = ["//:test_messages_proto2_proto"],
)
cc_proto_library(
name = "test_messages_proto3_proto_cc",
deps = ["//:test_messages_proto3_proto"],
)
proto_library(
name = "conformance_proto",
srcs = ["conformance.proto"],
visibility = ["//visibility:public"],
)
cc_proto_library(
name = "conformance_proto_cc",
deps = [":conformance_proto"],
)
java_proto_library(
name = "conformance_java_proto",
visibility = [
"//java:__subpackages__",
],
deps = [":conformance_proto"],
)
java_lite_proto_library(
name = "conformance_java_proto_lite",
visibility = [
"//java:__subpackages__",
],
deps = [":conformance_proto"],
)
cc_library(
name = "jsoncpp",
srcs = ["third_party/jsoncpp/jsoncpp.cpp"],
hdrs = ["third_party/jsoncpp/json.h"],
includes = ["."],
)
cc_library(
name = "conformance_test",
srcs = [
"conformance_test.cc",
"conformance_test_runner.cc",
],
hdrs = [
"conformance_test.h",
],
includes = ["."],
deps = [":conformance_proto_cc"],
)
cc_library(
name = "binary_json_conformance_suite",
srcs = ["binary_json_conformance_suite.cc"],
hdrs = ["binary_json_conformance_suite.h"],
deps = [
":conformance_test",
":jsoncpp",
":test_messages_proto2_proto_cc",
":test_messages_proto3_proto_cc",
],
)
cc_library(
name = "text_format_conformance_suite",
srcs = ["text_format_conformance_suite.cc"],
hdrs = ["text_format_conformance_suite.h"],
deps = [
":conformance_test",
":test_messages_proto2_proto_cc",
":test_messages_proto3_proto_cc",
],
)
cc_binary(
name = "conformance_test_runner",
srcs = ["conformance_test_main.cc"],
visibility = ["//visibility:public"],
deps = [
":binary_json_conformance_suite",
":conformance_test",
":text_format_conformance_suite",
],
)
java_binary(
name = "conformance_java",
srcs = ["ConformanceJava.java"],
main_class = "ConformanceJava",
visibility = [
"//java:__subpackages__",
],
deps = [
":conformance_java_proto",
"//:protobuf_java",
"//:protobuf_java_util",
"//:test_messages_proto2_java_proto",
"//:test_messages_proto3_java_proto",
],
)
java_binary(
name = "conformance_java_lite",
srcs = ["ConformanceJavaLite.java"],
main_class = "ConformanceJavaLite",
visibility = [
"//java:__subpackages__",
],
deps = [
":conformance_java_proto_lite",
"//:protobuf_java_util",
"//:protobuf_javalite",
"//:test_messages_proto2_java_proto_lite",
"//:test_messages_proto3_java_proto_lite",
],
)
filegroup(
name = "all_files",
srcs = glob(["**/*"]),
visibility = ["//:__pkg__"],
)
pkg_files(
name = "dist_files",
srcs = glob(
["**/*"],
exclude = [
# Handled by dist_scripts:
"conformance_test_runner.sh",
# The following are not in autotools dist:
"autoload.php",
"conformance_nodejs.js",
"failure_list_jruby.txt",
"update_failure_list.py",
],
),
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)
pkg_files(
name = "dist_scripts",
srcs = ["conformance_test_runner.sh"],
attributes = pkg_attributes(mode = "0555"),
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)
pkg_filegroup(
name = "all_dist_files",
srcs = [
":dist_files",
":dist_scripts",
],
visibility = ["//pkg:__pkg__"],
)