Commit Graph

132 Commits

Author SHA1 Message Date
Carl Mastrangelo ee12cc2a34 all: update to latest version of errorprone 2017-03-22 22:09:04 -07:00
Carl Mastrangelo 7ce2b4f81d all: start 1.3.0 development cycle 2017-03-06 13:12:44 -08:00
Eric Anderson 675080b208 all: Enable ErrorProne during compilation
ErrorProne provides static analysis for common issues, including
misused variables GuardedBy locks.

This increases build time by 60% for parallel builds and 30% for
non-parallel, so I've provided a way to disable the check. It is on by
default though and will be run in our CI environments.
2017-02-24 14:53:23 -08:00
Eric Gribkoff 58720655c8 compiler: update path to protoc plugin in README 2017-02-23 12:55:55 -08:00
Carl Mastrangelo 700abb32af compiler: add some missing final modifiers on generated code 2017-02-10 10:16:43 -08:00
Carl Mastrangelo b0323ac22c all: update to protobuf 3.2.0 2017-02-07 09:47:15 -08:00
Carl Mastrangelo e8aef5b4bb Start 1.2.0 development cycle 2017-01-30 16:40:12 -08:00
Carl Mastrangelo 237a65ebfc core: make ServiceDescriptor use the Builder pattern 2017-01-30 15:22:40 -08:00
Carl Mastrangelo cbe0ecd5e2 all: fix linter found on import 2017-01-27 15:47:53 -08:00
Carl Mastrangelo c4642f8b3d compile: add std:: to all stl types 2017-01-17 12:50:25 -08:00
ZHANG Dapeng 3d210ae875 compiler: reduce synchronzed invocation (#2539)
not necessary to synchronze every time calling
getServiceDescriptor(), if the descriptor has been created already;

go with the double-checked locking idom
2016-12-29 12:21:04 -08:00
Kun Zhang 1aaf1a989c compiler: final bindService() in generated code. (#2553)
So that it won't be overridden by Mockito when it creates a mock for
the server interface.
2016-12-29 10:32:47 -08:00
Eric Anderson 09fd43df4e compiler: Use public headers instead of pb.h
Using the pb.h causes trouble when dealing with internal vs external
protobuf (as seen in cl/142286800).
2016-12-29 12:13:54 -06:00
Eric Anderson 8ecf05409e compiler: Explicitly specify std::
This is to follow style changes happening internally.
2016-12-01 16:10:23 -08:00
Kun Zhang 6da8f471f7 compiler: whitelist USER32.DLL. (#2455)
The 32-bit windows grpc codegen built with protobuf 3.0.2 depends on
USER32.DLL, while the previous release built with protobuf 3.0.0 didn't.
Both protobuf and grpc codegen are built under msys2-mingw32.

"objdump -x libprotobuf-10.dll | grep DLL" also shows the USER32.DLL
dependency being brought by protobuf:

3.0.0

 DLL Name: KERNEL32.dll
 DLL Name: msvcrt.dll
 DLL Name: zlib1.dll
 DLL Name: libgcc_s_dw2-1.dll
 DLL Name: libstdc++-6.dll

3.0.2

 DLL Name: KERNEL32.dll
 DLL Name: msvcrt.dll
 DLL Name: USER32.dll
 DLL Name: zlib1.dll
 DLL Name: libgcc_s_dw2-1.dll
 DLL Name: libstdc++-6.dll

While unexpected, USER32.dll is shipped with Windows so having such
dependency shouldn't cause any trouble.
2016-11-28 17:45:11 -08:00
Łukasz Strzałkowski d954bc2a51 Typo in version number
3.10 -> 3.1
2016-11-04 10:18:18 -07:00
Eric Anderson c38611a230 Bump protobuf to 3.1.0
Also removed warnings about protoc version matching runtime, since this
is no longer supposed to be a problem (starting with 3.0.0-beta-4) and
all our tests ran fine when using protoc 3.0.2 with protobuf runtime
3.1.0.

Fixes #2316
2016-11-01 14:52:56 -07:00
Eric Gribkoff abffc76da2 addressing reviewer comments 2016-10-28 08:45:32 -07:00
Eric Gribkoff aff1cac7da Compiler/core changes to support the proto reflection API
core: adds @Nullable Object getAttachedObject() to ServiceDescriptor

compiler: Plumbing necessary to access proto file descriptors via
the reflection service
2016-10-28 08:45:32 -07:00
Nishidha 862157a84b Changes to add support of Power8 little endian 2016-10-25 15:18:10 -07:00
Carl Mastrangelo 894802e3ec compiler: lazily generate ServiceDescriptors 2016-10-19 16:52:47 -07:00
Eric Anderson b1d72e5c3e all: Bump protobuf to 3.0.2, to fix protoc in CI
protoc no longer builds in 3.0.0 because auto-download of the gmock zip
now fails. 3.0.2 has a fix to autogen:
bba446bbf2

All that was strictly necessary was to update .travis.yml and
buildscripts/, but it helps our sanity to keep the rest of the protobuf
versions in sync. Lite is left on its existing version, because it did
not see a bump of neither the java library nor the protoc plugin.
2016-09-29 10:25:31 -07:00
Eric Anderson 656e8ce37f core: Remove com.google.common.collect usages for Android
This reduces the number of methods gRPC brings in by ~450, which is
substantial. Each application will see different numbers though,
depending on their usage and their other dependencies.

A very rough (under) counting for number of methods included because of
gRPC in android-interop-test is 2746, and that is reduced to 2313 (-433)
by this change. That count includes grpc, guava, okhttp, okio, and nano.
The actual reduction of methods is 447, with the discrepency due to
reduction of methods in java.util and java.lang. Of the 433 removed
methods, 377 are from com.google.common.collect and 61 from
com.google.common.base. The removal costed an increase of 5 methods
(total 1671) within io.grpc itself.
2016-08-26 15:13:45 -07:00
Eric Anderson a8700a7837 Begin consuming protobuf-lite artifact
Protobuf-lite since beta-4 is now more of a fork than a subset of
protobuf-java, which may cause us problems later since lite API is not
stable. Also, lite-generated code may now depend on APIs only in
protobuf-lite, so our users must depend on the protobuf-lite runtime.
Having all our users explicitly override the dependency is bothersome to
them and can easily only expose problems only after we do a release.

So now we are doing the dependency overriding; most users should "just
work" and pick up the correct protobuf artifact. I've confirmed the
exclusion is listed in the grpc-protobuf pom and "gradle dependencies"
and "mvn dependency:tree" do not include protobuf-lite for the examples.
Vanilla protobuf users are most likely to experience any breakage, which
should detect problems more quickly since we use protobuf-java more
frequently than protobuf-lite during development.

protobuf-lite does not include pre-generated code for the well-known
protos, so users will need to generate them themselves for the moment
(google/protobuf#1889).

Note that today changing deps does not noticeably reduce the method code
for our users, since ProGuard already is stripping most classes. The
difference in output is only a reduction of 3 classes and 6 methods for
the android example.
2016-08-01 15:51:11 -07:00
Eric Anderson 5e1e88357c Update protobuf to 3.0.0
Fixes #2086
2016-07-29 09:31:15 -07:00
ZHANG Dapeng 8f5adf83fb compiler: flip enable_deprecated option to false (#2080)
resolves #1469 externally
2016-07-22 16:35:00 -07:00
ZHANG Dapeng 3a13aa5665 compiler: make Stub final class 2016-07-22 09:49:32 -07:00
Eric Anderson 4b5511e4c0 compiler: Add FALLTHROUGH_INTENDED to appropriate cases
The macro can become [[clang::fallthrough]] or similar on supporting
compilers.
2016-07-22 08:36:05 -07:00
ZHANG Dapeng e109125c62 compiler: add build option to enable deprecated generated code
partially resolving #1469

The added option for java_plugin `enable_deprecated` is `true` by default in `java_plugin.cpp`, so the generated code for `TestService.java` (`compiler/build.gradle` not setting this option) has all deprecated interfaces and static bindService method.

`./build.gradle` and `examples/build.gradle` set this option explicitly to `false`, so all the other generated classes do not have deprecated code.

Will set `enable_deprecated` to `false` by default in future PR when we are ready.
2016-07-21 16:35:18 -07:00
Eric Anderson e9643bb5d7 Start 1.1.0 development cycle 2016-07-11 16:57:58 -07:00
Eric Anderson 46379da1a6 Start 1.0.0 development cycle 2016-07-01 11:46:33 -07:00
ZHANG Dapeng f149e4c175 compiler: deprecate interfaces and add ImplBase in codegen
first step to address issue #1469:

- leave and deprecate interfaces in codegen
- introduce `ServiceImplBase`,
- `AbstractService` is deprecated and extends `ServiceImplBase`
- static `bindService()` is deprecated
2016-06-29 21:17:03 -07:00
Eric Anderson dbef1af29a Bump protobuf dependency to 3.0.0-beta-3
This allows us to play with zero-copy and proto3 support for lite.
Unfortunately, it introduced some warnings, so deprecated warnings are
now ignored for benchmarks and interop-testing.
2016-06-28 08:58:13 -07:00
Eric Anderson 66ab956f9e Reapply "Eliminate MethodDescriptor from startCall and interceptCall for servers"
This reverts commit ef178304cb, which
itself was a revert.
2016-06-23 09:27:47 -07:00
Eric Anderson ef178304cb Revert "Eliminate MethodDescriptor from startCall and interceptCall for servers"
This reverts commit 3df1446deb.

The commit was adding to the difficulty of integration for testing. By
itself it isn't bad, so this is a temporary revert until the many other
commits are absorbed and then it will be reapplied.

This does have a manual edit for ClientCallsTest.
2016-06-20 15:18:18 -07:00
Louis Ryan 3df1446deb Eliminate MethodDescriptor from startCall and interceptCall for servers
Make the MethodDescriptor a property of ServerCall
Move ServerMethodDefinition into ServerServiceDefinition
2016-06-13 14:39:58 -07:00
Eric Anderson 7c722e440e codegen: Specify URL for ExperimentalApi
Fixes #1378. These are the last ExperimentalApis that didn't have their
own separate tracking issue.
2016-06-07 15:00:29 -07:00
Eric Anderson 641cb357c6 Tweak -Xlint warnings
This now catches a few more places we needed -Xlint:-options.
InProcessSocketAddress is technically already in our stable API, so I
maintained its current serialVersionUID.
2016-05-24 15:04:07 -07:00
Carl Mastrangelo 3c5b5a5e09 Begin v0.15.0 Cycle 2016-04-29 13:54:18 -07:00
nmittler 7e8b504e3f Add javadoc to grpc codegen based on proto docs
Fixes #1612
2016-04-22 13:23:17 -07:00
Eric Anderson 7fe8d8bb20 Fix change detection for compiler testing 2016-04-19 12:37:42 -07:00
Eric Anderson 9bc5d93e4a Mark generated abstract class as Experimental 2016-04-19 12:35:04 -07:00
Carl Mastrangelo faaaa160df Fix compilation nags for generated code 2016-04-18 15:47:44 -07:00
Lukasz Strzalkowski 363e0f6cfc Print compiler version number in generated files 2016-04-11 19:35:19 -07:00
Lukasz Strzalkowski 2fbf142a41 Provide base methods for Abstract stub
Default implementation returns status UNIMPLEMENTED. This allows adding
new methods to services without breaking existing code.
2016-04-11 16:38:23 +02:00
Łukasz Strzałkowski 90fbf9b274 Adapt BindableService in ServerBuilder#addService
Makes binding services to server as simple as it can get.
2016-04-08 11:14:26 -07:00
Lukasz Strzalkowski f8b71e72b3 Add Abstract{ServiceName} class in compiled service class 2016-04-07 17:39:17 -07:00
Eric Anderson 0a01b3cf42 Simplify nano flag to codegen to just 'nano' from 'nano=true'
'nano=true' still works, but any value is now ignored. This is to align
with our lite flag, but also just because It's Cleaner.

Note that this is counter to what javanano does. Javanano requires all
flags have a value and uses true/false for many values.
2016-03-30 09:34:22 -07:00
Eric Anderson b22bcdfd18 Use lite argument in codegen instead of LITE_RUNTIME
This allows using the same proto file for both client and server without
forcing the server to use lite.
2016-03-29 16:19:56 -07:00
Eric Anderson 99a6d8de27 Add native support for Protobuf Lite
Lite already worked by using the protobuf project, but would bring in
extra dependencies that are not intended to work with lite. Although
protobuf is not yet providing a lite package on Maven Central, we will
be able to swap to it once it is available.

There isn't any new original code in the Java portion, except for a new
overload in ProtoUtils that accepts Message instead of MessageLite.
Depending on Message in ProtoUtils allows us to support extra features
out-of-the-box without any changes to the generated code. For example,
JSON encoding could be supported in this way if Marshaller is enhanced.

However, now codegen must be aware of Lite in order to choose with Util
class to use. That is new code.
2016-03-22 15:40:51 -07:00