Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

build: google format plugin upgrade #868

Merged
merged 10 commits into from Feb 26, 2020
Merged

Conversation

suztomo
Copy link
Member

@suztomo suztomo commented Feb 11, 2020

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 googleJavaFormat made the change.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 11, 2020
@@ -53,6 +53,10 @@ if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')
}

allprojects {
repositories {
mavenCentral() // for google-java-format's dependency
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@suztomo
Copy link
Member Author

suztomo commented Feb 18, 2020

Travis failed: https://travis-ci.org/googleapis/gax-java/jobs/649038735?utm_medium=notification&utm_source=github_status

Execution failed for task ':verifyGoogleJavaFormat'.
> com/google/googlejavaformat/java/JavaFormatterOptions$Style : Unsupported major.minor version 52.0

@rahulKQL
Copy link
Contributor

This is related to #865.
It seems only until google-java-format:0.6 is supported on Java 7 and unfortunately this version is not supported on Java-11.

@suztomo
Copy link
Member Author

suztomo commented Feb 19, 2020

@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.

@rahulKQL
Copy link
Contributor

@suztomo That sounds a good workaround to me

@codecov
Copy link

codecov bot commented Feb 19, 2020

Codecov Report

Merging #868 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
.../java/com/google/longrunning/OperationsClient.java 73.33% <ø> (ø) 16 <0> (ø) ⬇️
...api/gax/grpc/InstantiatingGrpcChannelProvider.java 79.89% <ø> (ø) 35 <0> (ø) ⬇️
...a/com/google/api/gax/tracing/OpencensusTracer.java 87.5% <ø> (ø) 32 <0> (ø) ⬇️
...src/main/java/com/google/api/gax/rpc/Watchdog.java 80.34% <0%> (-0.17%) 11% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee90c2c...5f20fa9. Read the comment docs.

@suztomo
Copy link
Member Author

suztomo commented Feb 19, 2020

Travis builds succeeded.

Build with Java 8 ran googleFormatPlugin

> Task :verifyGoogleJavaFormat
> Task :verifyLicense
> Task :benchmark:verifyGoogleJavaFormat
> Task :benchmark:verifyLicense
> Task :gax:verifyGoogleJavaFormat
> Task :gax:verifyLicense
> Task :gax-bom:verifyGoogleJavaFormat NO-SOURCE
> Task :gax-bom:verifyLicense
> Task :gax-grpc:verifyGoogleJavaFormat
> Task :gax-grpc:verifyLicense
> Task :gax-httpjson:verifyGoogleJavaFormat

Build with Java 7 skips verifyGoogleJavaFormat.

> Task :verifyGoogleJavaFormat SKIPPED
> Task :verifyLicense
> Task :benchmark:verifyGoogleJavaFormat SKIPPED
> Task :benchmark:verifyLicense
> Task :gax:verifyGoogleJavaFormat SKIPPED
> Task :gax:verifyLicense
> Task :gax-bom:verifyGoogleJavaFormat SKIPPED
> Task :gax-bom:verifyLicense
> Task :gax-grpc:verifyGoogleJavaFormat SKIPPED
> Task :gax-grpc:verifyLicense
> Task :gax-httpjson:verifyGoogleJavaFormat SKIPPED

Copy link
Member Author

@suztomo suztomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rahulKQL PTAL.

@@ -40,6 +40,7 @@ googleJavaFormat {
exclude 'build/**'
exclude 'bazel*/**'
}
verifyGoogleJavaFormat.onlyIf { JavaVersion.current().isJava8Compatible() }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@rahulKQL
Copy link
Contributor

rahulKQL commented Feb 20, 2020

@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+"

@suztomo suztomo changed the title build: google format plugin upgrade build: google format plugin and jacoco upgrade Feb 20, 2020
* 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
@suztomo suztomo changed the title build: google format plugin and jacoco upgrade build: google format plugin upgrade Feb 20, 2020
@suztomo
Copy link
Member Author

suztomo commented Feb 20, 2020

@rahulKQL Jacoco upgrade was not trivial. Not including that in this PR for now.
https://source.cloud.google.com/results/invocations/e8c74bc9-fc2d-4047-82b8-3e2d5b9cdc64/targets/cloud-devrel%2Fclient-libraries%2Fjava%2Fgax-java%2Fpresubmit%2Fjava7/log

* 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

@suztomo
Copy link
Member Author

suztomo commented Feb 20, 2020

@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).

@chingor13 chingor13 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 24, 2020
@chingor13 chingor13 self-assigned this Feb 24, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 24, 2020
@kolea2 kolea2 merged commit 5440bc6 into googleapis:master Feb 26, 2020
@suztomo
Copy link
Member Author

suztomo commented Feb 26, 2020

@kolea2 @chingor13 Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants