aboutsummaryrefslogtreecommitdiff
path: root/third_party/com_google_protobuf_fixes.diff
blob: b9bc17ea9e6d531c142fcb41ce5da4a5cca5fa69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
diff --git a/BUILD b/BUILD
index 79871d621..51b3a063f 100644
--- a/BUILD
+++ b/BUILD
@@ -26,7 +26,7 @@ config_setting(
 # ZLIB configuration
 ################################################################################

-ZLIB_DEPS = ["@zlib//:zlib"]
+ZLIB_DEPS = ["@zlib"]

 ################################################################################
 # Protobuf Runtime Library
@@ -157,6 +157,7 @@ cc_library(
     includes = ["src/"],
     linkopts = LINK_OPTS,
     visibility = ["//visibility:public"],
+    alwayslink = 1,
 )

 PROTOBUF_DEPS = select({
@@ -230,6 +231,7 @@ cc_library(
     linkopts = LINK_OPTS,
     visibility = ["//visibility:public"],
     deps = [":protobuf_lite"] + PROTOBUF_DEPS,
+    alwayslink = 1,
 )

 # This provides just the header files for use in projects that need to build
@@ -318,13 +320,13 @@ cc_proto_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()]
+    deps = [proto + "_cc_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
 )

 ################################################################################
@@ -900,7 +902,6 @@ py_proto_library(
     py_extra_srcs = glob(["python/**/__init__.py"]),
     py_libs = [
         ":python_srcs",
-        "@six//:six",
     ],
     srcs_version = "PY2AND3",
     visibility = ["//visibility:public"],
@@ -1002,7 +1003,9 @@ cc_library(
 # Note: We use `native_proto_common` here because we depend on an implementation-detail of
 # `proto_lang_toolchain`, which may not be available on `proto_common`.
 reject_blacklisted_files = hasattr(native_proto_common, "proto_lang_toolchain_rejects_files_do_not_use_or_we_will_break_you_without_mercy")
+
 cc_toolchain_blacklisted_protos = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()] if reject_blacklisted_files else [":well_known_protos"]
+
 proto_lang_toolchain(
     name = "cc_toolchain",
     blacklisted_protos = cc_toolchain_blacklisted_protos,
diff --git a/protobuf.bzl b/protobuf.bzl
index 829464d44..4ac23594b 100644
--- a/protobuf.bzl
+++ b/protobuf.bzl
@@ -87,6 +87,8 @@ def _proto_gen_impl(ctx):
     for dep in ctx.attr.deps:
         import_flags += dep.proto.import_flags
         deps += dep.proto.deps
+    import_flags = depset(import_flags).to_list()
+    deps = depset(deps).to_list()

     if not ctx.attr.gen_cc and not ctx.attr.gen_py and not ctx.executable.plugin:
         return struct(
diff --git a/src/google/protobuf/io/gzip_stream.h b/src/google/protobuf/io/gzip_stream.h
index b1ce1d36c..d5d560ea7 100644
--- a/src/google/protobuf/io/gzip_stream.h
+++ b/src/google/protobuf/io/gzip_stream.h
@@ -47,10 +47,12 @@
 #include <google/protobuf/stubs/common.h>
 #include <google/protobuf/io/zero_copy_stream.h>
 #include <google/protobuf/port.h>
-#include <zlib.h>
-
 #include <google/protobuf/port_def.inc>

+#if HAVE_ZLIB
+#include <zlib.h>
+#endif  // HAVE_ZLIB
+
 namespace google {
 namespace protobuf {
 namespace io {
@@ -76,8 +78,10 @@ class PROTOBUF_EXPORT GzipInputStream : public ZeroCopyInputStream {
   virtual ~GzipInputStream();

   // Return last error message or NULL if no error.
+#if HAVE_ZLIB
   inline const char* ZlibErrorMessage() const { return zcontext_.msg; }
   inline int ZlibErrorCode() const { return zerror_; }
+#endif  // HAVE_ZLIB

   // implements ZeroCopyInputStream ----------------------------------
   bool Next(const void** data, int* size);
@@ -90,8 +94,10 @@ class PROTOBUF_EXPORT GzipInputStream : public ZeroCopyInputStream {

   ZeroCopyInputStream* sub_stream_;

+ #if HAVE_ZLIB
   z_stream zcontext_;
   int zerror_;
+ #endif // HAVE_ZLIB

   void* output_buffer_;
   void* output_position_;
@@ -142,9 +148,11 @@ class PROTOBUF_EXPORT GzipOutputStream : public ZeroCopyOutputStream {

   virtual ~GzipOutputStream();

+#if HAVE_ZLIB
   // Return last error message or NULL if no error.
   inline const char* ZlibErrorMessage() const { return zcontext_.msg; }
   inline int ZlibErrorCode() const { return zerror_; }
+#endif  // HAVE_ZLIB

   // Flushes data written so far to zipped data in the underlying stream.
   // It is the caller's responsibility to flush the underlying stream if
@@ -177,8 +185,10 @@ class PROTOBUF_EXPORT GzipOutputStream : public ZeroCopyOutputStream {
   void* sub_data_;
   int sub_data_size_;

+#if HAVE_ZLIB
   z_stream zcontext_;
   int zerror_;
+#endif  //HAVE_ZLIB
   void* input_buffer_;
   size_t input_buffer_length_;