diff --git a/BUILD b/BUILD index 441f28b3e1..f9261ab347 100644 --- a/BUILD +++ b/BUILD @@ -4,7 +4,7 @@ load("@bazel_skylib//rules:common_settings.bzl", "string_flag") load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library", native_cc_proto_library = "cc_proto_library") load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library") load("@rules_python//python:defs.bzl", "py_library") -load("@rules_java//java:defs.bzl", "java_binary", "java_proto_library", "java_lite_proto_library") +load("@rules_java//java:defs.bzl", "java_binary", "java_lite_proto_library", "java_proto_library") load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test") licenses(["notice"]) @@ -39,7 +39,6 @@ MSVC_COPTS = [ "/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) "/wd4355", # 'this' : used in base member initializer list "/wd4506", # no definition for inline function 'function' - "/wd4514", # -Wno-unused-function "/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning) "/wd4996", # The compiler encountered a deprecated declaration. ] @@ -51,10 +50,6 @@ COPTS = select({ "-DHAVE_ZLIB", "-Woverloaded-virtual", "-Wno-sign-compare", - "-Wno-unused-function", - # Prevents ISO C++ const string assignment warnings for pyext sources. - "-Wno-write-strings", - "-Wno-deprecated-declarations", ], }) @@ -334,8 +329,8 @@ filegroup( adapt_proto_library( name = "cc_wkt_protos_genproto", - deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()], visibility = ["//visibility:public"], + deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()], ) cc_library( @@ -366,13 +361,12 @@ cc_library( [native_cc_proto_library( name = proto + "_cc_proto", - deps = [proto + "_proto"], visibility = ["//visibility:private"], + deps = [proto + "_proto"], ) for proto in WELL_KNOWN_PROTO_MAP.keys()] cc_proto_blacklist_test( name = "cc_proto_blacklist_test", - deps = [proto + "_cc_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()], tags = [ # Exclude this target from wildcard expansion (//...). Due to # https://github.com/bazelbuild/bazel/issues/10590, this test has to @@ -381,6 +375,7 @@ cc_proto_blacklist_test( # See also https://github.com/protocolbuffers/protobuf/pull/7096. "manual", ], + deps = [proto + "_cc_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()], ) ################################################################################ @@ -496,8 +491,8 @@ cc_binary( filegroup( name = "testdata", - visibility = ["//:__subpackages__"], srcs = glob(["src/google/protobuf/testdata/**/*"]), + visibility = ["//:__subpackages__"], ) RELATIVE_LITE_TEST_PROTOS = [ @@ -594,9 +589,9 @@ GENERIC_TEST_PROTOS = ["src/" + s for s in GENERIC_RELATIVE_TEST_PROTOS] proto_library( name = "generic_test_protos", - visibility = ["//:__subpackages__"], - strip_import_prefix = "src", srcs = LITE_TEST_PROTOS + GENERIC_TEST_PROTOS, + strip_import_prefix = "src", + visibility = ["//:__subpackages__"], deps = [ "//:any_proto", "//:api_proto", @@ -744,7 +739,12 @@ cc_test( ], ":msvc": [], }), - copts = COPTS, + copts = COPTS + select({ + ":msvc": [], + "//conditions:default": [ + "-Wno-deprecated-declarations", + ], + }), data = [ ":test_plugin", ] + glob([ @@ -772,19 +772,19 @@ cc_test( internal_gen_well_known_protos_java( name = "gen_well_known_protos_java", - deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()], visibility = [ "//java:__subpackages__", ], + deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()], ) internal_gen_well_known_protos_java( name = "gen_well_known_protos_javalite", - deps = [proto + "_proto" for proto in LITE_WELL_KNOWN_PROTO_MAP.keys()], javalite = True, visibility = [ "//java:__subpackages__", ], + deps = [proto + "_proto" for proto in LITE_WELL_KNOWN_PROTO_MAP.keys()], ) alias( @@ -842,6 +842,8 @@ cc_binary( copts = COPTS + [ "-DPYTHON_PROTO2_CPP_IMPL_V2", ], + linkshared = 1, + linkstatic = 1, tags = [ # Exclude this target from wildcard expansion (//...) because it may # not even be buildable. It will be built if it is needed according @@ -849,8 +851,6 @@ cc_binary( # https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes "manual", ], - linkshared = 1, - linkstatic = 1, deps = select({ "//conditions:default": [], ":use_fast_cpp_protos": ["//external:python_headers"], @@ -873,6 +873,8 @@ cc_binary( "python/", "src/", ], + linkshared = 1, + linkstatic = 1, tags = [ # Exclude this target from wildcard expansion (//...) because it may # not even be buildable. It will be built if it is needed according @@ -880,8 +882,6 @@ cc_binary( # https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes "manual", ], - linkshared = 1, - linkstatic = 1, deps = [ ":protobuf", ":proto_api", @@ -1226,7 +1226,7 @@ java_proto_library( name = "test_messages_proto3_java_proto", visibility = [ "//java:__subpackages__", - ], + ], deps = [":test_messages_proto3_proto"], ) @@ -1247,11 +1247,11 @@ java_lite_proto_library( ) java_lite_proto_library( - name = "conformance_java_proto_lite", - visibility = [ + name = "conformance_java_proto_lite", + visibility = [ "//java:__subpackages__", - ], - deps = [":conformance_proto"], + ], + deps = [":conformance_proto"], ) java_lite_proto_library( @@ -1265,10 +1265,10 @@ java_lite_proto_library( java_binary( name = "conformance_java", srcs = ["conformance/ConformanceJava.java"], + main_class = "ConformanceJava", visibility = [ "//java:__subpackages__", ], - main_class = "ConformanceJava", deps = [ ":conformance_java_proto", ":test_messages_proto2_java_proto", @@ -1281,16 +1281,16 @@ java_binary( java_binary( name = "conformance_java_lite", srcs = ["conformance/ConformanceJavaLite.java"], + main_class = "ConformanceJavaLite", visibility = [ "//java:__subpackages__", ], - main_class = "ConformanceJavaLite", deps = [ ":conformance_java_proto_lite", ":test_messages_proto2_java_proto_lite", ":test_messages_proto3_java_proto_lite", - "//:protobuf_javalite", "//:protobuf_java_util", + "//:protobuf_javalite", ], )