-
Notifications
You must be signed in to change notification settings - Fork 53
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
[DRAFT] - Code to generate spring autoconfig modules. (not intended to merge) #1030
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ode needs cleanup.
…oud-[name]-[v]-java/spring/src/main/...
…trySettingsComposer to help generate declare,getter,setters for retrysettings in properties. Other WIP changes in AutoConfig.
…adding todo notes as reminder to revisit.
…ending to do after annotation feature in.
dangazineu
reviewed
Sep 1, 2022
src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java
Outdated
Show resolved
Hide resolved
…tatic types instead of vapor references (#1046) Adding Spring related dependencies to build files and use static types instead of vapor references. Benefit of this change: - easier to test - less code change needed for future changes (e.g. package change of classes). One caveat is that because `gapic-generator-java` is brought into `googleapis` as `http_archive` code addition to `googleapis` is also needed to include these libraries. Add below code snippet to [WORKSPACE](https://github.com/googleapis/googleapis/blob/38e8b447d173909d3b2fe8fdc3e6cbb3c85442fd/WORKSPACE#L239-L245): ``` SPRING_MAVEN_ARTIFACTS = [ "org.springframework.boot:spring-boot-starter:2.7.4", "com.google.cloud:spring-cloud-gcp-core:3.3.0", ] maven_install( artifacts = PROTOBUF_MAVEN_ARTIFACTS + SPRING_MAVEN_ARTIFACTS, generate_compat_repositories = True, repositories = [ "https://repo.maven.apache.org/maven2/", ], ) ``` ------------ Updates: - Updated pr with #1065, - Moved annotation classed added in #1045 to static types. - Fixed conflicts from merged changes in #1093 - Moved logging classes added in #1053 to static types.
- `{{starter-version}}` are not needed anymore as we inherit version from parent pom. - add parent version placeholder. Changes on spring-cloud-gcp side: GoogleCloudPlatform/spring-cloud-gcp#1353. - remove redundant groupid. - remove versions for `spring-cloud-gcp-core` and `spring-boot-starter`, specified in `genereated-parent` pom
* fix(spring codegen): use client-library-artifact-id as pom artifactId prefix. (#1092) * rename to global properties * fix(test): update goldens * fix: format * fix: typo in GLobalProperties * fix: typo in goldens * fix: remove unnecessary comments * fix: reference to com.google.cloud.spring.global * fix: typo and static ref fix Co-authored-by: Min Zhu <zhumin@google.com>
SonarCloud Quality Gate failed. |
) This is the last item missed in #1099.
* feat: degrade logging level to trace * feat: wrap logging with `isTraceEnabled()` * feat: credential usage logging * fix: use Statement for logging variables * fix: use Statement return type in createLoggerStatement() * fix: unnecessary variable creation
change `@Generated` description to spring specific and separate from "gapic-generator-java" for client libraries. Also moved relevant annotation from `SpringPackageInfoComposer` to `SpringComposer`.
This change intend to set the auto-configuration to be enabled by default.
* feat: spring service settings as its own bean * chore: update goldens * fix: rename settings creation method * fix: remove name parameter from conditional bean annotation * fix: common service settings method name and unnecessary comment
…1123) As discussed off-line, instead of depending on a new `global-properties` module, use `CredentialsProvider` bean from `spring-cloud-gcp-autoconfigure` instead. - Replace dependency from `core` to `autoconfigure` module. - Revert #1071 and implement changes shown in [poc](zhumin8/language_poc1#7) - Minor code cleanups and util method extracted from `SpringPropertiesClassComposer.java`. Note: #1071 and GoogleCloudPlatform/spring-cloud-gcp#1308 will be obsolete after this change. Also, conflicts needs to be resolved between this pr and #1110 depending on merging order.
…ed properties (#1143) * This PR refactors the current setup (method-level and individual settings) to use a nested Retry object provided through properties at both service-level and method-level.
This is part 2 of implementation for repo structural changes in [PoC](GoogleCloudPlatform/spring-cloud-gcp#1383). Changes in Pom string: - changed parent to `spring-cloud-gcp-starters` and version with "-preview" suffix - removed client library version (should inherit from Libraries BOM). Corresponding changes in spring-cloud-gcp: GoogleCloudPlatform/spring-cloud-gcp#1394
Task derived from GoogleCloudPlatform/spring-cloud-gcp#1355 (comment). Removing `spring.auto` from properties prefix.
Add name to `@ConditionalOnMissingBean` annotation when creating `TransportChannelProvider` bean so that it can be picked up with Qualifier in serviceSettings bean creation that follows. This was missed in original [commit](0643085) adding this bean and should fix error seen in GoogleCloudPlatform/spring-cloud-gcp#1407 (comment)
#1209) Addressing: #1110 (comment) This was leftover from changes made in #1110
This adds AutoConfigureAfter(GcpContextAutoConfiguration.class) annotation to enforce configuration order. It also makes two related changes to enable this annotation: * Switches dependency from spring-cloud-gcp-core to spring-cloud-gcp-autoconfigure, and bumps version to latest * Fixes ImportWriter to account for types introduced by annotation parameters
* This PR is a patch for the RetrySettings configuration issue discovered in GoogleCloudPlatform/spring-cloud-gcp#1407. It excludes streaming and LRO methods from retry configuration through spring properties for now.
Adds `@param` and `@return` to method javadoc comments in generated autoconfiguration classes. Also adding a change to `JavaDocComment` to enable `@return` in comment. (this change in 537e33c can be copied to main branch of `gapic-generator-java` if useful.)
…rt option (#1227) * Updated behaviour for when Transport.REST_GRPC and useRest = true (through properties): * The ServiceSettings bean uses newHttpJsonBuilder * The TransportChannelProvider bean definition returns defaultHttpJsonTransportProviderBuilder
* This PR switches camelcase handling to use align with logic used in generating client libraries.
This enables release-please setup in spring-cloud-gcp to update version as needed.
* use ClassNames util to generate client and settings class names in comments * update settings bean comment, and remove other usages of service.name()
…pported methods (#1343)
…golden tests (#1348) This PR is a follow-up on #1343: - Extends fix to SpringPropertiesClassComposer, so that for services without REST-enabled rpcs, the unused useRest property is also not generated - Adds golden tests for the updated hasRestOption scenario using the wicked proto - Updates SpringAutoconfigCommentComposer for javadoc comments alluding to the useRest option
Please reopen if you need this pull request. |
suztomo
pushed a commit
that referenced
this pull request
Mar 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a WIP pr for discussion.
Code is incomplete but with major skeleton done.
src/spring/composer
Writer.java
is to generatespring.factories
file (as in sample here).Will consider extendingCreate a copy as it contains mostly static methods.Write.java
instead.Main.java
is the entry point to use gapic-gen under current infra.java_gapic.bzl
andjava_gapic_pkg.bzl
changes mimics how sample is generated, and adds aspring
top level folder to final output tar.To do items:
SpringAutoConfigClassComposer.java
.RetrySettingsComposer.java
Writer.java
.java_gapic.bzl
andjava_gapic_pkg.bzl
additions.A manual sample repo of intended output is here.
From in-person review takeaway points:
Main.class
changes.