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

chore: Update steps to generate a library locally #1539

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Changes from all commits
Commits
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
28 changes: 20 additions & 8 deletions gapic-generator-java/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,22 @@ To generate a production GAPIC API:
strip_prefix = "gapic-generator-java-%s" % _gapic_generator_java_version,
urls = ["https://github.com/googleapis/gapic-generator-java/archive/v%s.zip" % _gapic_generator_java_version],
)

# gax-java is part of gapic-generator-java repository
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this required? Tomo and I actually just discussed today, since gax is already included in the gapic-generator-java jar, as long as we built a new jar with local gax changes, we shouldn't need this step.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I remove this reference to gax_java and point it to the generator_java instead, I get this error when invoking the command:

ERROR: /Users/lawrenceqiu/IdeaProjects/googleapis/google/cloud/talent/v4/BUILD.bazel:88:19: no such package '@com_google_api_gax_java//gax': The repository '@com_google_api_gax_java' could not be resolved: Repository '@com_google_api_gax_java' is not defined and referenced by '//google/cloud/talent/v4:talent_java_gapic_test'

Seems like there is reference to com_google_api_gax_java inside the java_gapic_library bazel rule?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see the problem now, yes there are gax references in java_gapic_library that is used for generating the gradle files. Now that gax repo is pointed to gapic-generator-java/gax-java, we have to point it to local folder otherwise it will complaint something about "SNAPSHOR version does not exist". Thanks for fixing it!
CC: @suztomo I know you might be working on improving this part, this is one more side effect of the gradle files generation.

http_archive(
name = "com_google_api_gax_java",
strip_prefix = "gapic-generator-java-%s/gax-java" % _gapic_generator_java_version,
urls = ["https://github.com/googleapis/gapic-generator-java/archive/v%s.zip" % _gapic_generator_java_version],
)
```

to

```
_gapic_generator_java_version = "2.13.1-SNAPSHOT"

_gapic_generator_java_version = "2.15.4-SNAPSHOT"
maven_install(
artifacts = [
"com.google.api:gapic-generator-java:" + _gapic_generator_java_version,
"com.google.api:gapic-generator-java:" + _gapic_generator_java_version,
],
#Update this False for local development
fail_on_missing_checksum = False,
Expand All @@ -128,10 +134,16 @@ To generate a production GAPIC API:
]
)

local_repository(
name = "gapic_generator_java",
path = "/absolute/path/to/your/local/gapic-generator-java",
)
local_repository(
name = "gapic_generator_java",
path = "/absolute/path/to/your/local/gapic-generator-java",
)

# gax-java is part of gapic-generator-java repository
local_repository(
name = "com_google_api_gax_java",
path = "/absolute/path/to/your/local/gapic-generator-java/gax-java",
)
```

Note: At the time of writing, the gapic-generator version was `2.13.0`. Update the version to the latest version in the pom.xml
Expand Down