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
9 changes: 8 additions & 1 deletion build.gradle
Expand Up @@ -15,7 +15,7 @@ buildscript {
"io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.8.0",
"gradle.plugin.com.dorongold.plugins:task-tree:1.3.1"

classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.6"
classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.8"
}
}

Expand All @@ -40,6 +40,8 @@ googleJavaFormat {
exclude 'build/**'
exclude 'bazel*/**'
}
// google-java-format-gradle-plugin:0.8 does not work with Java 1.7.
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


if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword') &&
!nonReleaseProjects.contains(project.name)) {
Expand All @@ -53,10 +55,15 @@ 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

}

// Formatting tasks
// ================
apply plugin: 'com.github.sherter.google-java-format'
test.dependsOn verifyGoogleJavaFormat
verifyGoogleJavaFormat.onlyIf { JavaVersion.current().isJava8Compatible() }

task verifyLicense {
doLast {
Expand Down
Expand Up @@ -249,7 +249,8 @@ private ManagedChannel createSingleChannel() throws IOException {

// When channel pooling is enabled, force the pick_first grpclb strategy.
// This is necessary to avoid the multiplicative effect of creating channel pool with
// `poolSize` number of `ManagedChannel`s, each with a `subSetting` number of number of subchannels.
// `poolSize` number of `ManagedChannel`s, each with a `subSetting` number of number of
// subchannels.
// See the service config proto definition for more details:
// https://github.com/grpc/grpc-proto/blob/master/grpc/service_config/service_config.proto#L182
ImmutableMap<String, Object> pickFirstStrategy =
Expand Down
Expand Up @@ -551,7 +551,10 @@ public boolean awaitTermination(long duration, TimeUnit unit) throws Interrupted

public static class ListOperationsPagedResponse
extends AbstractPagedListResponse<
ListOperationsRequest, ListOperationsResponse, Operation, ListOperationsPage,
ListOperationsRequest,
ListOperationsResponse,
Operation,
ListOperationsPage,
ListOperationsFixedSizeCollection> {

public static ApiFuture<ListOperationsPagedResponse> createAsync(
Expand Down Expand Up @@ -606,7 +609,10 @@ public ApiFuture<ListOperationsPage> createPageAsync(

public static class ListOperationsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListOperationsRequest, ListOperationsResponse, Operation, ListOperationsPage,
ListOperationsRequest,
ListOperationsResponse,
Operation,
ListOperationsPage,
ListOperationsFixedSizeCollection> {

private ListOperationsFixedSizeCollection(List<ListOperationsPage> pages, int collectionSize) {
Expand Down
Expand Up @@ -166,7 +166,8 @@ public Object answer(InvocationOnMock invocation) {
final ManagedChannel refreshingManagedChannel =
new RefreshingManagedChannel(channelFactory, scheduledExecutorService);

// send a bunch of request to RefreshingManagedChannel, executor needs more than 1 thread to test out concurrency
// send a bunch of request to RefreshingManagedChannel, executor needs more than 1 thread to
// test out concurrency
ExecutorService executor = Executors.newFixedThreadPool(10);

// channelCount - 1 because the last channel cannot be refreshed because the FakeChannelFactory
Expand Down
11 changes: 0 additions & 11 deletions gax/src/main/java/com/google/api/gax/tracing/OpencensusTracer.java
Expand Up @@ -90,7 +90,6 @@
* <dt>{@code connection}
* <dd>The UUID of the connection which the attempt was sent.
* </dl>
*
* <li>{@code Attempt failed, scheduling next attempt} with the following attributes:
* <dl>
* <dt>{@code attempt}
Expand All @@ -108,7 +107,6 @@
* <dt>{@code connection}
* <dd>The UUID of the connection which the attempt was sent.
* </dl>
*
* <li>{@code Attempts exhausted} with the following attributes:
* <dl>
* <dt>{@code attempt}
Expand All @@ -124,7 +122,6 @@
* <dt>{@code connection}
* <dd>The UUID of the connection which the attempt was sent.
* </dl>
*
* <li>{@code Attempt failed, error not retryable} with the following attributes:
* <dl>
* <dt>{@code attempt}
Expand All @@ -140,7 +137,6 @@
* <dt>{@code connection}
* <dd>The UUID of the connection which the attempt was sent.
* </dl>
*
* <li>{@code Attempt succeeded} with the following attributes:
* <dl>
* <dt>{@code attempt}
Expand All @@ -154,7 +150,6 @@
* <dt>{@code connection}
* <dd>The UUID of the connection which the attempt was sent.
* </dl>
*
* </ul>
*
* <p>Long running operations, which are composed of an initial RPC to start the operation and a
Expand All @@ -168,14 +163,12 @@
* <dt>{@code status}
* <dd>The status code of why the operation failed to start
* </dl>
*
* <li>{@code Polling was cancelled} with the following attributes:
* <dl>
* <dt>{@code attempt}
* <dd>Zero based sequential poll number.
* <dt>{@code attempt request count}
* </dl>
*
* <li>{@code Scheduling next poll} with the following attributes:
* <dl>
* <dt>{@code attempt}
Expand All @@ -185,29 +178,25 @@
* <dt>{@code delay}
* <dd>The number of milliseconds to wait before polling again
* </dl>
*
* <li>{@code Polling attempts exhausted} with the following attributes:
* <dl>
* <dt>{@code attempt}
* <dd>Zero based sequential poll number
* <dt>{@code status}
* <dd>OK if the poll succeeded, but the operation is still running.
* </dl>
*
* <li>{@code Polling failed} with the following attributes:
* <dl>
* <dt>{@code attempt}
* <dd>Zero based sequential poll number
* <dt>{@code status}
* <dd>OK if the poll succeeded, but the operation is still running.
* </dl>
*
* <li>{@code Polling completed} with the following attributes:
* <dl>
* <dt>{@code attempt}
* <dd>Zero based sequential poll number
* </dl>
*
* </ul>
*
* <p>The toplevel long running operation span will also contain child spans to describe the retry
Expand Down