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

[DRAFT] - Code to generate spring autoconfig modules. (not intended to merge) #1030

Closed
wants to merge 107 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
ced6302
add ClassComposer to generate spring bean.
zhumin8 Mar 30, 2022
be4814a
add composer on top of class composer.
zhumin8 Mar 30, 2022
96288f2
add to generator and adding comments.
zhumin8 Mar 30, 2022
558f2c5
add conditionOnClass annotation, parameter not set yet.
zhumin8 Apr 12, 2022
c2dfbe0
update name for packaga and class produced.
zhumin8 Apr 13, 2022
fce0945
producing [name]_java_gapic_srcjar-spring.srcjar.
zhumin8 Jun 27, 2022
7051858
adding spring content to produced google-cloud-[name]-v1-java.tar.gz.
zhumin8 Jun 29, 2022
f9199fd
added private member and constructor to spring autoconfig composer. c…
zhumin8 Jun 30, 2022
8ba06f8
Merge branch 'main' into autoconfig-gen-draft2
zhumin8 Jul 11, 2022
fbdc282
use new lambdaExpr infer type feature.
zhumin8 Jul 11, 2022
7390d7a
adding writing spring.factories. also adjust output path to google-cl…
zhumin8 Jul 11, 2022
b937bb1
added RETRY_PARAM_DEFINITIONS map to generated code.
zhumin8 Aug 9, 2022
cc14a8c
added SpringPropertiesClassComposer and test. Added util method to Re…
zhumin8 Aug 23, 2022
5882774
added class annotation and interface to SpringProperties class. Also …
zhumin8 Aug 23, 2022
05befeb
come code cleanups and added 2 more needed class annotations.- with p…
zhumin8 Aug 24, 2022
1d16132
comment out not needed code for constructor.
zhumin8 Aug 24, 2022
25f7bb8
create CredentialsProvider Bean method.
zhumin8 Aug 24, 2022
0643085
create TransportChannelProvider Bean.
zhumin8 Aug 24, 2022
697d89c
building service client bean. Basic settings.
zhumin8 Aug 25, 2022
71b66e6
added 2 if statements and todo comments to service client bean.
zhumin8 Aug 25, 2022
7b67cfd
adding if statements to client bean creation.
zhumin8 Aug 26, 2022
37e5cfa
minor cleanup edits.
zhumin8 Aug 26, 2022
53400f6
move added spring composers to new package.
zhumin8 Aug 26, 2022
906f9bf
add expected generated property class to test.
zhumin8 Aug 30, 2022
a571639
cleanup unused code in test.:
zhumin8 Aug 30, 2022
25716ef
move additional code out of gapic RetrySettingsComposer.
zhumin8 Aug 30, 2022
f4aa900
separate out spring generator.
zhumin8 Aug 30, 2022
a45fd18
back out changes to protowriter/Writer and creat a copy for Spring code.
zhumin8 Aug 30, 2022
899a4a7
some cleanups: remove unused code, add comment reminder.
zhumin8 Aug 31, 2022
ee62131
Add let writer produce additional-spring-configuration-metadata.json.…
zhumin8 Sep 6, 2022
fe5baf1
fix spring.factories package name. fix transport condition to gen spr…
zhumin8 Sep 7, 2022
de183ed
messy wip. adding retry settings with null check to autoconfig.
zhumin8 Sep 7, 2022
db5af15
complete retry settings in autoconfig and changes in properties. clea…
zhumin8 Sep 7, 2022
63ec5d3
minor change: move generated metadate and package.info under spring f…
zhumin8 Sep 9, 2022
37be29c
back out unrelated change in RetrySettingsComposer.
zhumin8 Sep 9, 2022
bd1f309
Merge branch 'main' into autoconfig-gen-draft2
zhumin8 Sep 9, 2022
b0e2908
fix: getter/setters double to Double.
zhumin8 Sep 9, 2022
ada6e92
fix(Spring CodeGen): switch to Spring boot 2.7 style in registering a…
zhumin8 Oct 3, 2022
3cd3419
fix: Cleanups on code (#1054)
zhumin8 Oct 4, 2022
9f44215
fix(Spring CodeGen): Update missing and placeholder annotations (#1045)
emmileaf Oct 4, 2022
8de6c5c
fix(Spring CodeGen): Use service-specific CredentialsProvider in anno…
emmileaf Oct 7, 2022
2b11de7
test(Spring CodeGen): Set up golden file tests for spring class compo…
emmileaf Oct 11, 2022
07dfa79
fix(Spring CodeGen): Update and move naming-related logic into utils …
emmileaf Oct 18, 2022
1818d0b
feat(log): added log statements to gend autocfg (#1053)
diegomarquezp Oct 22, 2022
c45ec23
feat(Spring CodeGen): Add customized spring composer for package info…
emmileaf Oct 24, 2022
c51d51b
feat(Spring CodeGen): write pom.xml with SpringWriter. (#1057)
zhumin8 Oct 26, 2022
cb83057
test(spring): add tests for content-building methods in SpringWriter …
emmileaf Nov 2, 2022
0019265
feat(SpringGen): adding extra annotations at the `SpringComposer` ste…
zhumin8 Nov 2, 2022
e754a7c
fix(deps): update dependency org.yaml:snakeyaml to v1.32 (#1037)
renovate-bot Sep 13, 2022
dba69f4
fix(deps): update dependency com.google.cloud:google-cloud-shared-dep…
renovate-bot Sep 15, 2022
ce93705
chore(deps): update dependency org.apache.maven.plugins:maven-shade-p…
renovate-bot Sep 20, 2022
d615305
fix(deps): update dependency org.yaml:snakeyaml to v1.33 (#1043)
renovate-bot Sep 26, 2022
e58bf9d
fix(deps): update dependency com.google.cloud:google-cloud-shared-dep…
renovate-bot Oct 3, 2022
4b5eadb
fix: Get numeric value for Enum fields if it is configured as query p…
blakeli0 Oct 3, 2022
bd5599f
chore(deps): update dependency com.google.auto.value:auto-value to v1…
renovate-bot Oct 10, 2022
eb94f30
fix: update sample region tag to parse host instead of proto package …
alicejli Oct 13, 2022
c768691
deps: Upgrade protobuf to 3.21.7 (#1048)
blakeli0 Oct 20, 2022
3282e0f
chore(main): release 2.10.1 (#1036)
release-please[bot] Oct 20, 2022
38010fd
fix: update regionTag to use service name (#1047)
alicejli Oct 24, 2022
aa1782d
fix(deps): update dependency com.google.cloud:google-cloud-shared-dep…
renovate-bot Oct 24, 2022
e8ee82f
chore(main): release 2.10.2 (#1067)
release-please[bot] Oct 24, 2022
6774245
chore(deps): update dependency org.apache.maven.plugins:maven-shade-p…
renovate-bot Oct 28, 2022
2ebe948
refactor: expose parsed api short name and version as fields in Servi…
emmileaf Oct 31, 2022
5346eef
fix: fix REST transport client creation generated javadoc sample (#1077)
vam-google Nov 1, 2022
cd35be8
fix: fixes regionTag breakage (#1068)
alicejli Nov 1, 2022
63b9bce
chore(main): release 2.10.3 (#1079)
release-please[bot] Nov 2, 2022
9e4721f
fix(ast): add import generation for annotations on VariableExpr (#1076)
emmileaf Nov 3, 2022
0bbfc59
test: update golden files after annotations import fix
emmileaf Nov 3, 2022
a8dfd80
fix: Revert "chore: merge main into autoconfig-gen-draft2" (#1083)
emmileaf Nov 3, 2022
6b462cd
Merge branch 'main' into autoconfig-gen-draft2
emmileaf Nov 3, 2022
9c8c638
test: update golden files after merging annotations import fix from main
emmileaf Nov 3, 2022
38459cc
feat(comment): autoconfig gen draft2 javadoc2 (#1060)
diegomarquezp Nov 3, 2022
4544c72
Merge branch 'main' into autoconfig-gen-draft2
diegomarquezp Nov 7, 2022
5fb9091
fix(Spring CodeGen): To only include options to set to rest transport…
zhumin8 Nov 7, 2022
5f637cc
fix(spring): use parsed api shortname as libname (#1084)
emmileaf Nov 9, 2022
86fd9dd
fix(Spring CodeGen): Add user-agent header to generated client for me…
zhumin8 Nov 10, 2022
c79dab2
fix(spring codegen): use client-library-artifact-id as pom artifactId…
zhumin8 Nov 14, 2022
b873b60
fix(spring): update setters for properties of type Duration (#1093)
emmileaf Nov 16, 2022
f877870
feat(bazel): detach spring bazel rules (#1065)
diegomarquezp Nov 16, 2022
0f7d580
fix(spring): add parent and remove maven-jar-plugin from pom string. …
zhumin8 Nov 17, 2022
13290c2
fix(spring): eliminate raw-types and remove unnecessary cast (#1095)
burkedavison Nov 18, 2022
d5d626a
fix(spring): fix and refactor class names for autoconfiguration and p…
emmileaf Nov 18, 2022
ed4b39e
fix(Spring CodeGen): Add Spring dependencies to build files and use s…
zhumin8 Nov 21, 2022
8625e7c
fix(spring): fix write pom placeholders. (#1099)
zhumin8 Nov 23, 2022
8755403
feat(spring): use shared configuration (#1071)
diegomarquezp Nov 24, 2022
cc068c9
fix(spring): remove dependency versions that should be inherited. (#1…
zhumin8 Dec 1, 2022
dbb105e
feat: set logging level to trace (#1104)
diegomarquezp Dec 1, 2022
59ecb5b
fix(spring): change @Generated description to spring specific. (#1103)
zhumin8 Dec 1, 2022
9fc2a5c
fix(spring): set autoconfig to be enabled by default. (#1107)
zhumin8 Dec 2, 2022
405e361
feat: service settings as a bean (#1110)
diegomarquezp Dec 14, 2022
92e3bfa
fix(spring): Replace global properties with CredentialsProvider bean …
zhumin8 Dec 16, 2022
63291e0
build(spring): update spring branch with Bazel CI fix from main (#1164)
emmileaf Dec 20, 2022
d0b45cc
fix(spring): refactor retry settings to service and method-level nest…
emmileaf Dec 20, 2022
cb08241
changed parent and version, removed client library version. (#1141)
zhumin8 Dec 21, 2022
7f550b5
fix(spring): add javadoc comments for properties (#1171)
emmileaf Dec 21, 2022
79a288f
fix: remove spring.auto from property prefix. (#1176)
zhumin8 Dec 22, 2022
52cf4a8
fix: add name to ConditionalOnMissingBean when creating bean (#1207)
zhumin8 Jan 4, 2023
62153dc
fix(spring): Separate out client settings bean and client bean commen…
zhumin8 Jan 4, 2023
9b7336d
fix(spring): add AutoConfigureAfter annotation (#1208)
emmileaf Jan 6, 2023
bfef416
fix(spring): limit retry settings configuration by method type (#1212)
emmileaf Jan 10, 2023
31d4406
fix(spring): fix method javadoc missing @param and @return (#1226)
zhumin8 Jan 10, 2023
8736c61
fix(spring): use newHttpJsonBuilder in settings bean for REST transpo…
emmileaf Jan 10, 2023
a3d86b0
fix(spring): switch camelcase conversion logic to use JavaStyle (#1245)
emmileaf Jan 13, 2023
e06aa48
chore(spring): add release-please annotations to pom template (#1259)
emmileaf Jan 19, 2023
26c2e12
fix(spring): fix client and settings class names in comments (#1277)
emmileaf Jan 26, 2023
3f5db4d
fix(spring): update hasRestOption to exclude services with no rest-su…
emmileaf Feb 9, 2023
dcd0823
fix(spring): extend hasRestOption fix to properties composer and add …
emmileaf Feb 16, 2023
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
2 changes: 2 additions & 0 deletions .bazeliskrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# See https://github.com/bazelbuild/bazelisk
USE_BAZEL_VERSION=4.2.2
93 changes: 55 additions & 38 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ name: ci
jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
java: [8, 11]
steps:
Expand All @@ -18,7 +18,7 @@ jobs:
java-version: ${{ matrix.java }}
distribution: temurin
- run: java -version

- run: bazelisk version
- name: Bazel File Cache Setup
id: cache-bazel
uses: actions/cache@v3
Expand All @@ -41,31 +41,8 @@ jobs:
echo "and it will start over with a clean cache."
echo "The old one will disappear after 7 days."

- name: Unit Tests
run: bazel --batch test //:units --noshow_progress --test_output=errors

- name: Integration Tests
run: bazel --batch test //test/integration/...

- name: Gradle Build Generated Storage Client Library
run: |
echo "Building Storage lib from generated source..."
mkdir /tmp/java-storage
bazel --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java
tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage
pushd /tmp/java-storage/google-cloud-storage-v2-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd

- name: Gradle Build Generated Compute Client Library
run: |
echo "Building Compute lib from generated source..."
mkdir /tmp/java-compute
bazel --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java
tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute
pushd /tmp/java-compute/google-cloud-compute-small-v1-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
run: bazelisk --batch test //test/integration/...

- uses: actions/upload-artifact@v3
if: ${{ failure() }}
Expand All @@ -74,21 +51,61 @@ jobs:
path: ~/.cache/bazel/*/*/*/gapic_generator_java/bazel-out/*/testlogs/*
retention-days: 5

- name: Java Linter
run: bazel --batch run //:google_java_format_verification

coverage:
generate-client-libraries:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 8, 11 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
java-version: 8
- run: java -version
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
- run: java -version
- run: bazelisk version
- name: Bazel File Cache Setup
id: cache-bazel
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}

- name: Bazel Cache Not Found
if: steps.cache-bazel.outputs.cache-hit != 'true'
run: |
echo "No cache found."
- name: Bazel Cache Found
if: steps.cache-bazel.outputs.cache-hit == 'true'
run: |
echo -n "Cache found. Cache size: "
du -sh ~/.cache/bazel
echo "If the cache seems broken, update the CACHE_VERSION secret in"
echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions"
echo "(use any random string, any GUID will work)"
echo "and it will start over with a clean cache."
echo "The old one will disappear after 7 days."

- name: Gradle Build Generated Storage Client Library
run: |
echo "Building Storage lib from generated source..."
mkdir /tmp/java-storage
bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java
tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage
pushd /tmp/java-storage/google-cloud-storage-v2-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd

- name: Generate Code Coverage Report
# Run only test targets, and not golden_update targets.
run: bazel coverage //:units --combined_report=lcov
- name: Gradle Build Generated Compute Client Library
run: |
echo "Building Compute lib from generated source..."
mkdir /tmp/java-compute
bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java
tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute
pushd /tmp/java-compute/google-cloud-compute-small-v1-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd

license-header:
runs-on: ubuntu-latest
Expand Down
21 changes: 19 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ TEST_DEPS = [
"@io_github_java_diff_utils//jar",
]

SPRING_DEPS = [
"@maven//:org_springframework_boot_spring_boot_starter",
"@maven//:org_springframework_boot_spring_boot_autoconfigure",
"@maven//:org_springframework_boot_spring_boot",
"@maven//:org_springframework_spring_context",
"@maven//:org_springframework_spring_beans",
"@maven//:com_google_cloud_spring_cloud_gcp_autoconfigure",
"@maven//:com_google_cloud_spring_cloud_gcp_core",
"@maven//:commons_logging_commons_logging",
]

proto_library(
name = "service_config_proto",
srcs = ["src/main/proto/service_config.proto"],
Expand Down Expand Up @@ -100,13 +111,13 @@ java_library(
name = "gapic_generator_java",
srcs = glob(["src/main/java/**/*.java"]),
plugins = [":autovalue_plugin"],
deps = MAIN_DEPS,
deps = MAIN_DEPS + SPRING_DEPS,
)

java_library(
name = "gapic_generator_java_test",
srcs = glob(["src/test/java/**/*.java"]),
deps = [":gapic_generator_java"] + MAIN_DEPS + TEST_DEPS,
deps = [":gapic_generator_java"] + MAIN_DEPS + TEST_DEPS + SPRING_DEPS,
)

java_binary(
Expand All @@ -115,6 +126,12 @@ java_binary(
runtime_deps = [":gapic_generator_java"] + MAIN_DEPS,
)

java_binary(
name = "protoc-gen-java_gapic_spring",
main_class = "com.google.api.generator.spring.Main",
runtime_deps = [":gapic_generator_java"] + MAIN_DEPS + SPRING_DEPS,
)

# Request dumper binary, which dumps the CodeGeneratorRequest to a file on disk
# which will be identical to the one passed to the protoc-gen-java_gapic during
# normal execution. The dumped file then can be used to run this gapic-generator
Expand Down
8 changes: 7 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,14 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "pr

load("@rules_jvm_external//:defs.bzl", "maven_install")


SPRING_MAVEN_ARTIFACTS = [
"org.springframework.boot:spring-boot-starter:2.7.4",
"com.google.cloud:spring-cloud-gcp-autoconfigure:3.4.1",
]

maven_install(
artifacts = PROTOBUF_MAVEN_ARTIFACTS,
artifacts = PROTOBUF_MAVEN_ARTIFACTS + SPRING_MAVEN_ARTIFACTS,
generate_compat_repositories = True,
repositories = [
"https://repo.maven.apache.org/maven2/",
Expand Down
16 changes: 14 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-shared-dependencies</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -27,7 +27,7 @@
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.0</version>
<version>1.7.1</version>
</extension>
</extensions>

Expand Down Expand Up @@ -324,6 +324,18 @@
<version>4.13.2</version>
</dependency>

<!-- Spring related dependencies-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.7.4</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-autoconfigure</artifactId>
<version>3.4.1</version>
</dependency>

<!--
TODO: remove when dropping Java 8.
https://github.com/googleapis/gapic-generator-java/issues/888
Expand Down
2 changes: 2 additions & 0 deletions rules_java_gapic/java_gapic.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ def java_gapic_library(
**kwargs
)

print("postprocessing done.\n")

resource_name_name = "%s_resource_name" % name
resource_name_deps = [resource_name_name]
native.java_library(
Expand Down
28 changes: 25 additions & 3 deletions rules_java_gapic/java_gapic_pkg.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ def _gapic_pkg_tar_impl(ctx):
for f in s.files.to_list():
samples.append(f)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in this file are mostly not needed anymore now that we do not plan to go through with the current post-processing steps.


spring =[]
for s in ctx.attr.spring:
for f in s.files.to_list():
spring.append(f)

paths = _construct_package_dir_paths(
ctx.attr.package_dir,
ctx.outputs.pkg,
Expand All @@ -80,6 +85,11 @@ def _gapic_pkg_tar_impl(ctx):
unzip -q ./$s -d {package_dir_path}/{tar_cd_suffix}/{tar_prefix}/samples/snippets/generated/
done

for s in {spring}; do
mkdir -p {package_dir_path}/{tar_cd_suffix}/{tar_prefix}/spring/
unzip -q ./$s -d {package_dir_path}/{tar_cd_suffix}/{tar_prefix}/spring/
done

mkdir -p {package_dir_path}
for dep in {deps}; do
tar -xzpf $dep -C {package_dir_path}
Expand All @@ -95,13 +105,14 @@ def _gapic_pkg_tar_impl(ctx):
package_dir_path = paths.package_dir_path,
package_dir = paths.package_dir,
samples = " ".join(["'%s'" % s.path for s in samples]),
spring = " ".join(["'%s'" % s.path for s in spring]),
pkg = ctx.outputs.pkg.path,
tar_cd_suffix = paths.tar_cd_suffix,
tar_prefix = paths.tar_prefix,
)

ctx.actions.run_shell(
inputs = deps + samples,
inputs = deps + samples + spring,
command = script,
outputs = [ctx.outputs.pkg],
)
Expand All @@ -114,6 +125,7 @@ gapic_pkg_tar = rule(
attrs = {
"deps": attr.label_list(mandatory = True),
"samples": attr.label_list(mandatory = False),
"spring": attr.label_list(mandatory = False),
"package_dir": attr.string(mandatory = False, default = ""),
"extension": attr.string(mandatory = False, default = "tar.gz"),
},
Expand Down Expand Up @@ -274,6 +286,10 @@ def _java_gapic_srcs_pkg_impl(ctx):
if [ -d {package_dir_path}/src/main/java/samples ]; then
mv {package_dir_path}/src/main/java/samples {package_dir_path}
fi

if [ -d {package_dir_path}/src/main/java/spring ]; then
mv {package_dir_path}/src/main/java/spring {package_dir_path}
fi
done
for proto_src in {proto_srcs}; do
mkdir -p {package_dir_path}/src/main/proto
Expand Down Expand Up @@ -319,6 +335,7 @@ def java_gapic_assembly_gradle_pkg(
name,
deps,
include_samples = False,
include_spring = False,
assembly_name = None,
transport = None,
**kwargs):
Expand All @@ -339,13 +356,16 @@ def java_gapic_assembly_gradle_pkg(
grpc_deps = []
proto_deps = []
samples = []
spring = []

processed_deps = {} #there is no proper Set in Starlark
for dep in deps:
# Use contains instead of endswith since microgenerator testing may use differently-named targets.
if "_java_gapic" in dep:
if include_samples:
samples.append(dep + "_samples")
if include_spring:
spring.append(dep + "_spring")
_put_dep_in_a_bucket(dep, client_deps, processed_deps)
_put_dep_in_a_bucket("%s_test" % dep, client_test_deps, processed_deps)
_put_dep_in_a_bucket("%s_resource_name" % dep, proto_deps, processed_deps)
Expand Down Expand Up @@ -393,7 +413,8 @@ def java_gapic_assembly_gradle_pkg(
name = name,
assembly_name = package_dir,
deps = proto_target_dep + grpc_target_dep + client_target_dep,
samples = samples,
samples = samples, # :vision_java_gapic_samples
spring = spring, # :vision_java_gapic_spring
)

def _java_gapic_gradle_pkg(
Expand Down Expand Up @@ -439,7 +460,7 @@ def _java_gapic_gradle_pkg(
**kwargs
)

def _java_gapic_assembly_gradle_pkg(name, assembly_name, deps, samples = None, visibility = None):
def _java_gapic_assembly_gradle_pkg(name, assembly_name, deps, samples = None, spring = None, visibility = None):
resource_target_name = "%s-resources" % assembly_name
java_gapic_build_configs_pkg(
name = resource_target_name,
Expand All @@ -459,5 +480,6 @@ def _java_gapic_assembly_gradle_pkg(name, assembly_name, deps, samples = None, v
] + deps,
samples = samples,
package_dir = assembly_name,
spring = spring,
visibility = visibility,
)
Loading