build: google format plugin upgrade#868
Conversation
|
|
||
| allprojects { | ||
| repositories { | ||
| mavenCentral() // for google-java-format's dependency |
There was a problem hiding this comment.
Without this setting, the build fails:
suztomo@suxtomo24:~/gax-java$ ./gradlew build
> Task :verifyGoogleJavaFormat FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':verifyGoogleJavaFormat'.
> Could not resolve all files for configuration ':googleJavaFormat1.6'.
> Cannot resolve external dependency com.google.googlejavaformat:google-java-format:1.6 because no repositories are defined.
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 0s
2 actionable tasks: 2 executed
|
|
This is related to #865. |
|
@rahulKQL Shall we disable google format plugin for non-Java8 builds? While we care about JDK compatibility of gax-java artifacts and its tests, we don’t care source code style validation difference between JDK versions. Checking the style on Java 1.8 build should be enough. |
|
@suztomo That sounds a good workaround to me |
Codecov Report
@@ Coverage Diff @@
## master #868 +/- ##
============================================
- Coverage 78.62% 78.62% -0.01%
Complexity 1163 1163
============================================
Files 203 203
Lines 5142 5141 -1
Branches 413 413
============================================
- Hits 4043 4042 -1
Misses 925 925
Partials 174 174
Continue to review full report at Codecov.
|
|
Travis builds succeeded. Build with Java 8 ran googleFormatPlugin Build with Java 7 skips verifyGoogleJavaFormat. |
| exclude 'build/**' | ||
| exclude 'bazel*/**' | ||
| } | ||
| verifyGoogleJavaFormat.onlyIf { JavaVersion.current().isJava8Compatible() } |
There was a problem hiding this comment.
Java 11 also works fine for the plugin. Therefore, leveraging JavaVersion's isJava8Compatible method.
suztomo-macbookpro44:gax-java suztomo$ java -version
java version "11.0.4" 2019-07-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.4+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode)
suztomo-macbookpro44:gax-java suztomo$ ./gradlew verifyGoogleJavaFormat
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 6s
5 actionable tasks: 5 executed
|
@suztomo Thanks for keeping me in the loop but I think we might need sign off from @kolea2 or @chingor13 as this would affect future PRs. Also regarding the Java 11 build failure can be fixed by updating Jacoco version to "0.8.2+" |
* What went wrong:
A problem occurred configuring root project 'gax-java'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve gradle.plugin.com.dorongold.plugins:task-tree:1.3.1.
Required by:
project :
> Could not resolve gradle.plugin.com.dorongold.plugins:task-tree:1.3.1.
> Could not get resource 'https://plugins.gradle.org/m2/gradle/plugin/com/dorongold/plugins/task-tree/1.3.1/task-tree-1.3.1.pom'.
> Could not GET 'https://plugins.gradle.org/m2/gradle/plugin/com/dorongold/plugins/task-tree/1.3.1/task-tree-1.3.1.pom'.
> sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: signature check failed
https://source.cloud.google.com/results/invocations/e8c74bc9-fc2d-4047-82b8-3e2d5b9cdc64/targets/cloud-devrel%2Fclient-libraries%2Fjava%2Fgax-java%2Fpresubmit%2Fjava7/log
|
@rahulKQL Jacoco upgrade was not trivial. Not including that in this PR for now. |
|
@chingor13 @kolea2 Would you approve and merge this? (Now I'm in googleapis organization but I don't have write permission) Linkage Monitor fails until #864 is merged (Would you merge that as well?) Java 11 fails until the Jacoco version is upgraded (not in this PR). |
|
@kolea2 @chingor13 Thank you. |
Torwards #867 . The old plugin version does not work with Gradle 6.
4 Java files are needed to be updated in new version of the formatter.
./gradlew googleJavaFormatmade the change.