aboutsummaryrefslogtreecommitdiffhomepage
path: root/BUILD
diff options
context:
space:
mode:
Diffstat (limited to 'BUILD')
-rw-r--r--BUILD255
1 files changed, 189 insertions, 66 deletions
diff --git a/BUILD b/BUILD
index d63c6d4f..547181e8 100644
--- a/BUILD
+++ b/BUILD
@@ -8,15 +8,37 @@ exports_files(["LICENSE"])
# Protobuf Runtime Library
################################################################################
-COPTS = [
- "-DHAVE_PTHREAD",
- "-Wall",
- "-Wwrite-strings",
- "-Woverloaded-virtual",
- "-Wno-sign-compare",
- "-Wno-unused-function",
+WIN_COPTS = [
+ "/DHAVE_PTHREAD",
+ "/wd4018", # -Wno-sign-compare
+ "/wd4514", # -Wno-unused-function
]
+COPTS = select({
+ ":windows" : WIN_COPTS,
+ ":windows_msvc" : WIN_COPTS,
+ "//conditions:default": [
+ "-DHAVE_PTHREAD",
+ "-Wall",
+ "-Wwrite-strings",
+ "-Woverloaded-virtual",
+ "-Wno-sign-compare",
+ "-Wno-unused-function",
+ # Prevents ISO C++ const string assignment warnings for pyext sources.
+ "-Wno-writable-strings",
+ ],
+})
+
+config_setting(
+ name = "windows",
+ values = { "cpu": "x64_windows" },
+)
+
+config_setting(
+ name = "windows_msvc",
+ values = { "cpu": "x64_windows_msvc" },
+)
+
config_setting(
name = "android",
values = {
@@ -24,9 +46,11 @@ config_setting(
},
)
-# Android builds do not need to link in a separate pthread library.
+# Android and Windows builds do not need to link in a separate pthread library.
LINK_OPTS = select({
":android": [],
+ ":windows": [],
+ ":windows_msvc": [],
"//conditions:default": ["-lpthread", "-lm"],
})
@@ -39,37 +63,6 @@ load(
"internal_protobuf_py_tests",
)
-config_setting(
- name = "ios_armv7",
- values = {
- "ios_cpu": "armv7",
- },
-)
-
-config_setting(
- name = "ios_armv7s",
- values = {
- "ios_cpu": "armv7s",
- },
-)
-
-config_setting(
- name = "ios_arm64",
- values = {
- "ios_cpu": "arm64",
- },
-)
-
-IOS_ARM_COPTS = COPTS + [
- "-DOS_IOS",
- "-miphoneos-version-min=7.0",
- "-arch armv7",
- "-arch armv7s",
- "-arch arm64",
- "-D__thread=",
- "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/",
-]
-
cc_library(
name = "protobuf_lite",
srcs = [
@@ -77,7 +70,9 @@ cc_library(
"src/google/protobuf/arena.cc",
"src/google/protobuf/arenastring.cc",
"src/google/protobuf/extension_set.cc",
+ "src/google/protobuf/generated_message_table_driven_lite.cc",
"src/google/protobuf/generated_message_util.cc",
+ "src/google/protobuf/implicit_weak_message.cc",
"src/google/protobuf/io/coded_stream.cc",
"src/google/protobuf/io/zero_copy_stream.cc",
"src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
@@ -88,6 +83,7 @@ cc_library(
"src/google/protobuf/stubs/bytestream.cc",
"src/google/protobuf/stubs/common.cc",
"src/google/protobuf/stubs/int128.cc",
+ "src/google/protobuf/stubs/io_win32.cc",
"src/google/protobuf/stubs/once.cc",
"src/google/protobuf/stubs/status.cc",
"src/google/protobuf/stubs/statusor.cc",
@@ -99,12 +95,7 @@ cc_library(
"src/google/protobuf/wire_format_lite.cc",
],
hdrs = glob(["src/google/protobuf/**/*.h"]),
- copts = select({
- ":ios_armv7": IOS_ARM_COPTS,
- ":ios_armv7s": IOS_ARM_COPTS,
- ":ios_arm64": IOS_ARM_COPTS,
- "//conditions:default": COPTS,
- }),
+ copts = COPTS,
includes = ["src/"],
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],
@@ -128,6 +119,7 @@ cc_library(
"src/google/protobuf/extension_set_heavy.cc",
"src/google/protobuf/field_mask.pb.cc",
"src/google/protobuf/generated_message_reflection.cc",
+ "src/google/protobuf/generated_message_table_driven.cc",
"src/google/protobuf/io/gzip_stream.cc",
"src/google/protobuf/io/printer.cc",
"src/google/protobuf/io/strtod.cc",
@@ -145,6 +137,7 @@ cc_library(
"src/google/protobuf/timestamp.pb.cc",
"src/google/protobuf/type.pb.cc",
"src/google/protobuf/unknown_field_set.cc",
+ "src/google/protobuf/util/delimited_message_util.cc",
"src/google/protobuf/util/field_comparator.cc",
"src/google/protobuf/util/field_mask_util.cc",
"src/google/protobuf/util/internal/datapiece.cc",
@@ -169,12 +162,7 @@ cc_library(
"src/google/protobuf/wrappers.pb.cc",
],
hdrs = glob(["src/**/*.h"]),
- copts = select({
- ":ios_armv7": IOS_ARM_COPTS,
- ":ios_armv7s": IOS_ARM_COPTS,
- ":ios_arm64": IOS_ARM_COPTS,
- "//conditions:default": COPTS,
- }),
+ copts = COPTS,
includes = ["src/"],
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],
@@ -200,21 +188,24 @@ objc_library(
visibility = ["//visibility:public"],
)
-RELATIVE_WELL_KNOWN_PROTOS = [
- # AUTOGEN(well_known_protos)
- "google/protobuf/any.proto",
- "google/protobuf/api.proto",
- "google/protobuf/compiler/plugin.proto",
- "google/protobuf/descriptor.proto",
- "google/protobuf/duration.proto",
- "google/protobuf/empty.proto",
- "google/protobuf/field_mask.proto",
- "google/protobuf/source_context.proto",
- "google/protobuf/struct.proto",
- "google/protobuf/timestamp.proto",
- "google/protobuf/type.proto",
- "google/protobuf/wrappers.proto",
-]
+# Map of all well known protos.
+# name => (include path, imports)
+WELL_KNOWN_PROTO_MAP = {
+ "any" : ("google/protobuf/any.proto", []),
+ "api" : ("google/protobuf/api.proto", ["source_context", "type"]),
+ "compiler_plugin" : ("google/protobuf/compiler/plugin.proto", ["descriptor"]),
+ "descriptor" : ("google/protobuf/descriptor.proto", []),
+ "duration" : ("google/protobuf/duration.proto", []),
+ "empty" : ("google/protobuf/empty.proto", []),
+ "field_mask" : ("google/protobuf/field_mask.proto", []),
+ "source_context" : ("google/protobuf/source_context.proto", []),
+ "struct" : ("google/protobuf/struct.proto", []),
+ "timestamp" : ("google/protobuf/timestamp.proto", []),
+ "type" : ("google/protobuf/type.proto", ["any", "source_context"]),
+ "wrappers" : ("google/protobuf/wrappers.proto", []),
+}
+
+RELATIVE_WELL_KNOWN_PROTOS = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()]
WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS]
@@ -235,6 +226,33 @@ cc_proto_library(
)
################################################################################
+# Well Known Types Proto Library Rules
+#
+# These proto_library rules can be used with one of the language specific proto
+# library rules i.e. java_proto_library:
+#
+# java_proto_library(
+# name = "any_java_proto",
+# deps = ["@com_google_protobuf//:any_proto],
+# )
+################################################################################
+
+internal_copied_filegroup(
+ name = "_internal_wkt_protos",
+ srcs = WELL_KNOWN_PROTOS,
+ dest = "",
+ strip_prefix = "src",
+ visibility = ["//visibility:hidden"],
+)
+
+[proto_library(
+ name = proto[0] + "_proto",
+ srcs = [proto[1][0]],
+ deps = [dep + "_proto" for dep in proto[1][1]],
+ visibility = ["//visibility:public"],
+ ) for proto in WELL_KNOWN_PROTO_MAP.items()]
+
+################################################################################
# Protocol Buffers Compiler
################################################################################
@@ -272,6 +290,7 @@ cc_library(
"src/google/protobuf/compiler/cpp/cpp_map_field.cc",
"src/google/protobuf/compiler/cpp/cpp_message.cc",
"src/google/protobuf/compiler/cpp/cpp_message_field.cc",
+ "src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc",
"src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
"src/google/protobuf/compiler/cpp/cpp_service.cc",
"src/google/protobuf/compiler/cpp/cpp_string_field.cc",
@@ -400,6 +419,9 @@ RELATIVE_TEST_PROTOS = [
"google/protobuf/unittest_enormous_descriptor.proto",
"google/protobuf/unittest_import.proto",
"google/protobuf/unittest_import_public.proto",
+ "google/protobuf/unittest_lazy_dependencies.proto",
+ "google/protobuf/unittest_lazy_dependencies_custom_option.proto",
+ "google/protobuf/unittest_lazy_dependencies_enum.proto",
"google/protobuf/unittest_lite_imports_nonlite.proto",
"google/protobuf/unittest_mset.proto",
"google/protobuf/unittest_mset_wire_format.proto",
@@ -465,17 +487,30 @@ cc_binary(
)
cc_test(
+ name = "win32_test",
+ srcs = ["src/google/protobuf/stubs/io_win32_unittest.cc"],
+ deps = [
+ ":protobuf_lite",
+ "//external:gtest_main",
+ ],
+ tags = ["manual", "windows"],
+)
+
+cc_test(
name = "protobuf_test",
srcs = COMMON_TEST_SRCS + [
# AUTOGEN(test_srcs)
"src/google/protobuf/any_test.cc",
"src/google/protobuf/arena_unittest.cc",
"src/google/protobuf/arenastring_unittest.cc",
+ "src/google/protobuf/compiler/annotation_test_util.cc",
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
+ "src/google/protobuf/compiler/cpp/cpp_move_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_unittest.cc",
"src/google/protobuf/compiler/cpp/metadata_test.cc",
+ "src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc",
"src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc",
"src/google/protobuf/compiler/importer_unittest.cc",
"src/google/protobuf/compiler/java/java_doc_comment_unittest.cc",
@@ -509,6 +544,7 @@ cc_test(
"src/google/protobuf/stubs/bytestream_unittest.cc",
"src/google/protobuf/stubs/common_unittest.cc",
"src/google/protobuf/stubs/int128_unittest.cc",
+ "src/google/protobuf/stubs/io_win32_unittest.cc",
"src/google/protobuf/stubs/once_unittest.cc",
"src/google/protobuf/stubs/status_test.cc",
"src/google/protobuf/stubs/statusor_test.cc",
@@ -521,6 +557,7 @@ cc_test(
"src/google/protobuf/stubs/type_traits_unittest.cc",
"src/google/protobuf/text_format_unittest.cc",
"src/google/protobuf/unknown_field_set_unittest.cc",
+ "src/google/protobuf/util/delimited_message_util_test.cc",
"src/google/protobuf/util/field_comparator_test.cc",
"src/google/protobuf/util/field_mask_util_test.cc",
"src/google/protobuf/util/internal/default_value_objectwriter_test.cc",
@@ -541,6 +578,9 @@ cc_test(
":test_plugin",
] + glob([
"src/google/protobuf/**/*",
+ # Files for csharp_bootstrap_unittest.cc.
+ "conformance/**/*",
+ "csharp/src/**/*",
]),
includes = [
"src/",
@@ -568,6 +608,7 @@ java_library(
]) + [
":gen_well_known_protos_java",
],
+ javacopts = ["-source 6", "-target 6"],
visibility = ["//visibility:public"],
)
@@ -576,6 +617,7 @@ java_library(
srcs = glob([
"java/util/src/main/java/com/google/protobuf/util/*.java",
]),
+ javacopts = ["-source 6", "-target 6"],
visibility = ["//visibility:public"],
deps = [
"protobuf_java",
@@ -795,3 +837,84 @@ proto_lang_toolchain(
runtime = ":protobuf_java",
visibility = ["//visibility:public"],
)
+
+OBJC_HDRS = [
+ "objectivec/GPBArray.h",
+ "objectivec/GPBBootstrap.h",
+ "objectivec/GPBCodedInputStream.h",
+ "objectivec/GPBCodedOutputStream.h",
+ "objectivec/GPBDescriptor.h",
+ "objectivec/GPBDictionary.h",
+ "objectivec/GPBExtensionInternals.h",
+ "objectivec/GPBExtensionRegistry.h",
+ "objectivec/GPBMessage.h",
+ "objectivec/GPBProtocolBuffers.h",
+ "objectivec/GPBProtocolBuffers_RuntimeSupport.h",
+ "objectivec/GPBRootObject.h",
+ "objectivec/GPBRuntimeTypes.h",
+ "objectivec/GPBUnknownField.h",
+ "objectivec/GPBUnknownFieldSet.h",
+ "objectivec/GPBUtilities.h",
+ "objectivec/GPBWellKnownTypes.h",
+ "objectivec/GPBWireFormat.h",
+ "objectivec/google/protobuf/Any.pbobjc.h",
+ "objectivec/google/protobuf/Api.pbobjc.h",
+ "objectivec/google/protobuf/Duration.pbobjc.h",
+ "objectivec/google/protobuf/Empty.pbobjc.h",
+ "objectivec/google/protobuf/FieldMask.pbobjc.h",
+ "objectivec/google/protobuf/SourceContext.pbobjc.h",
+ "objectivec/google/protobuf/Struct.pbobjc.h",
+ "objectivec/google/protobuf/Timestamp.pbobjc.h",
+ "objectivec/google/protobuf/Type.pbobjc.h",
+ "objectivec/google/protobuf/Wrappers.pbobjc.h",
+]
+
+OBJC_PRIVATE_HDRS = [
+ "objectivec/GPBArray_PackagePrivate.h",
+ "objectivec/GPBCodedInputStream_PackagePrivate.h",
+ "objectivec/GPBCodedOutputStream_PackagePrivate.h",
+ "objectivec/GPBDescriptor_PackagePrivate.h",
+ "objectivec/GPBDictionary_PackagePrivate.h",
+ "objectivec/GPBMessage_PackagePrivate.h",
+ "objectivec/GPBRootObject_PackagePrivate.h",
+ "objectivec/GPBUnknownFieldSet_PackagePrivate.h",
+ "objectivec/GPBUnknownField_PackagePrivate.h",
+ "objectivec/GPBUtilities_PackagePrivate.h",
+]
+
+OBJC_SRCS = [
+ "objectivec/GPBArray.m",
+ "objectivec/GPBCodedInputStream.m",
+ "objectivec/GPBCodedOutputStream.m",
+ "objectivec/GPBDescriptor.m",
+ "objectivec/GPBDictionary.m",
+ "objectivec/GPBExtensionInternals.m",
+ "objectivec/GPBExtensionRegistry.m",
+ "objectivec/GPBMessage.m",
+ "objectivec/GPBRootObject.m",
+ "objectivec/GPBUnknownField.m",
+ "objectivec/GPBUnknownFieldSet.m",
+ "objectivec/GPBUtilities.m",
+ "objectivec/GPBWellKnownTypes.m",
+ "objectivec/GPBWireFormat.m",
+ "objectivec/google/protobuf/Any.pbobjc.m",
+ "objectivec/google/protobuf/Api.pbobjc.m",
+ "objectivec/google/protobuf/Duration.pbobjc.m",
+ "objectivec/google/protobuf/Empty.pbobjc.m",
+ "objectivec/google/protobuf/FieldMask.pbobjc.m",
+ "objectivec/google/protobuf/SourceContext.pbobjc.m",
+ "objectivec/google/protobuf/Struct.pbobjc.m",
+ "objectivec/google/protobuf/Timestamp.pbobjc.m",
+ "objectivec/google/protobuf/Type.pbobjc.m",
+ "objectivec/google/protobuf/Wrappers.pbobjc.m",
+]
+
+objc_library(
+ name = "objectivec",
+ hdrs = OBJC_HDRS + OBJC_PRIVATE_HDRS,
+ includes = [
+ "objectivec",
+ ],
+ non_arc_srcs = OBJC_SRCS,
+ visibility = ["//visibility:public"],
+)