Commit Graph

188 Commits

Author SHA1 Message Date
Yilun Chong
a2a0afb546
Down-integrate internal changes to github. (#5575)
* Down-integrate internal changes to github.

* Fix BUILD file and regenerate csharp descritpor
2019-01-13 17:40:58 -08:00
Keith Moyer
595cb359c0 Rely on no-writable-strings synonym
The -Wno-writable-strings warning flag is Clang-specific. GCC's
equivalent is -Wno-write-strings, which Clang also supports as a
synonym. So, -Wno-write strings is more compatible and there is no need
to specify both.

https://clang.llvm.org/docs/DiagnosticsReference.html#wwrite-strings
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
2018-12-27 13:52:23 -08:00
Yun Peng
073487b302 Exclude command_line_interface_unittest.cc in MSVC build 2018-12-14 12:53:36 +01:00
Cody Schroeder
802d543173 Add Bazel config for zlib support (#5389)
* Add Bazel config for optional zlib support

* Add hard dependency on zlib

* Remove unused config_setting
2018-12-11 11:58:26 -08:00
Adam Cozzette
4dd45935d7 Removed scc.cc 2018-11-09 11:40:27 -08:00
Josh Haberman
25feb59620 Added visibility. 2018-11-03 14:43:20 -07:00
Josh Haberman
6dec8cf96e Added conformance tests to Bazel BUIDL file. 2018-11-03 12:59:45 -07:00
Thomas Van Lenten
18aa296144 Collapse :protobuf_objc and :objectivec targets.
Not sure the history for why there were two objc_library targets, but
given the one has an issue about not working, merge them into a single
target and an alias.

- Use the alias for :objectivec since that naming doesn't seem to follow
  the other targets *_library targets here.
- Update :protobuf_objc to be use for the working target and just inline
  the sources/headers lists so there is less indirection in the file.

Fixes #5284
2018-11-01 12:52:18 -04:00
scentini
b30ddee2aa
use flag_values = {"@bazel_tools//tools/cpp:compiler": "x"} for compiler config_settings 2018-08-28 14:07:55 +02:00
Laszlo Csomor
414a625a79 Windows: expand path names on command line
Fixes https://github.com/google/protobuf/issues/3957
2018-08-14 16:03:46 +02:00
Feng Xiao
bde4eaf137 Update build files.
* Fixes https://github.com/google/protobuf/issues/5031
* Fixes https://github.com/google/protobuf/issues/5037
2018-08-13 14:41:27 -07:00
Feng Xiao
b1c5503022
Delete unused files. (#4942)
* Delete unused files.
2018-07-19 17:30:15 -07:00
Benjamin Barenblat
048f5c26a7 objectivec: Quash -Wself-assign and -Wvla (#4897)
* objectivec: Quash -Wself-assign

* objectivec: Set -Wno-vla when building

Objective-C protobuf uses VLAs for performance reasons. Ensure Clang
doesn’t complain about them.
2018-07-11 13:20:01 -04:00
Adam Cozzette
2c30fa71e7
Merge pull request #3981 from fahhem/patch-3
Handle srcs in generated files by cd'ing in and out
2018-07-02 15:08:12 -07:00
mdepristo
42141fa2f7 Remove unclear comment. 2018-06-30 14:56:19 -07:00
depristo
2506cf5cf4 Remove write-strings warning from COPTs.
This change reduces the excessive warnings when compiling C++ protobufs like "external/protobuf_archive/python/google/protobuf/pyext/message.cc:2629:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]"
2018-06-28 22:54:43 +00:00
Cory McLean
b7d3ec3aa9 Make proto_api target visible 2018-06-11 12:18:45 -04:00
Feng Xiao
a0e82dbe56
Merge pull request #4725 from ThomasColthurst/patch-2
Remove cycle in dependency graph
2018-06-09 23:25:56 -07:00
Loo Rong Jie
0456e269ee Align Bazel on Windows with CMake's MSVC flags (#4720)
* Align Bazel on Windows with CMake's MSVC flags
2018-06-05 19:03:24 -07:00
Thomas Colthurst
ee8d3aa308
Remove cycle in dependency graph 2018-06-04 16:38:58 -04:00
Feng Xiao
a7252bf42d
Merge pull request #4698 from ThomasColthurst/proto_c_api
Introduce Proto C API; based on cl/198113115 by amauryfa
2018-06-03 14:54:53 -07:00
Feng Xiao
143851ed25
Remove js_embed binary. (#4709)
* Remove js_embed binary.
2018-06-01 11:00:04 -07:00
Thomas Colthurst
7c6514245b Introduce Proto C API; based on cl/198113115 by amauryfa 2018-05-30 10:33:02 -04:00
Feng Xiao
8175c6e444
Merge pull request #4659 from calder/bazel-python-namespace-fix
Declare 'google' namespace when importing Python protobuf via Bazel
2018-05-24 16:35:16 -07:00
Jan Tattermusch
ccc56a3c1e fix syntax error in BUILD file 2018-05-24 09:51:53 -07:00
Calder Coalson
142cbe0d57 Declare 'google' namespace when importing Python protobuf via Bazel.
`python/google/__init__.py` declares the top-level 'google' namespace so that
`google.protobuf` can be imported alongside other Google Python modules like
`google.auth`.

This works well when installing protobuf via Pip, but the Bazel `//:python_srcs`
rule doesn't include this file in its `srcs`. Bazel implicitly creates an empty
`google/__init__.py`, which does *not* set up a namespace. The result is that
consuming Python protobuf via Bazel breaks all other Google Python libraries.

This fixes #4658.
2018-05-22 20:19:28 -07:00
Laszlo Csomor
5517168fa9 Windows: expand wildcard arguments
Fixes https://github.com/google/protobuf/issues/3957
2018-05-22 08:57:57 +02:00
Fahrzin Hemmati
55962db9b7 Fix generated_protos_proto deps 2018-05-07 17:36:34 -07:00
Fahrzin Hemmati
0d68b29ac4 Add unittest build rules 2018-05-07 15:40:31 -07:00
Feng Xiao
d34e3190df
Merge pull request #4431 from xfxyjwf/rmnano
Remove javanano.
2018-03-26 13:43:54 -07:00
Feng Xiao
d5a0024171 Remove javanano. 2018-03-26 12:59:28 -07:00
Adam Cozzette
2c963d3c24
Merge pull request #4413 from pmuetschard/msvc
Don't assume Windows builds use MSVC.
2018-03-23 15:24:03 -07:00
Adam Cozzette
5bed368014 Added missing .inc files to BUILD
This fixes the Bazel build.
2018-03-23 10:19:04 -07:00
Pascal Muetschard
a6957f2890 Don't assume Windows builds use MSVC.
Switch to using the MSVC options, not based on the cpu, but based
on the compiler name. This allows building on Windows with MSYS
or MinGW's gcc.
2018-03-22 13:14:10 -07:00
Adam Cozzette
0c5fcdee44 Removed some unused C++ source files 2018-03-22 10:15:31 -07:00
Feng Xiao
8e44a86fac
Merge pull request #4347 from xfxyjwf/pluginpb
Revert "Move `compiler/plugin.pb.cc` to libprotobuf with the other WKT sources."
2018-03-09 10:50:23 -08:00
James O'Kane
950f5e4205 Replace //:protoc and similar default macro arguments with
@com_google_protobuf prefixed versions. This allows them to work in 3rd party
repositories.

Fix a bad visibility rule. :hidden does not exist, but :private does.
2018-03-08 22:30:44 -08:00
Feng Xiao
fd595fcc93 Revert "Move compiler/plugin.pb.cc to libprotobuf with the other WKT sources."
This reverts commit 724f0be33d.
2018-03-01 16:36:05 -08:00
John Millikin
350b135e23 Blacklist all WELL_KNOWN_PROTOS from Bazel C++ code generation.
This prevents the Bazel `CcProtoAspect` from generating and linking
C++ object code for these files. Without this blacklist, symbols for
protobuf types depended on by `libprotobuf` may be defined multiple
times and violate the ODR rule.

Fixes https://github.com/google/protobuf/issues/4311
2018-02-24 11:36:49 -08:00
John Millikin
724f0be33d Move compiler/plugin.pb.cc to libprotobuf with the other WKT sources.
This lets all values of `WELL_KNOWN_PROTOS` be treated the same with
regard to Bazel's protobuf blacklisting.
2018-02-24 11:34:40 -08:00
David Ostrovsky
85b488f7fa Bazel: Support building with Java 9
Fixes: #4256.

Bazel@HEAD supports Java 9.

The current code has one single issue with Java 9 compliance: the usage
of sun.misc package. We add jdk.unsupported module with --add-modules
compiler option for now. Long term, the usage of non public API should
be avoided.

To build with Java 9, build custom bazel version and issue:

  $ bazel --host_javabase=/usr/lib64/jvm/java-9-openjdk build \
    --javacopt='--release 9' \
    --java_toolchain=@bazel_tools//tools/jdk:toolchain_jdk9 \
   :protobuf_java
2018-01-31 23:12:04 +01:00
David Ostrovsky
019ceea4b3 Drop java 6 support
Fixes #4220.
2018-01-25 06:54:38 +01:00
Jisi Liu
27e877fdaa
Merge pull request #2834 from aj-michael/master
Make //:protobuf_python have correct __init__.py.
2017-12-12 16:22:47 -08:00
Adam Cozzette
609d752650 Ran update_file_lists.sh to update Bazel and CMake file lists
This should fix Bazel builds, since those were missing a new file
(implicit_weak_message.cc).
2017-12-07 14:16:50 -08:00
Justine Tunney
ac5371d13e Remove unhelpful build warnings
-Wno-writable-strings removes 230 "ISO C++11 does not allow conversion from
string literal to 'char *'" warnings from TensorFlow test / build output.
These happen because pyext/ sources pass string literals to Python C API data
structures, e.g. PyGetSetDef, which for some reason were designed to not have
the const qualifier.
2017-11-17 18:40:05 -08:00
Jisi Liu
b189389e2f Merge pull request #3757 from spinorx/master
Fix iOS cc_library build for protobuf.
2017-10-20 11:56:13 -07:00
Jisi Liu
1c682e0b0b Fix bazel build 2017-10-18 14:31:23 -07:00
Param Reddy
16792c6240 Fix iOS cc_library build for protobuf.
The SDK and os versions were hard coded.  Archs were mixed up.
Because of this,  Was getting errors with latest SDK:
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/' [-Wmissing-sysroot]
In file included from external/com_google_protobuf/src/google/protobuf/io/printer.cc:35:
In file included from external/com_google_protobuf/src/google/protobuf/io/printer.h:40:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:470:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:171:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:638:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:61:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h:61:15: fatal error: 'string.h' file not found
              ^~~~~~~~~~
              1 error generated.

Currently none of these are needed when using bazel with https://github.com/bazelbuild/rules_apple.
-target arm64-apple-ios is passed properly to clang.  So -arch armv7 etc are not needed.
OS_IOS is not used anywhere.
Sources have:  GOOGLE_PROTOBUF_NO_THREADLOCAL defined in src/google/protobuf/stubs/platform_macros.h for iOS.  So __thread= is not needed.  In fact now that bazel is using C++11 by default,  __thread should ideally be moved to thread_local.
-miphoneos-version-min is passed by rules_apple.
2017-10-15 20:20:52 -07:00
Seth Greenstein
68ee916221 Don't pass -lpthread and -lm on Windows
These flags are ignored by cl.exe and have no effect, but add noise to the build logs.
2017-10-10 11:08:27 -07:00
Adam Cozzette
13fd045dbb Integrated internal changes from Google 2017-09-14 10:03:57 -07:00
Feng Xiao
6945203300 Exclude addressbook.proto from C# boostrap test.
This addressbook.proto now belongs to its own bazel pacakge and can't be
accessed in bazel protobuf_test target.
2017-09-11 17:00:11 -07:00
Jakob Buchgraber
699c0eb9cf bazel: Add proto_library rules for well known types. Fixes #2763
Adds a proto_library rule for each well known type proto:

$ bazel query "filter(\".*_proto$\", \"...\")"
//:wrappers_proto
//:timestamp_proto
//:struct_proto
//:field_mask_proto
//:empty_proto
//:duration_proto
//:compiler_plugin_proto
//:descriptor_proto
//:api_proto
//:type_proto
//:source_context_proto
//:any_proto

Bazel users can reference these proto_library rules for their own
language specific rules i.e.

java_proto_library(
  name = "any_java_proto",
  deps = ["@com_google_protobuf//:any_proto"],
)

Also set the workspace name to "com_google_protobuf", as proto_library
rules reference protobuf that way.
2017-09-05 22:33:54 +02:00
Jisi Liu
12c186f7c6 Fix makefile.am 2017-07-25 14:38:00 -07:00
Jisi Liu
e177739fa2 Fix build files 2017-07-25 14:37:19 -07:00
Jisi Liu
759245a49a Merge from master 2017-07-25 11:52:33 -07:00
Jisi Liu
11b6661e66 update build file list 2017-07-19 12:10:43 -07:00
Jakob Buchgraber
36e63da632 bazel: Make compiled jars java 6 binary compatible.
See: https://github.com/bazelbuild/bazel/issues/3198
2017-06-16 12:50:35 +02:00
Yun Peng
0b059a3d8a Refactor cc options in BUILD file for Windows
Don't put gcc warnings options in copts, so that protobuf is able to
build by MSVC toolchain without python wrappers.
2017-05-31 14:01:30 +02:00
Adam Cozzette
2f4489a3e5 Merge pull request #3024 from acozzette/merge-3.3-to-master
Merged 3.3.x branch to master
2017-05-01 10:58:38 -07:00
makdharma
286f059842 added "objectivec" build target (#3033)
This target will be used by gRPC iOS bazel build system.
2017-05-01 09:49:26 -07:00
Feng Xiao
acde1651b5 Update BUILD file for C# tests. 2017-03-29 15:14:18 -07:00
Feng Xiao
32d7830e4b Fix C++ build for down-integration. 2017-03-29 14:52:33 -07:00
cgrushko
6f21e29268 Compile the Java proto runtime with Java 6
in order to avoid errors related to generics when 
building user code in newer versions of Java.
2017-03-22 14:27:51 -04:00
Bairen Yi
312e2dbcfb Update BUILD 2017-03-21 03:52:37 +08:00
Byron Yi
cb3e84b78e migrate delimited messages functions to util package 2017-03-16 20:01:22 +08:00
Adam Michael
6044b24cfc Make //:protobuf_python have correct __init__.py.
Previously //:protobuf_python set no __init__.py so Bazel created an
empty one. This change makes it use the __init__.py from the repository.
2017-03-10 18:06:34 -05:00
Feng Xiao
0c0a8879c3 Merge pull request #2751 from keveman/master
Added a header only cc_library target for the protobuf library.
2017-03-06 10:41:19 -08:00
Manjunath Kudlur
6837b2dcb7 Added comment explaining the protobuf_headers target. 2017-03-02 18:02:05 -08:00
Jisi Liu
72b82e6875 Merge pull request #2630 from blodan/master
FreeBSD compatibility
2017-02-24 12:52:53 -08:00
Manjunath Kudlur
2d430f8c72 Added a header only cc_library target for the protobuf library. 2017-02-23 08:17:24 -08:00
cgrushko
65a4d20deb Update load() statement to latest style
The first argument is currently implicitly a .bzl file.
Change this to be explicit.
2017-02-08 15:23:57 -05:00
Daniel Ylitalo
32fa55e666 FreeBSD compatibility 2017-01-25 22:04:11 +01:00
cgrushko
e4baf3f58a Add a proto_lang_toolchain for Java
This allows easy use of Bazel's java_proto_library native rule.
2017-01-12 12:51:04 -05:00
Adam Cozzette
d1e7bd9842 Added Bazel genrule for generating well_known_types_embed.cc
In pull request #2517 I made this change for the CMake and autotools
builds but forgot to do it for the Bazel build.
2016-12-20 09:08:19 -08:00
Jisi Liu
f92b455aa6 Add missing files. 2016-12-05 10:16:47 -08:00
cgrushko
45d92aea27 Add a proto_lang_toolchain() for cc_proto_library
Bazel's built-in cc_proto_library rule uses a proto_lang_toolchain to learn how to invoke proto-compiler.
To use Bazel's cc_proto_library, add the following to your project's WORKSPACE file:

local_repository(
  name = "com_google_protobuf_cc",
  path = "/path/to/protobuf-distribution/"
)
2016-12-02 19:40:50 -05:00
Richard Shin
df5841f0b2 Place Python extensions correctly in Bazel build. 2016-10-18 13:17:27 -07:00
Jisi Liu
9d4657a9e2 update files to include php generators 2016-10-10 11:43:48 -07:00
Andy Hochhaus
b2b65842ea Silence compile warnings in bazel 2016-10-09 08:36:01 -07:00
Feng Xiao
431cee60e6 Remove inexist files from build. 2016-10-06 16:36:45 -07:00
Jisi Liu
d947308aa1 update files to include php generators (#2165) 2016-10-06 11:49:47 -07:00
Piotr Sikora
faea19c359 Bazel: export LICENSE file.
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2016-08-04 15:32:14 -07:00
David Z. Chen
02cd45ca35 Bazel build: Keep generated sources and Python runtime in the same directory.
Users often encounter a Python import error when trying to build Python
protos if protobuf is installed locally on the machine. In this case,
Python ends up looking in the wrong directory when importing files (see
bazelbuild/bazel#1209 and tensorflow/tensorflow#2021). It seems that the
problem is caused by Python getting confused when there are Python
source files that are meant to be part of the same package but are
in separate directories.

Prior to #1233, the Bazel build setup would copy the Python
runtime sources and all generated sources for the builtin protos into
the root directory (assuming that the protobuf tree is vendored in a
google/protobuf directory).

With #1233, the two sets of sources are kept in their respective
directories but both `src/` and `python/` are added to the `PYTHONPATH`
using the new `imports` attribute of the Bazel Python rules. However,
both the runtime sources and the generated sources are under the same
package: `google.protobuf`, causing Python to become confused when
trying to import modules that are in the other directory.

This patch adds a workaround to the Bazel build to add a modified
version of the original `internal_copied_filegroup` macro to copy the
`.proto` files under `src/` to `python/` before building the
`py_proto_library` targets for the builtin protos. This ensures that the
generated sources for the builtin protos will be in the same directory
as the corresponding runtime sources.

This patch was tested with the following:
* All Python tests in protobuf
* All Python tests in tensorflow
* All tests in [Skydoc](https://github.com/bazelbuild/skydoc)
* Importing protobuf as `//google/protobuf`
* Importing and binding targets under `//external`
* Importing protobuf as `//third_party/protobuf`
2016-05-25 18:02:09 -07:00
Jisi Liu
f86d39c295 Update file lists. 2016-04-28 14:43:22 -07:00
Feng Xiao
0ad204845f Merge pull request #1416 from cwhipkey/master
Change protobuf CPP proto generator to support the 'lite' option in
2016-04-20 17:15:16 -07:00
Feng Xiao
83a7a5e885 Merge pull request #1402 from davidzchen/py2and3
Add missing PY2AND3 srcs_versions attributes to Python Bazel build targets
2016-04-19 10:01:29 -07:00
Jisi Liu
1f4f3e26bd Update file list to include the missing extension lite file. 2016-04-18 14:12:08 -07:00
Chad Whipkey
baf52bd79e Change protobuf CPP proto generator to support the 'lite' option in
proto3.

Added a couple unit test proto3 files, for arena_lite and lite. Cloned
the proto3_arena_unittest to test some of the basics of generated code
(and to ensure that the generated proto3 test files are used by some
test).
2016-04-15 09:23:50 -07:00
David Z. Chen
5ebeefb94c Add missing PY2AND3 srcs_versions attributes to Python Bazel build targets. 2016-04-08 13:30:13 -07:00
Andrew Harp
3b4e7dcf29 Update BUILD 2016-04-04 16:13:31 -04:00
Andrew Harp
b56b461e49 Do not link in pthread library for Android builds.
This is required to allow Tensorflow to build on Android without hacks. Currently we create a dummy pthread library just to satisfy this dependency for a library that does not exist on Android. See https://github.com/google/protobuf/issues/1373 for more context.
2016-04-04 15:13:30 -04:00
Steven Parkes
d5a573274d export well known protos 2016-03-22 17:56:07 -07:00
Feng Xiao
ca3dc15d4c Merge pull request #1318 from smparkes/smparkes/grpc
add java/util support based on java/util/pom.xml
2016-03-14 14:57:33 -07:00
Jisi Liu
9aea0ef0cd Merge pull request #1312 from petewarden/master
Bazel iOS build settings
2016-03-12 15:15:03 -08:00
Steven Parkes
a9244ca0df add java/util support based on java/util/pom.xml 2016-03-11 18:08:09 -08:00
Steven Parkes
ea1886661e pass correct args to protoc for java wellknown protos when used as an external repository 2016-03-10 15:04:46 -08:00
Pete Warden
bc2d6c2504 Merge remote-tracking branch 'upstream/master' 2016-03-09 13:05:15 -08:00
Pete Warden
f0c1a86372 Added iOS settings to Bazel build 2016-03-09 13:03:52 -08:00
David Z. Chen
985c968443 Remove hack for building Python support with Bazel.
This change makes use of new imports attribute for Bazel's Python rules, which
enable adding directories to the PYTHONPATH. This allows us to remove
the hack for building protobuf's Python support with Bazel and now
allows projects to include protobuf using a Bazel external repository
rather than requiring it to be imported directly into the source tree as
//google/protobuf.

This change also updates the protobuf BUILD file to use a named
repository, @python//, for including Python headers rather than
//util/python. This allows projects to specify their own package for
Python headers when including protobuf with an external repository.

Fixes #1230
2016-02-25 12:52:21 -08:00
Pete Warden
cb39204af8 Updated library generation with iOS options 2016-02-23 10:18:32 -08:00