From 6dec8cf96e32fd7fb0121a75ca72acf10863ecc9 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Sat, 3 Nov 2018 12:59:45 -0700 Subject: [PATCH 1/3] Added conformance tests to Bazel BUIDL file. --- BUILD | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ WORKSPACE | 5 ++-- 2 files changed, 92 insertions(+), 3 deletions(-) diff --git a/BUILD b/BUILD index 0130f55e88..76a73f5669 100644 --- a/BUILD +++ b/BUILD @@ -966,3 +966,93 @@ py_proto_library( default_runtime = "", protoc = ":protoc", ) + +################################################################################ +# Conformance tests +################################################################################ + +proto_library( + name = "test_messages_proto2_proto", + srcs = [ + "src/google/protobuf/test_messages_proto2.proto", + ], +) + +proto_library( + name = "test_messages_proto3_proto", + srcs = [ + "src/google/protobuf/test_messages_proto3.proto", + ], + deps = [ + ":any_proto", + ":duration_proto", + ":field_mask_proto", + ":struct_proto", + ":timestamp_proto", + ":wrappers_proto", + ], +) + +cc_proto_library( + name = "test_messages_proto2_proto_cc", + srcs = [ + "src/google/protobuf/test_messages_proto2.proto", + ], +) + +cc_proto_library( + name = "test_messages_proto3_proto_cc", + srcs = [ + "src/google/protobuf/test_messages_proto3.proto", + ], + deps = [ + ":cc_wkt_protos", + ], +) + +proto_library( + name = "conformance_proto", + srcs = [ + "conformance/conformance.proto", + ], +) + +cc_proto_library( + name = "conformance_proto_cc", + srcs = ["conformance/conformance.proto"], +) + +cc_library( + name = "jsoncpp", + hdrs = ["conformance/third_party/jsoncpp/json.h"], + srcs = ["conformance/third_party/jsoncpp/jsoncpp.cpp"], + includes = ["conformance"], +) + +cc_library( + name = "conformance_test", + srcs = [ + "conformance/conformance_test.cc", + "conformance/conformance_test_impl.cc", + ], + hdrs = [ + "conformance/conformance_test.h", + ], + deps = [ + ":conformance_proto_cc", + ":jsoncpp", + ":test_messages_proto2_proto_cc", + ":test_messages_proto3_proto_cc", + ], + includes = ["conformance", "src"], +) + +cc_binary( + name = "conformance_test_runner", + srcs = [ + "conformance/conformance_test_runner.cc", + ], + deps = [ + ":conformance_test", + ] +) diff --git a/WORKSPACE b/WORKSPACE index f3020843f1..72cd547ca6 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,10 +1,9 @@ workspace(name = "com_google_protobuf") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -new_local_repository( +http_archive( name = "submodule_gmock", - path = "third_party/googletest", - build_file = "@//:third_party/googletest/BUILD.bazel" + urls = ["https://github.com/google/googletest/archive/release-1.8.1.zip"] ) http_archive( From 25feb59620627b673df76813dfd66e3f565765e7 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Sat, 3 Nov 2018 14:43:20 -0700 Subject: [PATCH 2/3] Added visibility. --- BUILD | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/BUILD b/BUILD index 76a73f5669..ed35babb38 100644 --- a/BUILD +++ b/BUILD @@ -976,6 +976,7 @@ proto_library( srcs = [ "src/google/protobuf/test_messages_proto2.proto", ], + visibility = ["//visibility:public"], ) proto_library( @@ -991,6 +992,7 @@ proto_library( ":timestamp_proto", ":wrappers_proto", ], + visibility = ["//visibility:public"], ) cc_proto_library( @@ -1015,6 +1017,7 @@ proto_library( srcs = [ "conformance/conformance.proto", ], + visibility = ["//visibility:public"], ) cc_proto_library( @@ -1054,5 +1057,6 @@ cc_binary( ], deps = [ ":conformance_test", - ] + ], + visibility = ["//visibility:public"], ) From c659a4a4db2e27463e51c732df25730973956be2 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 14 May 2019 14:01:16 -0700 Subject: [PATCH 3/3] Fixed typo: conformance_test_runner should be a binary, not library. --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index f8ad0c5670..d681994fec 100644 --- a/BUILD +++ b/BUILD @@ -1091,7 +1091,7 @@ cc_library( ], ) -cc_library( +cc_binary( name = "conformance_test_runner", srcs = ["conformance/conformance_test_main.cc"], deps = [