-
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
feat(bazel): detach spring bazel rules #1065
feat(bazel): detach spring bazel rules #1065
Conversation
45e02fd
to
d89f03e
Compare
d89f03e
to
e37004f
Compare
Force pushed rebase on current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two quick notes below.
And a more general question for @blakeli0: about the resources jar processing portion in java_gapic_library
here that Diego did not bring into spring rule: It seems to me it's only needed for client library to be used in java_gapic_pkg.bzl
steps to produce a gapic-[package name]-java-resources.tar.gz
with a build.gradle
. IIUC that gradle file is not used in the post process of generating pom file, does it mean that all related logic can be potentially cleaned-up in gapic-generator itself in future?
grpc_service_config = None, | ||
gapic_yaml = None, | ||
service_yaml = None, | ||
**kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this is derived from _java_gapic_library()
in java_gapic.bzl
and you removed a couple of options. Can you double check if they don't affect sping-codegen for us?
E.g. I noticed transport
is removed, If I get it right, this is where transport is specified as grpc
or grpc+rest
or rest
, which get parsed in and eventually plays a part in #1078. Are we losing this info here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, we indeed need transport
to be specified! I'll double check the impact of the other options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the other option is rest_numeric_enums
, which is used by HttpJsonServiceStubClassComposer
to determine how to serialize enums (by number or value). I see that our spring composers do not mention enums, so it should be safe to remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is probably not in scope now, but once SpringCodeGen decide to support both grpc
and rest
, we need a way to pass the correct value to this Spring specific bazel rule, and currently the only source of truth is the Bazel files in googleapis.
The generated Gradle file are used by self-services client libraries(Ads, Geo etc.), so we are not going to remove them in the near term. However, we are trying to simplify the process by using the generator as a jar. |
808c778
to
767fee9
Compare
Co-authored-by: Emily Wang <emmwang@google.com>
SonarCloud Quality Gate failed. |
…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.
#1065) * chore: copy functionality from io.grpc.internal.SharedResourceHolder Included related classes and test file. Tests were adapted to use an easymock mock * fix: remove grpc-core from deps * fix: add used undeclared dependency jsr305 * fix: add copy explanation comments, remove `@ThreadSafe` and related dependency * Update google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/LogExceptionRunnable.java Co-authored-by: Mike Eltsufin <meltsufin@google.com> * Update google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/SharedResourceHolder.java Co-authored-by: Mike Eltsufin <meltsufin@google.com> * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Mike Eltsufin <meltsufin@google.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
This allows spring autoconfig generation to be called from a new rule "
java_gapic_spring_library
" that is independent fromjava_gapic_library
.NOTE: The following instructions are for local tests only. Definitive modifications in googleapis are mainly made from rules_gapic's BUILD file generator
For example, in
googleapis/google/cloud/vision/v1
, we can modifyBUILD.bzl
by adding:In
googleapis/repository_rules.bzl
we need to add a switch and enable spring rules fromgapic-generator-java/rules_java_gapic/java_gapic_spring.bzl
:Then build from
googleapis
:Which will generate the files: