diff --git a/WORKSPACE b/WORKSPACE index b2b44859110..e55c10508a0 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -698,3 +698,22 @@ new_http_archive( ]) ) # end pex repos + +http_archive( + name = "com_github_gflags_gflags", + urls = ["https://github.com/gflags/gflags/archive/v2.2.1.tar.gz"], + strip_prefix = "gflags-2.2.1", +) + +http_archive( + name = "com_google_protobuf", + urls = ["https://github.com/google/protobuf/archive/v3.4.1.tar.gz"], + strip_prefix = "protobuf-3.4.1", +) + +new_http_archive( + name = "com_google_googletest", + urls = ["https://github.com/google/googletest/archive/release-1.8.0.tar.gz"], + strip_prefix = "googletest-release-1.8.0", + build_file = "third_party/gtest/gtest.BUILD", +) diff --git a/heron/api/tests/cpp/BUILD b/heron/api/tests/cpp/BUILD index 7974b728f54..d1a94e0f7e6 100644 --- a/heron/api/tests/cpp/BUILD +++ b/heron/api/tests/cpp/BUILD @@ -8,7 +8,7 @@ cc_test( deps = [ "//heron/api/src/cpp:cxx-api", "//heron/common/src/cpp/basics:basics-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron/api/src/cpp", diff --git a/heron/common/src/cpp/basics/BUILD b/heron/common/src/cpp/basics/BUILD index d25e589bf5b..0c3c68244be 100644 --- a/heron/common/src/cpp/basics/BUILD +++ b/heron/common/src/cpp/basics/BUILD @@ -47,9 +47,10 @@ cc_library( deps = [ "//config:config-cxx", "//third_party/glog:glog-cxx", + "@com_github_gflags_gflags//:gflags", "//third_party/gperftools:tcmalloc-cxx", "//third_party/kashmir:kashmir-cxx", - "//third_party/protobuf:protobuf-cxx", + "@com_google_protobuf//:protobuf", ] + select({ "//tools/platform:darwin": [], "//conditions:default": ["//third_party/libunwind:libunwind-cxx"], diff --git a/heron/common/src/cpp/metrics/BUILD b/heron/common/src/cpp/metrics/BUILD index f3eefebfe19..e7663a14604 100644 --- a/heron/common/src/cpp/metrics/BUILD +++ b/heron/common/src/cpp/metrics/BUILD @@ -39,7 +39,7 @@ cc_library( "//heron/common/src/cpp/network:network-cxx", "//heron/common/src/cpp/config:config-cxx", "//third_party/glog:glog-cxx", - "//third_party/protobuf:protobuf-cxx", + "@com_google_protobuf//:protobuf", ], linkstatic = 1, ) diff --git a/heron/common/tests/cpp/basics/BUILD b/heron/common/tests/cpp/basics/BUILD index e4f897a3e63..ec5ce92a710 100644 --- a/heron/common/tests/cpp/basics/BUILD +++ b/heron/common/tests/cpp/basics/BUILD @@ -5,7 +5,7 @@ cc_test( srcs = ["fileutils_unittest.cpp"], deps = [ "//heron/common/src/cpp/basics:basics-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-I.", @@ -20,7 +20,7 @@ cc_test( srcs = ["rid_unittest.cpp"], deps = [ "//heron/common/src/cpp/basics:basics-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-I.", @@ -35,7 +35,7 @@ cc_test( srcs = ["strutils_unittest.cpp"], deps = [ "//heron/common/src/cpp/basics:basics-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-I.", @@ -50,7 +50,7 @@ cc_test( srcs = ["utils_unittest.cpp"], deps = [ "//heron/common/src/cpp/basics:basics-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-I.", diff --git a/heron/common/tests/cpp/errors/BUILD b/heron/common/tests/cpp/errors/BUILD index 40611ac7e43..39fa327473d 100644 --- a/heron/common/tests/cpp/errors/BUILD +++ b/heron/common/tests/cpp/errors/BUILD @@ -39,7 +39,7 @@ cc_test( ], deps = [ "//heron/common/src/cpp/errors:errors-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-I.", @@ -61,7 +61,7 @@ cc_test( ], deps = [ "//heron/common/src/cpp/errors:errors-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-I.", @@ -83,7 +83,7 @@ cc_test( ], deps = [ "//heron/common/src/cpp/errors:errors-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-I.", diff --git a/heron/common/tests/cpp/metrics/BUILD b/heron/common/tests/cpp/metrics/BUILD index 12ba596c3c4..41dc251a697 100644 --- a/heron/common/tests/cpp/metrics/BUILD +++ b/heron/common/tests/cpp/metrics/BUILD @@ -7,7 +7,7 @@ cc_test( ], deps = [ "//heron/common/src/cpp/metrics:metrics-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -26,7 +26,7 @@ cc_test( ], deps = [ "//heron/common/src/cpp/metrics:metrics-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -45,7 +45,7 @@ cc_test( ], deps = [ "//heron/common/src/cpp/metrics:metrics-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -64,7 +64,7 @@ cc_test( ], deps = [ "//heron/common/src/cpp/metrics:metrics-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -83,7 +83,7 @@ cc_test( ], deps = [ "//heron/common/src/cpp/metrics:metrics-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", diff --git a/heron/common/tests/cpp/network/BUILD b/heron/common/tests/cpp/network/BUILD index ddaf4fc8e57..44826dad60d 100644 --- a/heron/common/tests/cpp/network/BUILD +++ b/heron/common/tests/cpp/network/BUILD @@ -21,7 +21,7 @@ cc_test( ], deps = [ "//heron/common/src/cpp/network:network-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron/common/src/cpp", @@ -47,7 +47,7 @@ cc_test( deps = [ ":proto_unittests_cc", "//heron/common/src/cpp/network:network-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron/common/src/cpp", @@ -67,7 +67,7 @@ cc_test( deps = [ ":proto_unittests_cc", "//heron/common/src/cpp/network:network-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron/common/src/cpp", @@ -92,7 +92,7 @@ cc_test( deps = [ ":proto_unittests_cc", "//heron/common/src/cpp/network:network-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron/common/src/cpp", @@ -111,7 +111,7 @@ cc_test( ], deps = [ "//heron/common/src/cpp/network:network-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron/common/src/cpp", diff --git a/heron/common/tests/cpp/threads/BUILD b/heron/common/tests/cpp/threads/BUILD index c169c7c5770..b5c4da51106 100644 --- a/heron/common/tests/cpp/threads/BUILD +++ b/heron/common/tests/cpp/threads/BUILD @@ -5,7 +5,7 @@ cc_test( srcs = ["spcountdownlatch_unittest.cpp"], deps = [ "//heron/common/src/cpp/threads:threads-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron/common/src/cpp", diff --git a/heron/proto/BUILD b/heron/proto/BUILD index b4ce271dd36..67deeff22dd 100644 --- a/heron/proto/BUILD +++ b/heron/proto/BUILD @@ -232,7 +232,7 @@ cc_library( ":proto_topology_cc", ":proto_stats_cc", ":proto_common_cc", - "//third_party/protobuf:protobuf-cxx", + "@com_google_protobuf//:protobuf", ], linkstatic = 1, ) diff --git a/heron/statemgrs/tests/cpp/BUILD b/heron/statemgrs/tests/cpp/BUILD index b853a88b931..54d35159d49 100644 --- a/heron/statemgrs/tests/cpp/BUILD +++ b/heron/statemgrs/tests/cpp/BUILD @@ -7,8 +7,7 @@ cc_test( ], deps = [ "//heron/statemgrs/src/cpp:statemgrs-cxx", - "//third_party/gtest:gmock-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", diff --git a/heron/stmgr/tests/cpp/grouping/BUILD b/heron/stmgr/tests/cpp/grouping/BUILD index e41eead0992..79c03b3497d 100644 --- a/heron/stmgr/tests/cpp/grouping/BUILD +++ b/heron/stmgr/tests/cpp/grouping/BUILD @@ -7,7 +7,7 @@ cc_test( ], deps = [ "//heron/stmgr/src/cpp:grouping-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -27,7 +27,7 @@ cc_test( ], deps = [ "//heron/stmgr/src/cpp:grouping-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -47,7 +47,7 @@ cc_test( ], deps = [ "//heron/stmgr/src/cpp:grouping-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -67,7 +67,7 @@ cc_test( ], deps = [ "//heron/stmgr/src/cpp:grouping-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -87,7 +87,7 @@ cc_test( ], deps = [ "//heron/stmgr/src/cpp:grouping-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", diff --git a/heron/stmgr/tests/cpp/server/BUILD b/heron/stmgr/tests/cpp/server/BUILD index 1b0fe7a0677..b26d5d1203f 100644 --- a/heron/stmgr/tests/cpp/server/BUILD +++ b/heron/stmgr/tests/cpp/server/BUILD @@ -19,7 +19,7 @@ cc_test( "//heron/stmgr/src/cpp:util-cxx", # TODO: Stmgr unit tests should not depend on tmaster "//heron/tmaster/src/cpp:tmaster-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], data = [ "//heron/config/src/yaml:test-config-internals-yaml", @@ -48,7 +48,7 @@ cc_test( "//heron/stmgr/src/cpp:manager-cxx", "//heron/stmgr/src/cpp:grouping-cxx", "//heron/stmgr/src/cpp:util-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -78,7 +78,7 @@ cc_test( "//heron/stmgr/src/cpp:manager-cxx", "//heron/stmgr/src/cpp:grouping-cxx", "//heron/stmgr/src/cpp:util-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], data = ["//heron/config/src/yaml:test-config-internals-yaml"], copts = [ diff --git a/heron/stmgr/tests/cpp/util/BUILD b/heron/stmgr/tests/cpp/util/BUILD index 2719c33aad1..96c269acbfb 100644 --- a/heron/stmgr/tests/cpp/util/BUILD +++ b/heron/stmgr/tests/cpp/util/BUILD @@ -7,7 +7,7 @@ cc_test( ], deps = [ "//heron/stmgr/src/cpp:util-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -28,7 +28,7 @@ cc_test( ], deps = [ "//heron/stmgr/src/cpp:util-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], data = ["//heron/config/src/yaml:test-config-internals-yaml"], copts = [ @@ -50,7 +50,7 @@ cc_test( ], deps = [ "//heron/stmgr/src/cpp:util-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], data = ["//heron/config/src/yaml:test-config-internals-yaml"], copts = [ @@ -73,7 +73,7 @@ cc_test( "//heron/stmgr/src/cpp:manager-cxx", "//heron/stmgr/src/cpp:grouping-cxx", "//heron/stmgr/src/cpp:util-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", diff --git a/heron/tmaster/tests/cpp/server/BUILD b/heron/tmaster/tests/cpp/server/BUILD index e0d37d2c6f1..da046de8c11 100644 --- a/heron/tmaster/tests/cpp/server/BUILD +++ b/heron/tmaster/tests/cpp/server/BUILD @@ -11,7 +11,7 @@ cc_test( deps = [ "//heron/stmgr/src/cpp:manager-cxx", "//heron/tmaster/src/cpp:tmaster-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], data = [ "//heron/config/src/yaml:test-config-internals-yaml", @@ -39,7 +39,7 @@ cc_test( deps = [ "//heron/stmgr/src/cpp:manager-cxx", "//heron/tmaster/src/cpp:tmaster-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -67,7 +67,7 @@ cc_test( ], deps = [ "//heron/tmaster/src/cpp:tmaster-cxx", - "//third_party/gtest:gtest-cxx", + "@com_google_googletest//:gtest", ], copts = [ "-Iheron", @@ -81,4 +81,4 @@ cc_test( size = "small", flaky = 1, linkstatic = 1, -) \ No newline at end of file +) diff --git a/third_party/gflags/BUILD b/third_party/gflags/BUILD deleted file mode 100644 index 094cef136ac..00000000000 --- a/third_party/gflags/BUILD +++ /dev/null @@ -1,65 +0,0 @@ -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -pkg_name = "gflags" -pkg_version = "2.2.1" - -package_file = pkg_name + "-" + pkg_version + ".tar.gz" -package_dir = pkg_name + "-" + pkg_version - -include_files = [ - "include/gflags/gflags.h", - "include/gflags/gflags_completions.h", - "include/gflags/gflags_declare.h", - "include/gflags/gflags_gflags.h", -] - -lib_files = [ - "lib/libgflags.a", - "lib/libgflags_nothreads.a", -] - -genrule( - name = "gflags-srcs", - srcs = [package_file], - outs = include_files + lib_files, - cmd = "\n".join([ - 'export INSTALL_DIR=$$(pwd)/$(@D)', - 'export TMP_DIR=$$(mktemp -d -t gflags.XXXXX)', - 'mkdir -p $$TMP_DIR', - 'cp -R $(SRCS) $$TMP_DIR', - 'cd $$TMP_DIR', - 'tar xfz ' + package_file, - 'cd ' + package_dir, - 'cmake -DCMAKE_INSTALL_PREFIX:PATH=$$INSTALL_DIR .', - 'make install', - 'rm -rf $$TMP_DIR', - ]), -) - - -cc_library( - name = "gflags-cxx", - srcs = [ - "empty.cc", - "lib/libgflags.a", - ], - hdrs = include_files, - includes = [ - "include", - ], - linkstatic = 1, -) - -filegroup( - name = "gflags", - srcs = [ - ":gflags-cxx", - ] -) - -filegroup( - name = "gflags-files", - srcs = include_files + lib_files, -) diff --git a/third_party/gflags/empty.cc b/third_party/gflags/empty.cc deleted file mode 100644 index b890e734986..00000000000 --- a/third_party/gflags/empty.cc +++ /dev/null @@ -1,2 +0,0 @@ -void _empty_gflags_xyz() { -} diff --git a/third_party/gflags/gflags-2.2.1.tar.gz b/third_party/gflags/gflags-2.2.1.tar.gz deleted file mode 100644 index 9c5a6b9277d..00000000000 Binary files a/third_party/gflags/gflags-2.2.1.tar.gz and /dev/null differ diff --git a/third_party/glog/BUILD b/third_party/glog/BUILD index f2d681c2466..870a4cfd66a 100644 --- a/third_party/glog/BUILD +++ b/third_party/glog/BUILD @@ -65,9 +65,6 @@ genrule( cc_library( name = "glog-cxx", srcs = ["empty.cc"] + lib_files, - deps = [ - "//third_party/gflags:gflags-cxx", - ], hdrs = include_files, includes = [ "include", diff --git a/third_party/gtest/BUILD b/third_party/gtest/BUILD deleted file mode 100644 index baca57d6b57..00000000000 --- a/third_party/gtest/BUILD +++ /dev/null @@ -1,177 +0,0 @@ -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -pkg_name = "googletest-release" -pkg_version = "1.8.0" - -package_file = pkg_name + "-" + pkg_version + ".zip" -package_dir = pkg_name + "-" + pkg_version - -gtest_include_files = [ - "include/gtest/gtest-death-test.h", - "include/gtest/gtest-param-test.h.pump", - "include/gtest/gtest-test-part.h", - "include/gtest/gtest_pred_impl.h", - "include/gtest/gtest-message.h", - "include/gtest/gtest-printers.h", - "include/gtest/gtest-typed-test.h", - "include/gtest/gtest_prod.h", - "include/gtest/gtest-param-test.h", - "include/gtest/gtest-spi.h", - "include/gtest/gtest.h", - - "include/gtest/internal/custom/gtest-port.h", - "include/gtest/internal/custom/gtest-printers.h", - "include/gtest/internal/custom/gtest.h", - - "include/gtest/internal/gtest-death-test-internal.h", - "include/gtest/internal/gtest-param-util-generated.h.pump", - "include/gtest/internal/gtest-tuple.h.pump", - "include/gtest/internal/gtest-filepath.h", - "include/gtest/internal/gtest-param-util.h", - "include/gtest/internal/gtest-type-util.h", - "include/gtest/internal/gtest-internal.h", - "include/gtest/internal/gtest-port.h", - "include/gtest/internal/gtest-port-arch.h", - "include/gtest/internal/gtest-type-util.h.pump", - "include/gtest/internal/gtest-linked_ptr.h", - "include/gtest/internal/gtest-string.h", - "include/gtest/internal/gtest-param-util-generated.h", - "include/gtest/internal/gtest-tuple.h", -] - -gtest_lib_files = [ - "lib/libgtest.a", - "lib/libgtest_main.a", -] - -gmock_include_files = [ - "include/gmock/gmock-actions.h", - "include/gmock/gmock-generated-function-mockers.h.pump", - "include/gmock/gmock-matchers.h", - "include/gmock/gmock-cardinalities.h", - "include/gmock/gmock-generated-matchers.h", - "include/gmock/gmock-more-actions.h", - "include/gmock/gmock-generated-actions.h", - "include/gmock/gmock-generated-matchers.h.pump", - "include/gmock/gmock-more-matchers.h", - "include/gmock/gmock-generated-actions.h.pump", - "include/gmock/gmock-generated-nice-strict.h", - "include/gmock/gmock-spec-builders.h", - "include/gmock/gmock-generated-function-mockers.h", - "include/gmock/gmock-generated-nice-strict.h.pump", - "include/gmock/gmock.h", - - "include/gmock/internal/custom/gmock-generated-actions.h", - "include/gmock/internal/custom/gmock-generated-actions.h.pump", - "include/gmock/internal/custom/gmock-matchers.h", - "include/gmock/internal/custom/gmock-port.h", - - "include/gmock/internal/gmock-generated-internal-utils.h", - "include/gmock/internal/gmock-internal-utils.h", - "include/gmock/internal/gmock-generated-internal-utils.h.pump", - "include/gmock/internal/gmock-port.h", -] - -gmock_lib_files = [ - "lib/libgmock.a", - "lib/libgmock_main.a", -] - -include_files = gtest_include_files + gmock_include_files -lib_files = gtest_lib_files + gmock_lib_files - -genrule( - name = "gtest-srcs", - srcs = [ - package_file, - ], - outs = include_files + lib_files, - cmd = "\n".join([ - 'export TMP_DIR=$$(mktemp -d -t gtest.XXXXX)', - 'export INSTALL_DIR=$$(pwd)/$(@D)', - 'mkdir -p $$TMP_DIR', - 'cp -R $(SRCS) $$TMP_DIR', - 'cd $$TMP_DIR', - 'unzip -q -o ' + package_file, - 'cd ' + package_dir, - 'cmake -DCMAKE_INSTALL_PREFIX:PATH=$$INSTALL_DIR .', - 'make install', - 'rm -rf $$TMP_DIR', - ]), -) - -cc_library( - name = "gtest-cxx", - srcs = [ - "empty.cc", - "lib/libgtest.a", - ], - hdrs = gtest_include_files, - includes = [ - "include", - ], - linkstatic = 1, -) - -cc_library( - name = "gtest_main-cxx", - srcs = [ - "empty.cc", - "lib/libgtest_main.a", - ], - deps = [ - ":gtest-cxx", - ], - linkstatic = 1, - alwayslink = 1, -) - -filegroup( - name = "gtest", - srcs = [ - ":gtest-cxx", - ":gtest_main-cxx", - ] -) - -filegroup( - name = "gtest-files", - srcs = gtest_include_files + gtest_lib_files, -) - -cc_library( - name = "gmock-cxx", - srcs = [ - "empty.cc", - "lib/libgmock.a", - ], - hdrs = gmock_include_files, - includes = [ - "include", - ], - linkstatic = 1, -) - -cc_library( - name = "gmock_main-cxx", - srcs = [ - "empty.cc", - "lib/libgmock_main.a", - ], - linkstatic = 1, -) - -filegroup( - name = "gmock", - srcs = [ - ":gmock-cxx", - ":gmock_main-cxx", - ] -) - -filegroup( - name = "gmock-files", - srcs = gmock_include_files + gmock_lib_files, -) diff --git a/third_party/gtest/empty.cc b/third_party/gtest/empty.cc deleted file mode 100644 index 186c3422b72..00000000000 --- a/third_party/gtest/empty.cc +++ /dev/null @@ -1,2 +0,0 @@ -void _empty_gtest_xyz() { -} diff --git a/third_party/gtest/googletest-release-1.8.0.zip b/third_party/gtest/googletest-release-1.8.0.zip deleted file mode 100644 index ee1136a8022..00000000000 Binary files a/third_party/gtest/googletest-release-1.8.0.zip and /dev/null differ diff --git a/third_party/gtest/gtest.BUILD b/third_party/gtest/gtest.BUILD new file mode 100644 index 00000000000..81ac25482f5 --- /dev/null +++ b/third_party/gtest/gtest.BUILD @@ -0,0 +1,130 @@ +# Copyright 2017 Google Inc. +# 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 Inc. 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 THE COPYRIGHT +# OWNER OR CONTRIBUTORS 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. +# +# Author: misterg@google.com (Gennadiy Civil) +# +# Bazel Build for Google C++ Testing Framework(Google Test) + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +# Google Test including Google Mock +cc_library( + name = "gtest", + srcs = glob( + include = [ + "googletest/src/*.cc", + "googletest/src/*.h", + "googletest/include/gtest/**/*.h", + "googlemock/src/*.cc", + "googlemock/include/gmock/**/*.h", + ], + exclude = [ + "googletest/src/gtest-all.cc", + "googletest/src/gtest_main.cc", + "googlemock/src/gmock-all.cc", + "googlemock/src/gmock_main.cc", + ], + ), + hdrs =glob([ + "googletest/include/gtest/*.h", + "googlemock/include/gmock/*.h", + ]), + includes = [ + "googlemock", + "googlemock/include", + "googletest", + "googletest/include", + ], +) + +cc_library( + name = "gtest_main", + srcs = [ + "googlemock/src/gmock_main.cc", + ], + deps = ["//:gtest"], +) + +# The following rules build samples of how to use gTest. +cc_library( + name = "gtest_sample_lib", + srcs = [ + "googletest/samples/sample1.cc", + "googletest/samples/sample2.cc", + "googletest/samples/sample4.cc", + ], + hdrs = [ + "googletest/samples/prime_tables.h", + "googletest/samples/sample1.h", + "googletest/samples/sample2.h", + "googletest/samples/sample3-inl.h", + "googletest/samples/sample4.h", + ], +) + +cc_test( + name = "gtest_samples", + size = "small", + #All Samples except: + #sample9 ( main ) + #sample10 (main and takes a command line option and needs to be separate) + srcs = [ + "googletest/samples/sample1_unittest.cc", + "googletest/samples/sample2_unittest.cc", + "googletest/samples/sample3_unittest.cc", + "googletest/samples/sample4_unittest.cc", + "googletest/samples/sample5_unittest.cc", + "googletest/samples/sample6_unittest.cc", + "googletest/samples/sample7_unittest.cc", + "googletest/samples/sample8_unittest.cc", + ], + deps = [ + "gtest_sample_lib", + ":gtest_main", + ], +) + +cc_test( + name = "sample9_unittest", + size = "small", + srcs = ["googletest/samples/sample9_unittest.cc"], + deps = [":gtest"], +) + +cc_test( + name = "sample10_unittest", + size = "small", + srcs = ["googletest/samples/sample10_unittest.cc"], + deps = [ + ":gtest", + ], +) diff --git a/third_party/protobuf/BUILD b/third_party/protobuf/BUILD deleted file mode 100644 index 2903a0f48ca..00000000000 --- a/third_party/protobuf/BUILD +++ /dev/null @@ -1,210 +0,0 @@ -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -pkg_name = "protobuf" -pkg_version = "3.4.0" - -pkg_file = pkg_name + "-" + pkg_version + ".tar.gz" -pkg_dir = pkg_name + "-" + pkg_version -pkg_patch = pkg_name + "-" + pkg_version + ".patch" - -gmock_name = "gmock" -gmock_version = "1.7.0" -gmock_file = gmock_name + "-" + gmock_version + ".zip" -gmock_dir = gmock_name + "-" + gmock_version - -genrule( - name = "protobuf-srcs", - srcs = [pkg_file, pkg_patch, gmock_file], - outs = [ - "bin/protoc", - - "include/google/protobuf/arena.h", - "include/google/protobuf/arenastring.h", - "include/google/protobuf/arena_impl.h", - "include/google/protobuf/has_bits.h", - "include/google/protobuf/stubs/atomic_sequence_num.h", - "include/google/protobuf/stubs/fastmem.h", - "include/google/protobuf/stubs/port.h", - "include/google/protobuf/stubs/macros.h", - "include/google/protobuf/stubs/logging.h", - "include/google/protobuf/stubs/scoped_ptr.h", - "include/google/protobuf/stubs/mutex.h", - "include/google/protobuf/stubs/callback.h", - "include/google/protobuf/stubs/shared_ptr.h", - "include/google/protobuf/stubs/hash.h", - "include/google/protobuf/stubs/casts.h", - - "include/google/protobuf/extension_set.h", - "include/google/protobuf/map.h", - "include/google/protobuf/map_type_handler.h", - "include/google/protobuf/map_entry_lite.h", - "include/google/protobuf/metadata_lite.h", - "include/google/protobuf/message_lite.h", - "include/google/protobuf/unknown_field_set.h", - "include/google/protobuf/descriptor.h", - "include/google/protobuf/generated_enum_reflection.h", - "include/google/protobuf/reflection_ops.h", - "include/google/protobuf/wire_format.h", - "include/google/protobuf/descriptor.pb.h", - "include/google/protobuf/generated_message_reflection.h", - "include/google/protobuf/repeated_field.h", - "include/google/protobuf/wire_format_lite.h", - "include/google/protobuf/descriptor.proto", - "include/google/protobuf/generated_message_util.h", - "include/google/protobuf/generated_enum_util.h", - "include/google/protobuf/service.h", - "include/google/protobuf/wire_format_lite_inl.h", - "include/google/protobuf/descriptor_database.h", - "include/google/protobuf/dynamic_message.h", - "include/google/protobuf/message.h", - "include/google/protobuf/text_format.h", - "include/google/protobuf/metadata.h", - "include/google/protobuf/generated_message_table_driven.h", - - "include/google/protobuf/compiler/code_generator.h", - "include/google/protobuf/compiler/command_line_interface.h", - "include/google/protobuf/compiler/importer.h", - "include/google/protobuf/compiler/parser.h", - "include/google/protobuf/compiler/plugin.h", - "include/google/protobuf/compiler/plugin.pb.h", - "include/google/protobuf/compiler/plugin.proto", - - "include/google/protobuf/compiler/cpp/cpp_generator.h", - "include/google/protobuf/compiler/java/java_generator.h", - "include/google/protobuf/compiler/python/python_generator.h", - - "include/google/protobuf/io/coded_stream.h", - "include/google/protobuf/io/gzip_stream.h", - "include/google/protobuf/io/printer.h", - "include/google/protobuf/io/tokenizer.h", - "include/google/protobuf/io/zero_copy_stream.h", - "include/google/protobuf/io/zero_copy_stream_impl.h", - "include/google/protobuf/io/zero_copy_stream_impl_lite.h", - - "include/google/protobuf/stubs/atomicops.h", - "include/google/protobuf/stubs/atomicops_internals_mips_gcc.h", - "include/google/protobuf/stubs/once.h", - "include/google/protobuf/stubs/atomicops_internals_arm_gcc.h", - "include/google/protobuf/stubs/platform_macros.h", - "include/google/protobuf/stubs/atomicops_internals_arm_qnx.h", - "include/google/protobuf/stubs/atomicops_internals_x86_gcc.h", - "include/google/protobuf/stubs/template_util.h", - "include/google/protobuf/stubs/atomicops_internals_atomicword_compat.h", - "include/google/protobuf/stubs/atomicops_internals_x86_msvc.h", - "include/google/protobuf/stubs/type_traits.h", - "include/google/protobuf/stubs/common.h", - - "lib/libprotobuf-lite.a", - "lib/libprotobuf.a", - "lib/libprotoc.a", - ], - cmd = "\n".join([ - "export INSTALL_DIR=$$(pwd)/$(@D)", - "export TMP_DIR=$$(mktemp -d -t protobuf.XXXXX)", - "mkdir -p $$TMP_DIR", - "cp -R $(SRCS) $$TMP_DIR", - "cd $$TMP_DIR", - "tar xfz " + pkg_file, - "patch -d " + pkg_dir + " -p1 < " + pkg_patch, - "cd " + pkg_dir, - "unzip -q -o " + "../" + gmock_file, - "mv " + gmock_dir + " gmock", - "./autogen.sh", - "./configure --prefix=$$INSTALL_DIR --enable-shared=no", - "make install", - "rm -rf $$TMP_DIR", - ]), -) - -cc_library( - name = "protobuf-cxx-lite", - srcs = [ - "empty.cc", - "lib/libprotobuf-lite.a", - ], - hdrs = [ - "include/google/protobuf/message_lite.h", - ], - includes = ["include"], - linkstatic = 1, -) - -cc_library( - name = "protobuf-cxx", - srcs = [ - "include/google/protobuf/descriptor.pb.h", - "include/google/protobuf/generated_enum_reflection.h", - - "include/google/protobuf/stubs/atomicops.h", - "include/google/protobuf/stubs/atomicops_internals_x86_gcc.h", - "include/google/protobuf/stubs/atomicops_internals_atomicword_compat.h", - "include/google/protobuf/stubs/platform_macros.h", - "include/google/protobuf/stubs/type_traits.h", - "include/google/protobuf/stubs/template_util.h", - - "empty.cc", - "lib/libprotobuf.a", - ], - hdrs = [ - "include/google/protobuf/arena.h", - "include/google/protobuf/arenastring.h", - "include/google/protobuf/arena_impl.h", - "include/google/protobuf/has_bits.h", - "include/google/protobuf/stubs/atomic_sequence_num.h", - "include/google/protobuf/stubs/common.h", - "include/google/protobuf/stubs/fastmem.h", - "include/google/protobuf/stubs/hash.h", - "include/google/protobuf/stubs/once.h", - "include/google/protobuf/stubs/port.h", - "include/google/protobuf/stubs/macros.h", - "include/google/protobuf/stubs/logging.h", - "include/google/protobuf/stubs/scoped_ptr.h", - "include/google/protobuf/stubs/mutex.h", - "include/google/protobuf/stubs/callback.h", - "include/google/protobuf/stubs/shared_ptr.h", - "include/google/protobuf/stubs/casts.h", - - "include/google/protobuf/descriptor.h", - "include/google/protobuf/extension_set.h", - "include/google/protobuf/generated_enum_util.h", - "include/google/protobuf/generated_message_util.h", - "include/google/protobuf/generated_message_reflection.h", - "include/google/protobuf/generated_message_table_driven.h", - "include/google/protobuf/map.h", - "include/google/protobuf/map_entry_lite.h", - "include/google/protobuf/map_type_handler.h", - "include/google/protobuf/message.h", - "include/google/protobuf/message_lite.h", - "include/google/protobuf/metadata.h", - "include/google/protobuf/metadata_lite.h", - "include/google/protobuf/reflection_ops.h", - "include/google/protobuf/repeated_field.h", - "include/google/protobuf/unknown_field_set.h", - "include/google/protobuf/wire_format.h", - "include/google/protobuf/wire_format_lite.h", - "include/google/protobuf/wire_format_lite_inl.h", - - "include/google/protobuf/io/coded_stream.h", - ], - includes = [ - "include", - ], - linkstatic = 1, -) - -cc_library( - name = "protoc-cxx", - srcs = [ - "empty.cc", - "lib/libprotoc.a", - ], - deps = [":protobuf-cxx", ":gtest-cxx"], - linkstatic = 1, -) - -filegroup( - name = "protoc", - srcs = ["bin/protoc"] -) diff --git a/third_party/protobuf/empty.cc b/third_party/protobuf/empty.cc deleted file mode 100644 index e2b1d4059ca..00000000000 --- a/third_party/protobuf/empty.cc +++ /dev/null @@ -1,2 +0,0 @@ -void _empty_protobuf_xyz() { -} diff --git a/third_party/protobuf/gmock-1.7.0.zip b/third_party/protobuf/gmock-1.7.0.zip deleted file mode 100644 index 2f0edb9b7ae..00000000000 Binary files a/third_party/protobuf/gmock-1.7.0.zip and /dev/null differ diff --git a/third_party/protobuf/protobuf-3.4.0.patch b/third_party/protobuf/protobuf-3.4.0.patch deleted file mode 100644 index 6be277d0c1c..00000000000 --- a/third_party/protobuf/protobuf-3.4.0.patch +++ /dev/null @@ -1,295 +0,0 @@ -diff -rup protobuf-3.4.0.orig/configure.ac protobuf-3.4.0/configure.ac ---- protobuf-3.4.0.orig/configure.ac 2017-09-17 16:34:26.000000000 -0700 -+++ protobuf-3.4.0/configure.ac 2017-09-17 16:46:57.000000000 -0700 -@@ -65,7 +65,6 @@ AC_LANG([C++]) - ACX_USE_SYSTEM_EXTENSIONS - m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) - AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc --AC_PROG_OBJC - - # test_util.cc takes forever to compile with GCC and optimization turned on. - AC_MSG_CHECKING([C++ compiler flags...]) -@@ -189,15 +188,6 @@ case "$target_os" in - ;; - esac - --# Enable ObjC support for conformance directory on OS X. --OBJC_CONFORMANCE_TEST=0 --case "$target_os" in -- darwin*) -- OBJC_CONFORMANCE_TEST=1 -- ;; --esac --AM_CONDITIONAL([OBJC_CONFORMANCE_TEST], [test $OBJC_CONFORMANCE_TEST = 1]) -- - AX_CXX_COMPILE_STDCXX([11], [noext], [optional]) - - # HACK: Make gmock's configure script pick up our copy of CFLAGS and CXXFLAGS, -diff -rup protobuf-3.4.0.orig/conformance/Makefile.am protobuf-3.4.0/conformance/Makefile.am ---- protobuf-3.4.0.orig/conformance/Makefile.am 2017-09-17 16:34:26.000000000 -0700 -+++ protobuf-3.4.0/conformance/Makefile.am 2017-09-17 16:48:31.000000000 -0700 -@@ -24,8 +24,6 @@ protoc_outputs = - - other_language_protoc_outputs = \ - conformance_pb2.py \ -- Conformance.pbobjc.h \ -- Conformance.pbobjc.m \ - conformance_pb.js \ - conformance_pb.rb \ - com/google/protobuf/Any.java \ -@@ -225,24 +223,6 @@ conformance_cpp_CPPFLAGS = -I$(top_srcdi - # so a direct "make test_cpp" could fail if parallel enough. - conformance_cpp-conformance_cpp.$(OBJEXT): conformance.pb.h - --if OBJC_CONFORMANCE_TEST -- --bin_PROGRAMS += conformance-objc -- --conformance_objc_SOURCES = conformance_objc.m ../objectivec/GPBProtocolBuffers.m --nodist_conformance_objc_SOURCES = Conformance.pbobjc.m google/protobuf/TestMessagesProto2.pbobjc.m google/protobuf/TestMessagesProto3.pbobjc.m --# On travis, the build fails without the isysroot because whatever system --# headers are being found don't include generics support for --# NSArray/NSDictionary, the only guess is their image at one time had an odd --# setup for Xcode and old frameworks are being found. --conformance_objc_CPPFLAGS = -I$(top_srcdir)/objectivec -isysroot `xcrun --sdk macosx --show-sdk-path` --conformance_objc_LDFLAGS = -framework Foundation --# Explicit dep beacuse BUILT_SOURCES are only done before a "make all/check" --# so a direct "make test_objc" could fail if parallel enough. --conformance_objc-conformance_objc.$(OBJEXT): Conformance.pbobjc.h google/protobuf/TestMessagesProto2.pbobjc.h google/protobuf/TestMessagesProto3.pbobjc.h -- --endif -- - # JavaScript well-known types are expected to be in a directory called - # google-protobuf, because they are usually in the google-protobuf npm - # package. But we want to use the sources from our tree, so we recreate -@@ -363,9 +343,3 @@ test_python_cpp: protoc_middleman confor - test_nodejs: protoc_middleman conformance-test-runner $(other_language_protoc_outputs) - NODE_PATH=../js:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_js.txt ./conformance_nodejs.js - --if OBJC_CONFORMANCE_TEST -- --test_objc: protoc_middleman conformance-test-runner conformance-objc -- ./conformance-test-runner --enforce_recommended --failure_list failure_list_objc.txt ./conformance-objc -- --endif -diff -rup protobuf-3.4.0.orig/conformance/conformance_objc.m protobuf-3.4.0/conformance/conformance_objc.m ---- protobuf-3.4.0.orig/conformance/conformance_objc.m 2017-09-17 16:34:26.000000000 -0700 -+++ protobuf-3.4.0/conformance/conformance_objc.m 2017-09-17 16:49:29.000000000 -0700 -@@ -1,188 +0,0 @@ --// Protocol Buffers - Google's data interchange format --// Copyright 2015 Google Inc. All rights reserved. --// https://developers.google.com/protocol-buffers/ --// --// 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 Inc. 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 THE COPYRIGHT --// OWNER OR CONTRIBUTORS 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. -- --#import -- --#import "Conformance.pbobjc.h" --#import "google/protobuf/TestMessagesProto2.pbobjc.h" --#import "google/protobuf/TestMessagesProto3.pbobjc.h" -- --static void Die(NSString *format, ...) __dead2; -- --static BOOL verbose = NO; --static int32_t testCount = 0; -- --static void Die(NSString *format, ...) { -- va_list args; -- va_start(args, format); -- NSString *msg = [[NSString alloc] initWithFormat:format arguments:args]; -- NSLog(@"%@", msg); -- va_end(args); -- [msg release]; -- exit(66); --} -- --static NSData *CheckedReadDataOfLength(NSFileHandle *handle, NSUInteger numBytes) { -- NSData *data = [handle readDataOfLength:numBytes]; -- NSUInteger dataLen = data.length; -- if (dataLen == 0) { -- return nil; // EOF. -- } -- if (dataLen != numBytes) { -- Die(@"Failed to read the request length (%d), only got: %@", -- numBytes, data); -- } -- return data; --} -- --static ConformanceResponse *DoTest(ConformanceRequest *request) { -- ConformanceResponse *response = [ConformanceResponse message]; -- GPBMessage *testMessage = nil; -- -- switch (request.payloadOneOfCase) { -- case ConformanceRequest_Payload_OneOfCase_GPBUnsetOneOfCase: -- Die(@"Request didn't have a payload: %@", request); -- break; -- -- case ConformanceRequest_Payload_OneOfCase_ProtobufPayload: { -- Class msgClass = nil; -- if ([request.messageType isEqual:@"protobuf_test_messages.proto3.TestAllTypesProto3"]) { -- msgClass = [Proto3TestAllTypesProto3 class]; -- } else if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) { -- msgClass = [TestAllTypesProto2 class]; -- } else { -- Die(@"Protobuf request had an unknown message_type: %@", request.messageType); -- } -- NSError *error = nil; -- testMessage = [msgClass parseFromData:request.protobufPayload error:&error]; -- if (!testMessage) { -- response.parseError = -- [NSString stringWithFormat:@"Parse error: %@", error]; -- } -- break; -- } -- -- case ConformanceRequest_Payload_OneOfCase_JsonPayload: -- response.skipped = @"ObjC doesn't support parsing JSON"; -- break; -- } -- -- if (testMessage) { -- switch (request.requestedOutputFormat) { -- case WireFormat_GPBUnrecognizedEnumeratorValue: -- case WireFormat_Unspecified: -- Die(@"Unrecognized/unspecified output format: %@", request); -- break; -- -- case WireFormat_Protobuf: -- response.protobufPayload = testMessage.data; -- if (!response.protobufPayload) { -- response.serializeError = -- [NSString stringWithFormat:@"Failed to make data from: %@", testMessage]; -- } -- break; -- -- case WireFormat_Json: -- response.skipped = @"ObjC doesn't support generating JSON"; -- break; -- } -- } -- -- return response; --} -- --static uint32_t UInt32FromLittleEndianData(NSData *data) { -- if (data.length != sizeof(uint32_t)) { -- Die(@"Data not the right size for uint32_t: %@", data); -- } -- uint32_t value; -- memcpy(&value, data.bytes, sizeof(uint32_t)); -- return CFSwapInt32LittleToHost(value); --} -- --static NSData *UInt32ToLittleEndianData(uint32_t num) { -- uint32_t value = CFSwapInt32HostToLittle(num); -- return [NSData dataWithBytes:&value length:sizeof(uint32_t)]; --} -- --static BOOL DoTestIo(NSFileHandle *input, NSFileHandle *output) { -- // See conformance_test_runner.cc for the wire format. -- NSData *data = CheckedReadDataOfLength(input, sizeof(uint32_t)); -- if (!data) { -- // EOF. -- return NO; -- } -- uint32_t numBytes = UInt32FromLittleEndianData(data); -- data = CheckedReadDataOfLength(input, numBytes); -- if (!data) { -- Die(@"Failed to read request"); -- } -- -- NSError *error = nil; -- ConformanceRequest *request = [ConformanceRequest parseFromData:data -- error:&error]; -- if (!request) { -- Die(@"Failed to parse the message data: %@", error); -- } -- -- ConformanceResponse *response = DoTest(request); -- if (!response) { -- Die(@"Failed to make a reply from %@", request); -- } -- -- data = response.data; -- [output writeData:UInt32ToLittleEndianData((int32_t)data.length)]; -- [output writeData:data]; -- -- if (verbose) { -- NSLog(@"Request: %@", request); -- NSLog(@"Response: %@", response); -- } -- -- ++testCount; -- return YES; --} -- --int main(int argc, const char *argv[]) { -- @autoreleasepool { -- NSFileHandle *input = [[NSFileHandle fileHandleWithStandardInput] retain]; -- NSFileHandle *output = [[NSFileHandle fileHandleWithStandardOutput] retain]; -- -- BOOL notDone = YES; -- while (notDone) { -- @autoreleasepool { -- notDone = DoTestIo(input, output); -- } -- } -- -- NSLog(@"Received EOF from test runner after %d tests, exiting.", testCount); -- } -- return 0; --} -diff -rup protobuf-3.4.0.orig/src/google/protobuf/io/zero_copy_stream_impl_lite.h protobuf-3.4.0/src/google/protobuf/io/zero_copy_stream_impl_lite.h ---- protobuf-3.4.0.orig/src/google/protobuf/io/zero_copy_stream_impl_lite.h 2017-09-17 16:34:27.000000000 -0700 -+++ protobuf-3.4.0/src/google/protobuf/io/zero_copy_stream_impl_lite.h 2017-09-17 16:45:58.000000000 -0700 -@@ -377,13 +377,9 @@ class LIBPROTOBUF_EXPORT CopyingOutputSt - // return value is valid until the next time the string is resized. We - // trust the caller to treat the return value as an array of length s->size(). - inline char* mutable_string_data(string* s) { --#ifdef LANG_CXX11 - // This should be simpler & faster than string_as_array() because the latter - // is guaranteed to return NULL when *s is empty, so it has to check for that. - return &(*s)[0]; --#else -- return string_as_array(s); --#endif - } - - // as_string_data(s) is equivalent to -@@ -392,11 +388,7 @@ inline char* mutable_string_data(string* - // code can avoid that check. - inline std::pair as_string_data(string* s) { - char *p = mutable_string_data(s); --#ifdef LANG_CXX11 - return std::make_pair(p, true); --#else -- return std::make_pair(p, p != NULL); --#endif - } - - } // namespace io diff --git a/third_party/protobuf/protobuf-3.4.0.tar.gz b/third_party/protobuf/protobuf-3.4.0.tar.gz deleted file mode 100644 index 5431b5be516..00000000000 Binary files a/third_party/protobuf/protobuf-3.4.0.tar.gz and /dev/null differ diff --git a/tools/java/src/com/twitter/bazel/checkstyle/CppCheckstyle.java b/tools/java/src/com/twitter/bazel/checkstyle/CppCheckstyle.java index d1b6f87b04d..32c6c75b22f 100644 --- a/tools/java/src/com/twitter/bazel/checkstyle/CppCheckstyle.java +++ b/tools/java/src/com/twitter/bazel/checkstyle/CppCheckstyle.java @@ -131,6 +131,7 @@ private static Collection getSourceFiles(String extraActionFile) { return Collections2.filter( cppInfo.getSourcesAndHeadersList(), Predicates.and( + Predicates.not(Predicates.containsPattern("external/")), Predicates.not(Predicates.containsPattern("third_party/")), Predicates.not(Predicates.containsPattern("config/heron-config.h")), Predicates.not(Predicates.containsPattern(".*pb.h$")), diff --git a/tools/rules/genproto.bzl b/tools/rules/genproto.bzl index 3b9a9cf71ef..32438f3052d 100644 --- a/tools/rules/genproto.bzl +++ b/tools/rules/genproto.bzl @@ -48,7 +48,7 @@ genproto_java = rule( genproto_java_impl, attrs = genproto_base_attrs + { "_protoc": attr.label( - default = Label("//third_party/protobuf:protoc"), + default = Label("@com_google_protobuf//:protoc"), allow_files = True, single_file = True, ), @@ -97,13 +97,13 @@ def proto_library(name, src=None, includes=[], deps=[], visibility=None, proto_src = src[:-6] + ".pb.cc" proto_srcgen_rule = name + "_cc_src" proto_lib = name + "_cc" - protoc = "//third_party/protobuf:protoc" + protoc = "@com_google_protobuf//:protoc" if not includes: proto_cmd = "$(location %s) --cpp_out=$(@D) %s" % (protoc, proto_path) else: proto_cmd = "$(location %s) %s --cpp_out=$(@D) %s" % (protoc, proto_include_paths, proto_path) - cc_deps = ["//third_party/protobuf:protobuf-cxx"] + cc_deps = ["@com_google_protobuf//:protobuf"] proto_deps = [src, protoc] for dep in deps: cc_deps += [dep + "_cc"] @@ -133,7 +133,7 @@ def proto_library(name, src=None, includes=[], deps=[], visibility=None, proto_src = src[:-6] + "_pb2.py" proto_srcgen_rule = name + "_py_src" proto_lib = name + "_py" - protoc = "//third_party/protobuf:protoc" + protoc = "@com_google_protobuf//:protoc" if not includes: proto_cmd = "$(location %s) --python_out=$(@D) %s" % (protoc, proto_path) else: diff --git a/tools/rules/newgenproto.bzl b/tools/rules/newgenproto.bzl deleted file mode 100644 index c26bd4df0a1..00000000000 --- a/tools/rules/newgenproto.bzl +++ /dev/null @@ -1,149 +0,0 @@ -load("pex_rules", "pex_library") - -standard_proto_path = "heron/proto" - -def _genproto_impl(ctx): - proto_src_deps = [src.proto_src for src in ctx.attr.deps] - inputs, outputs, arguments = [ctx.file.src] + proto_src_deps, [], ["--proto_path=."] - for src in proto_src_deps: - if src.path.startswith(standard_proto_path): - arguments += ["--proto_path=" + standard_proto_path] - break - - if ctx.attr.gen_cc: - outputs += [ctx.outputs.cc_hdr, ctx.outputs.cc_src] - arguments += ["--cpp_out=" + ctx.configuration.genfiles_dir.path] - - if ctx.attr.gen_java: - if ctx.outputs.java_src.path.endswith(".srcjar"): - srcjar = ctx.new_file(ctx.outputs.java_src.basename[:-6] + "jar") - else: - srcjar = ctx.outputs.java_src - outputs += [srcjar] - arguments += ["--java_out=" + srcjar.path] - - if ctx.attr.gen_py: - outputs += [ctx.outputs.py_src] - arguments += ["--python_out=" + ctx.configuration.genfiles_dir.path] - - ctx.action( - mnemonic = "GenProto", - inputs = inputs, - outputs = outputs, - arguments = arguments + [ctx.file.src.path], - executable = ctx.executable._protoc) - - # This is required because protoc only understands .jar extensions, but Bazel - # requires source JAR files end in .srcjar. - if ctx.attr.gen_java and srcjar != ctx.outputs.java_src: - ctx.action( - mnemonic = "FixProtoSrcJar", - inputs = [srcjar], - outputs = [ctx.outputs.java_src], - arguments = [srcjar.path, ctx.outputs.java_src.path], - command = "cp $1 $2") - - # Fixup the resulting outputs to keep the source-only .jar out of the result. - outputs += [ctx.outputs.java_src] - outputs = [e for e in outputs if e != srcjar] - - return struct(files=set(outputs), - proto_src=ctx.file.src) - -_genproto_attrs = { - "src": attr.label( - allow_files = FileType([".proto"]), - single_file = True, - ), - "deps": attr.label_list( - allow_files = False, - providers = ["proto_src"], - ), - "_protoc": attr.label( - default = Label("//third_party/protobuf:protoc"), - executable = True, - ), - "gen_cc": attr.bool(), - "gen_java": attr.bool(), - "gen_py": attr.bool(), -} - -def _genproto_outputs(attrs): - outputs = {} - if attrs.gen_cc: - outputs += { - "cc_hdr": "%{src}.pb.h", - "cc_src": "%{src}.pb.cc" - } - if attrs.gen_java: - outputs += { - "java_src": "%{src}.srcjar", - } - if attrs.gen_py: - outputs += { - "py_src": "%{src}_pb2.py" - } - return outputs - -genproto = rule( - _genproto_impl, - attrs = _genproto_attrs, - output_to_genfiles = True, - outputs = _genproto_outputs, -) - -def proto_library(name, src=None, deps=[], visibility=None, - gen_java=False, gen_cc=False, gen_py=False): - if not src: - if name.endswith("_proto"): - src = name[:-6] + ".proto" - else: - src = name + ".proto" - - proto_pkg = genproto(name=name, - src=src, - deps=deps, - gen_java=gen_java, - gen_cc=gen_cc, - gen_py=gen_py) - - # TODO(shahms): These should probably not be separate libraries, but - # allowing upstream *_library and *_binary targets to depend on the - # proto_library() directly is a challenge. We'd also need a different - # workaround for the non-generated any.pb.{h,cc} from the upstream protocol - # buffer library. - if gen_java: - java_deps = ["@com_google_protobuf_protobuf_java//jar"] - for dep in deps: - java_deps += [dep + "_java"] - native.java_library( - name = name + "_java", - srcs = [proto_pkg.label()], - deps = java_deps, - visibility = visibility, - ) - - if gen_cc: - cc_deps = ["//third_party/protobuf:protobuf-cxx"] - for dep in deps: - cc_deps += [dep + "_cc"] - native.cc_library( - name = name + "_cc", - visibility = visibility, - hdrs = [proto_pkg.label()], - srcs = [proto_pkg.label()], - defines = ["GOOGLE_PROTOBUF_NO_RTTI"], - deps = cc_deps, - ) - - if gen_py: - py_deps = [] - for dep in deps: - py_deps += [dep + "_py"] - pex_library( - name = name + "_py", - visibility = visibility, - srcs = [proto_pkg.label()], - deps = py_deps, - ) - diff --git a/tools/rules/proto.bzl b/tools/rules/proto.bzl index a409293576a..6c82a7e5fde 100644 --- a/tools/rules/proto.bzl +++ b/tools/rules/proto.bzl @@ -48,7 +48,7 @@ genproto_java = rule( genproto_java_impl, attrs = genproto_base_attrs + { "_protoc": attr.label( - default = Label("//third_party/protobuf:protoc"), + default = Label("@com_google_protobuf//:protoc"), allow_files = True, single_file = True, ),