GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat: gapic-generator-java to perform a no-op when no services are detected by diegomarquezp · Pull Request #2460 · googleapis/sdk-platform-java
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
Conversation
|
|
Throwing an exception and catch it just to perform no-op and/or logging is not a good practice. It would be better if we can do the same thing gracefully. For example, can we remove this check, log the scenario, and return an empty |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
… into gapic-generator-no-service-noop
There was an error while loading. Please reload this page.
|
From https://github.com/googleapis/sdk-platform-java/actions/runs/8150253915/job/22276206879?pr=2460 I confirmed they pass locally. Not sure how to prove it in a PR that updates both the generator and the hermetic build scripts Reason: the hermetic build IT uses a published GGJ instead of compiling its own EDIT: I decided to move all |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
That sounds good. I modified |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| .build(); | ||
| private List<Sample> ListofSamples = Arrays.asList(new Sample[] {sample}); | ||
|
|
||
| @Before |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could you change this tag to @BeforeEach?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| @Test | ||
| void gapicClass_addApacheLicense() { | ||
| public void gapicClass_addApacheLicense_validInput_succeeds() { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could you remove the public in the signature?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| Preconditions.checkState(!services.isEmpty(), "No services found to generate"); | ||
| if (services.isEmpty()) { | ||
| LOGGER.warning("No services found to generate. This will produce an empty zip file"); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
qq, is this still correct? If
if (response != EMPTY_RESPONSE) {
response.writeTo(System.out);
}
doesn't write anything to System.out does it generate a zip file?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It's not correct anymore. I corrected the log entry. Thanks for the catch.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // package info may come as null if we have no services, but we will exit | ||
| // this function early if so. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
qq, is this also still true? I don't see writePackageInfo() exiting early.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Not true anymore either. I removed the comment.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| @Test | ||
| public void testEmptyGapicContext_doesNotThrow() { | ||
| Composer.composeServiceClasses(GapicContext.EMPTY); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
nit: Can this be something like assert empty list or assert null instead?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| GapicContext result = Parser.parse(CodeGeneratorRequest.newBuilder().build()); | ||
| assertFalse(result.containsServices()); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
nit: to match the test method, can this be assert that the result == GapicContext.Empty?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM, added a few nits regarding the comments and tests
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
🤖 I have created a release *beep* *boop* --- <details><summary>2.42.0</summary> ## [2.42.0](v2.41.0...v2.42.0) (2024-06-25) ### Features * Allow Adding Client Level Attributes to MetricsTracerFactory ([#2614](#2614)) ([f122c6f](f122c6f)) * gapic-generator-java to perform a no-op when no services are detected ([#2460](#2460)) ([c0b5646](c0b5646)) * Make Layout Parser generally available in V1 ([e508ae6](e508ae6)) * populate `.repo-metadata.json` from highest version ([#2890](#2890)) ([f587541](f587541)) * push SNAPSHOT versions of the hermetic build docker image ([#2888](#2888)) ([81df866](81df866)) ### Bug Fixes * **deps:** update the Java code generator (gapic-generator-java) to 1.2.3 ([e508ae6](e508ae6)) * Expose Gax meter name ([#2865](#2865)) ([6c5d6ce](6c5d6ce)) * Move the logic of getting systemProductName from static block to static method ([#2874](#2874)) ([536f1eb](536f1eb)) * Update default Otel Attribute from method_name to method ([#2833](#2833)) ([af10a9e](af10a9e)) ### Dependencies * update dependency com.google.auto.value:auto-value to v1.11.0 ([#2842](#2842)) ([dd27fdf](dd27fdf)) * update dependency com.google.auto.value:auto-value-annotations to v1.11.0 ([#2843](#2843)) ([bf8e67f](bf8e67f)) * update dependency com.google.cloud:grpc-gcp to v1.6.1 ([#2943](#2943)) ([9f16b40](9f16b40)) * update dependency org.checkerframework:checker-qual to v3.44.0 ([#2848](#2848)) ([7a99c50](7a99c50)) * update dependency org.easymock:easymock to v5.3.0 ([#2871](#2871)) ([c243f7d](c243f7d)) * update google api dependencies ([#2846](#2846)) ([b5ef698](b5ef698)) * update googleapis/java-cloud-bom digest to 17cc5ec ([#2882](#2882)) ([d6abd8e](d6abd8e)) * update netty dependencies to v4.1.111.final ([#2877](#2877)) ([b5f10b9](b5f10b9)) * update opentelemetry-java monorepo to v1.39.0 ([#2863](#2863)) ([9d1f3a8](9d1f3a8)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Joe Wang <[email protected]>
fixes #2750 Skip parsing a service if no RPCs found for. In the scenario that only one service with no RPCs or all services have no RPCs, falls back to #2460 This pr also reverts a change brought by #985, and removes the relevant tests. For more context, this has been discussed [here](#2750 (comment)). --------- Co-authored-by: Lawrence Qiu <[email protected]>
🤖 I have created a release *beep* *boop* --- <details><summary>2.42.0</summary> ## [2.42.0](googleapis/sdk-platform-java@v2.41.0...v2.42.0) (2024-06-25) ### Features * Allow Adding Client Level Attributes to MetricsTracerFactory ([#2614](googleapis/sdk-platform-java#2614)) ([e254528](googleapis/sdk-platform-java@e254528)) * gapic-generator-java to perform a no-op when no services are detected ([#2460](googleapis/sdk-platform-java#2460)) ([1612391](googleapis/sdk-platform-java@1612391)) * Make Layout Parser generally available in V1 ([30acafa](googleapis/sdk-platform-java@30acafa)) * populate `.repo-metadata.json` from highest version ([#2890](googleapis/sdk-platform-java#2890)) ([3bca9a4](googleapis/sdk-platform-java@3bca9a4)) * push SNAPSHOT versions of the hermetic build docker image ([#2888](googleapis/sdk-platform-java#2888)) ([8bc060b](googleapis/sdk-platform-java@8bc060b)) ### Bug Fixes * **deps:** update the Java code generator (gapic-generator-java) to 1.2.3 ([30acafa](googleapis/sdk-platform-java@30acafa)) * Expose Gax meter name ([#2865](googleapis/sdk-platform-java#2865)) ([2095f4a](googleapis/sdk-platform-java@2095f4a)) * Move the logic of getting systemProductName from static block to static method ([#2874](googleapis/sdk-platform-java#2874)) ([cf67770](googleapis/sdk-platform-java@cf67770)) * Update default Otel Attribute from method_name to method ([#2833](googleapis/sdk-platform-java#2833)) ([a88fdde](googleapis/sdk-platform-java@a88fdde)) ### Dependencies * update dependency com.google.auto.value:auto-value to v1.11.0 ([#2842](googleapis/sdk-platform-java#2842)) ([758bd17](googleapis/sdk-platform-java@758bd17)) * update dependency com.google.auto.value:auto-value-annotations to v1.11.0 ([#2843](googleapis/sdk-platform-java#2843)) ([bce5720](googleapis/sdk-platform-java@bce5720)) * update dependency com.google.cloud:grpc-gcp to v1.6.1 ([#2943](googleapis/sdk-platform-java#2943)) ([cfc6632](googleapis/sdk-platform-java@cfc6632)) * update dependency org.checkerframework:checker-qual to v3.44.0 ([#2848](googleapis/sdk-platform-java#2848)) ([7069aae](googleapis/sdk-platform-java@7069aae)) * update dependency org.easymock:easymock to v5.3.0 ([#2871](googleapis/sdk-platform-java#2871)) ([423167f](googleapis/sdk-platform-java@423167f)) * update google api dependencies ([#2846](googleapis/sdk-platform-java#2846)) ([a3d852e](googleapis/sdk-platform-java@a3d852e)) * update googleapis/java-cloud-bom digest to 17cc5ec ([#2882](googleapis/sdk-platform-java#2882)) ([09e4ea6](googleapis/sdk-platform-java@09e4ea6)) * update netty dependencies to v4.1.111.final ([#2877](googleapis/sdk-platform-java#2877)) ([6430ac2](googleapis/sdk-platform-java@6430ac2)) * update opentelemetry-java monorepo to v1.39.0 ([#2863](googleapis/sdk-platform-java#2863)) ([b0f2946](googleapis/sdk-platform-java@b0f2946)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Joe Wang <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
gapic-generator-java exits withIllegalStateException when there's no service in protos
There was an error while loading. Please reload this page.