Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ggj][codegen] fix: use serviceClient varname in ServiceClient codegen comments #445

Merged
merged 31 commits into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
90c4f38
fix: support non-name fields with res-refs in resname def parsing
miraleung Oct 27, 2020
a74be70
fix: add workaround for missing default_host and oauth_scopes annotation
miraleung Oct 27, 2020
aef9843
Merge branch 'master' of github.com:googleapis/gapic-generator-java i…
miraleung Oct 29, 2020
fdb1ffb
fix: clarify LRO parsing error messages
miraleung Oct 27, 2020
642c606
feat: support deeply-nested types in AST and proto message parsing
miraleung Oct 28, 2020
3e26d87
fix: prevent resname tokens from matching subcomponents
miraleung Oct 28, 2020
837da38
fix: use TypeParser for proto message parsing
miraleung Oct 28, 2020
a5fc332
fix: use generic types in field instantiation in ServiceClientTest
miraleung Oct 28, 2020
b71b786
fix: prevent descension into map types in nested message parsing
miraleung Oct 29, 2020
602e1df
fix: merge master
miraleung Oct 29, 2020
07dddb8
fix: use both map generics in ServiceClientTest codegen
miraleung Oct 29, 2020
5e95e8f
fix: dir structure of generated files
miraleung Oct 29, 2020
c37c2d0
test: add asset API gradle pkg rules
miraleung Oct 29, 2020
8a7196f
fix: remove unused dep
miraleung Oct 29, 2020
f7f8099
test: add logging integration target and goldens, consolidate rules
miraleung Oct 29, 2020
9e0ad39
fix: merge master
miraleung Oct 29, 2020
9df3a5b
fix: fix asset_java_gapic build
miraleung Oct 30, 2020
96f8676
fix: fix test src packaging, update integration goldens
miraleung Oct 30, 2020
a91a085
fix: pass all tokens to instansiate in resname 1-pattern case
miraleung Oct 30, 2020
19e0a98
fix: update goldens
miraleung Oct 30, 2020
2dfd4b1
fix: update goldens
miraleung Oct 30, 2020
5dae221
build: add all integration tests to pre-commit hook
miraleung Oct 30, 2020
6917a2b
build: run pre-commit when goldens have changed
miraleung Oct 30, 2020
1aaf0a5
build: add integration golden tests to CircleCI
miraleung Oct 30, 2020
0ba9f53
fix: preserve newlines and parse itemized lists in protobuf comments
miraleung Oct 30, 2020
2b1b8d1
fix: remove extraneous escaper
miraleung Oct 30, 2020
c279667
Merge branch 'master' into alpha/g19
miraleung Oct 30, 2020
ceadd4e
Merge branch 'alpha/g19' of github.com:googleapis/gapic-generator-jav…
miraleung Oct 30, 2020
17893de
fix: update integration goldens for ServiceClient comment names
miraleung Oct 30, 2020
e75e828
fix: use serviceClient varname in ServiceClient codegen comments
miraleung Oct 30, 2020
1380ce9
Merge branch 'master' into alpha/g21
miraleung Oct 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,21 @@ then
fi
fi

# Check integration tests.
if [ $NUM_JAVA_FILES_CHANGED -gt 0 ] \
|| [ $NUM_INTEGRATION_GOLDEN_FILES_CHANGED -gt 0 ] \
|| [ $NUM_INTEGRATION_BAZEL_FILES_CHANGED -gt 0 ]
then
echo_status "Checking integration tests..."
bazel --batch test --disk_cache="$BAZEL_CACHE_DIR" //test/integration/...
TEST_STATUS=$?
if [ $TEST_STATUS != 0 ]
then
echo_error "Tests failed." "Please fix them and try again."
exit 1
fi
fi

# Check and fix Bazel format.
if [ $NUM_BAZEL_FILES_CHANGED -gt 0 ]
then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ class ServiceClientCommentComposer {
private static final String SERVICE_DESCRIPTION_INTRO_STRING =
"This class provides the ability to make remote calls to the backing service through method "
+ "calls that map to API methods. Sample code to get started:";
private static final String SERVICE_DESCRIPTION_CLOSE_STRING =
"Note: close() needs to be called on the echoClient object to clean up resources such as "
+ "threads. In the example above, try-with-resources is used, which automatically calls "
+ "close().";
private static final String SERVICE_DESCRIPTION_SURFACE_SUMMARY_STRING =
"The surface of this class includes several types of Java methods for each of the API's "
+ "methods:";
Expand Down Expand Up @@ -77,6 +73,11 @@ class ServiceClientCommentComposer {
"Constructs an instance of %sClient, using the given stub for making calls. This is for"
+ " advanced usage - prefer using create(%s).";

private static final String SERVICE_DESCRIPTION_CLOSE_PATTERN =
"Note: close() needs to be called on the %sClient object to clean up resources such as "
+ "threads. In the example above, try-with-resources is used, which automatically calls "
+ "close().";

private static final String SERVICE_DESCRIPTION_CUSTOMIZE_SUMMARY_PATTERN =
"This class can be customized by passing in a custom instance of %s to create(). For"
+ " example:";
Expand Down Expand Up @@ -117,7 +118,9 @@ static List<CommentStatement> createClassHeaderComments(Service service) {
// TODO(summerji): Add sample code here.

// API surface description.
classHeaderJavadocBuilder.addParagraph(SERVICE_DESCRIPTION_CLOSE_STRING);
classHeaderJavadocBuilder.addParagraph(
String.format(
SERVICE_DESCRIPTION_CLOSE_PATTERN, JavaStyle.toLowerCamelCase(service.name())));
classHeaderJavadocBuilder.addParagraph(SERVICE_DESCRIPTION_SURFACE_SUMMARY_STRING);
classHeaderJavadocBuilder.addOrderedList(SERVICE_DESCRIPTION_SURFACE_DESCRIPTION);
classHeaderJavadocBuilder.addParagraph(SERVICE_DESCRIPTION_SURFACE_CODA_STRING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import javax.annotation.Generated;
* This class provides the ability to make remote calls to the backing service through method calls
* that map to API methods. Sample code to get started:
*
* <p>Note: close() needs to be called on the echoClient object to clean up resources such as
* <p>Note: close() needs to be called on the identityClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
*
* <p>The surface of this class includes several types of Java methods for each of the API's
Expand Down
4 changes: 2 additions & 2 deletions test/integration/goldens/asset/AssetServiceClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <p>Note: close() needs to be called on the echoClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
* <p>Note: close() needs to be called on the assetServiceClient object to clean up resources such
* as threads. In the example above, try-with-resources is used, which automatically calls close().
*
* <p>The surface of this class includes several types of Java methods for each of the API's
* methods:
Expand Down
5 changes: 3 additions & 2 deletions test/integration/goldens/logging/ConfigServiceV2Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <p>Note: close() needs to be called on the echoClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
* <p>Note: close() needs to be called on the configServiceV2Client object to clean up resources
* such as threads. In the example above, try-with-resources is used, which automatically calls
* close().
*
* <p>The surface of this class includes several types of Java methods for each of the API's
* methods:
Expand Down
5 changes: 3 additions & 2 deletions test/integration/goldens/logging/LoggingServiceV2Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <p>Note: close() needs to be called on the echoClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
* <p>Note: close() needs to be called on the loggingServiceV2Client object to clean up resources
* such as threads. In the example above, try-with-resources is used, which automatically calls
* close().
*
* <p>The surface of this class includes several types of Java methods for each of the API's
* methods:
Expand Down
5 changes: 3 additions & 2 deletions test/integration/goldens/logging/MetricsServiceV2Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <p>Note: close() needs to be called on the echoClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
* <p>Note: close() needs to be called on the metricsServiceV2Client object to clean up resources
* such as threads. In the example above, try-with-resources is used, which automatically calls
* close().
*
* <p>The surface of this class includes several types of Java methods for each of the API's
* methods:
Expand Down
2 changes: 1 addition & 1 deletion test/integration/goldens/redis/CloudRedisClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <p>Note: close() needs to be called on the echoClient object to clean up resources such as
* <p>Note: close() needs to be called on the cloudRedisClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
*
* <p>The surface of this class includes several types of Java methods for each of the API's
Expand Down