Commit Graph

105 Commits

Author SHA1 Message Date
Adam Cozzette
5bed368014 Added missing .inc files to BUILD
This fixes the Bazel build.
2018-03-23 10:19:04 -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