Commit Graph

57 Commits

Author SHA1 Message Date
Thomas Broyer 2ffc46d6fa Update net.ltgt.errorprone to 0.6 and enable Error Prone on JDK 10+ 2018-12-13 10:17:06 -08:00
Eric Anderson 959323be97
Add build support for Java 11
It appears everything was already working on Java 11, except
build-specific and testing issues. Updating to Netty 4.1.30 (#4940)
probably fixed the last true Java 11 incompatibility.

Fixes #4933
2018-10-17 11:49:30 -07:00
elandau 0d4051ca6e Include Java's @Deprecated annotation on RPC services or methods with `option deprecated = true;` 2018-08-15 12:24:01 -07:00
ZHANG Dapeng 5ce10f0146
all: add gradle format checker
This PR adds an automatic gradle format checker and reformats all the *.gradle files. After this, new changes to *.gradle files will fail to build if not in good format, just like checkStyle failure.
2018-06-11 18:35:18 -07:00
Eric Anderson e085a0eca0 Bump to Gradle 4.7
The new jmh plugin fixes a warning for the newer version of Gradle.
The new AppEngine plugin still produces a warning, but updating it
anyway so people know that upgrading the plugin doesn't fix the problem.
The new android-maven plugin fixes a build problem with the newer
Gradle.

The Visual Studio fixes were necessary starting ~4.4.
https://github.com/gradle/gradle-native/issues/34#issuecomment-335222096
describes the change in behavior.

There's nothing immediately being used as part of this update. It's just
to keep us current and to get us over that Visual Studio change hump.
2018-05-17 15:46:21 -07:00
Carl Mastrangelo 8be87de9b0
compiler: make testing service used by compiler not conflict with interop-testing proto
This change puts the compiler test.proto file in a directory that matches it's path.  The current proto package has a namespace collision with the grpc.testing proto in interop-testing.  Thus, this PR:

* change the package of test.proto to be grpc.testing.compiler
* moves the test.proto into the matching grpc/testing/compiler/test.proto path
* updates the generated code.
2018-05-01 10:13:18 -07:00
Eric Anderson 1fb72ef6c1 Ignore proto-generated code for ErrorProne
Previously if protobuf-generated code triggered ErrorProne we'd have to disable
the failing check for all code in that task. With -XepExcludedPaths we can
disable the ErrorProne-checking just for protobuf. Note that we continue using
ErrorProne on our generated code. Also note this only applies to ErrorProne
checks; JDK checks still require task-level disabling.
2018-03-09 11:19:20 -08:00
zpencer 066ad3ceac
buildscripts,travis: fetch from mvn with retries (#4140)
A band aid for #3284, to make its symptoms less noticeable.
2018-03-01 19:11:24 -08:00
Eric Anderson 8bcb5cfac6 compiler: Verify binary with native VS commands
This allows building release binaries on Windows without Bash and GCC.
2017-12-08 15:24:10 -08:00
Lukasz Janyst 7fd199f32e compiler: Build on aarch64 2017-11-21 12:20:19 -08:00
Eric Anderson 32cd4a0660 compiler: Produce unified output on diff failure
This includes the file names and context, which is soo much nicer.
2017-08-25 16:41:39 -07:00
Carl Mastrangelo 0fe2c5cca6 all: bump to proto 3.3.1 2017-05-23 17:04:51 -07:00
Carl Mastrangelo ee12cc2a34 all: update to latest version of errorprone 2017-03-22 22:09:04 -07: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
Nishidha 862157a84b Changes to add support of Power8 little endian 2016-10-25 15:18:10 -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 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
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 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
Eric Anderson 7fe8d8bb20 Fix change detection for compiler testing 2016-04-19 12:37:42 -07:00
Lukasz Strzalkowski 363e0f6cfc Print compiler version number in generated files 2016-04-11 19:35:19 -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
Eric Anderson bf42913c23 Fix artifact upload for compiler
check-artifact.sh was broken by the update to Gradle 2.10. We think the
update to Gradle 2.8 caused the POM to start being generated, but this
now fixes it to have the correct contents.

Using addFilter _disables_ the normal POM, so we use setFilter instead.

Fixes #1360
2016-01-29 17:16:58 -08:00
Kun Zhang 29784d1afb Fix grpc-compiler build. 2016-01-26 15:30:35 -08:00
Eric Anderson 46ce4098c5 Update gradle to 2.10
Gets us past some minor DSL changes and should get increased build
performance. Will make it easier to update to 2.11 and other future
versions.
2016-01-26 13:38:04 -08:00
Xudong Ma f7f57b79c9 Put nano generated code into nano package, unless option javanano_use_deprecated_package is set.
Also fix the behaior while java_package is set to empty.
2015-09-28 09:49:02 -07:00
Eric Anderson d04994f044 Update Windows building instructions for proto3b1 2015-09-24 15:50:28 -07:00
Kun Zhang bc347e3f6a Display the required Protobuf version when building codegen 2015-09-01 16:02:12 -07:00
Kun Zhang 35f77ee84b Upgrade to protobuf-gradle-plugin 0.5.0 2015-07-08 16:24:59 -07:00
Kun Zhang 9805e27569 Add property ``protoc=/path/to/protoc``
This allows people who cannot run the pre-compiled ``protoc`` pulled
from Maven Central to use their own ``protoc``.

Upgrade to protobuf-gradle-plugin:0.4.1 to display error messages of
protoc failures.
2015-05-12 17:34:40 -07:00
Kun Zhang 287a27a930 Upgrade to protobuf-gradle-plugin:0.4.0
Use the plugin to compile nano for golden test and get rid of the shell
script.
2015-05-11 16:38:22 -07:00
Kun Zhang 2f7497133d Unify build properties.
- Switch all system properties to project properties.
- Use the ``javaLocalNamingStyle`` instead of the
  ``dot.delimited.style`` for property names, so that it can be directly
  referenced by ``rootProject.propertyName``.
- Recommend users to put GRPC-specific properties in project-level
  ``build.properties`` instead of the user-level.
2015-05-07 14:14:10 -07:00
Kun Zhang c5b94c7525 Use protoc from Maven Central. 2015-05-07 11:18:43 -07:00
Kun Zhang 221c534f11 Fix build on Windows/VC++
- Stop defining custom architectures because VisualCpp toolchain doesn't
  allow it. Reference to built-in architectures 'x86' and 'x86_64' since
  they are supported by all toolchains.
- Remove 'local_arch' from platforms. For unsupported platform, we just
  do not specify the target.
- Target no more than one platform at a time. This simplifies the build
  script a lot.
- Remove the TARGET_ARCHS environment variable. Add system property
  ``arch`` to override ``osdetector.arch``.
- Add ``vc.disable`` to override the default choice of VisualCpp on
  Windows.
- Add ``vc.`` prefix to the properties that are only used with VC++
2015-05-04 09:25:49 -07:00
Kun Zhang 41940f7ff7 Upgrade to protobuf plugin 0.3.1
The plugin has been published on plugins.gradle.org

Conforming to the Gradle standard that plugin IDs must be name-spaced,
the plugin ID has been changed to com.google.protobuf.
2015-04-29 16:28:50 -07:00
Kun Zhang af18876713 Upgrade to com.google.protobuf:protobuf-gradle-plugin:0.1.0
Commit 76f0a09 after the previous release
(ws.antonov.gradle.plugins:gradle-plugin-protobuf:0.9.1) defers the
generation of generateProto tasks to post-evaluation of the project,
which make them no longer available in the evaluation phase. We need to
move the manipulation of these tasks to post-evaluation too.
2015-04-20 10:35:11 -07:00
Kun Zhang 4bc2d6d9a4 Remove call sites of Os.isFamily(). Use osdetector instead 2015-04-17 16:35:23 -07:00
Kun Zhang 0c2ea1550b Fix Mac build failure introduced by commit da3c3f8
- Add -lprotobuf etc to linker.args if libprotobuf.a etc doesn't exist in
  LDFLAGS
- install does not do architecture and dependency check on the artifacts,
  because it may produce non-publishable artifacts due to the above
  change.
2015-04-17 16:32:13 -07:00
zhangkun83 da3c3f8ced Solution for GRPC codegen deployment. 2015-04-16 15:07:36 -07:00
Eric Anderson e23f899491 Split protobuf into its own project
We don't want core to depend on protobuf.
2015-04-10 15:50:56 -07:00
Kun Zhang 90706dc48f Rename the codegen binary from java_plugin to protoc-gen-grpc-java 2015-04-09 15:24:46 -07:00
Eric Anderson a0acb9b9a8 Working Travis build, with caching of deps 2015-03-20 14:27:32 -07:00
Louis Ryan c42c8c420d Basic travis configuration 2015-03-20 11:37:30 -07:00
Eric Anderson 192144eaf9 Add Sonatype OSSRH upload support, with nice POMs
Mockito was upgraded to latest to solve JavaDoc issue with
ArgumentsAreDifferent.

We don't yet publish any artifacts for grpc-compiler.
2015-03-02 15:20:06 -08:00
Eric Anderson b938ba5106 Support building on Windows
Protoc should be in PATH and the project properties protobuf.include and
protobuf.libs should be set. For example:

gradlew build -Pprotobuf.include=C:\path\to\protobuf-3.0.0-alpha-2\src ^
  -Pprotobuf.libs=C:\path\to\protobuf-3.0.0-alpha-2\vsprojects\Release

When running more than once, it is probably more convenient to create
%HOMEDRIVE%%HOMEPATH%\.gradle\gradle.properties with contents like:

protobuf.include=C:\\path\\to\\protobuf-3.0.0-alpha-2\\src
protobuf.libs=C:\\path\\to\\protobuf-3.0.0-alpha-2\\vsprojects\\Release
2015-03-02 13:34:09 -08:00
Jakob Buchgraber df321fed73 Create temporary directory for javanano test if it does not exist.
The gradle task testNanoGolden fails because the temporary folder it tries to use does not exist.
The task tries to write files to temporaryDir which points to ./compiler/build/tmp/testNanoGolden/ on my machine.
The directory does not exist by default and so the run_nano_test.sh fails.
2015-02-25 21:47:28 -08:00
zsurocking 5902c6a3bb Revert "Remove nano codegen test temporarily. Currently I haven't figuired" 2015-02-25 20:54:53 -08:00