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: Java µgen dev workflow demo DO NOT SUBMIT #786

Closed
wants to merge 37 commits into from

Conversation

miraleung
Copy link
Contributor

No description provided.

vam-google and others added 30 commits May 26, 2021 15:21
Prepare `gapic-generator-java` for the DIREGAPIC implementation changes.

1) Splitting Grpc-specific classes into their own package (mainly `composer` classes)
2) Extract the transport-agnostic logic of the composer classes into the set of abstract classes.
3) Convert most of the static methods in the `ClassComposer` classes into instance methods to leverage the class inheritance (transport-agnostic logic in abstract class, transport-specific portions are in transport-specific classes extending the abstract ones)
4) The resultant architecture resembles the [Template Method](https://en.wikipedia.org/wiki/Template_method_pattern) design pattern where `Abstract<Name>ClassComposer.generate()` (and potentially the the other private/protected methods called from `generate()`) call transport-specific logic (implemented in the concrete `<Transport><Name>ClassComposer` classes), when appropriate.
5) Refactor the tests and golden files file structure to match the main classes package structure.
6) The golden files were split to be placed under the same directory as the clases which generate them. This was matching the existing infrastructure the best: (1) as the golden files updater makes this assumption (golden file is under the same package as the `<Name>Test.java` which creates it); (2) the repo currently does not have a dedicated test resources directory (there are multiple resource-like subfolders under test, it is hard to keep thing under control and avoid propagating magical path constants); (3) keeping golden files and tests together seems ok, since if the golden files were smaller they would be simply put as the expected constants in the tests themselves.
7) This PR tries to preserve the original history of the files as accurately as possible (i.e. prioritizes clear move semantics over delete/create semantics in terms of file diff, where possible).

The subsequent PR with rest implementation will looks something like [this](vam-google/gapic-generator-java@master...vam-google:diregapic_main)
Release-As: 1.0.10
* chore: release 1.0.10

* Update CHANGELOG.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Mira Leung <miraleung@users.noreply.github.com>
…#743)

* fix(tests): Ensure deterministic field ordering in test classes

* fix(bazel): fix recursive integration test file diffs (#744)
* fix(tests): Ensure deterministic field ordering in test classes

* fix(bazel): fix recursive integration test file diffs
…ds in test/mock classes [ggj] (#750)

* chore: add context to diff

* fix: Sort services and methods by name

* fix: add more context

* fix: more service ordering

* fix: test

* fix: test

* fix: test

* fix: test

* fix: test

* fix: test ordering again

* fix: cleanup
ntegration tests (compute_small) are not present in this commit, as they depend on #743 and #744. Also, as a prerequisite, at least a basic implementation of DIREGAPIC must be merged in gapic-generator-java, to integrate it with [googleapis-discovery](https://github.com/googleapis/googleapis-discovery) first (since integration test infra depends on the actual googleapis/googleapis-discovery targets). Please check vam-google@8983e23 to see how it would look like with compute integration tests not excluded.


`compliance.proto` is used as a basis for the REST composer tests. It was copied as is from [showcase/compliance.proto](https://github.com/googleapis/gapic-showcase/blob/master/schema/google/showcase/v1beta1/compliance.proto).

Changes in `WORKSPACE` and `repositories.bzl` are necessary to make this repo work with gax-java `1.63.0` and above (`gax-java` vs `gapic-generator-java` java dependencies imports precedence). The other dependencies changes are either to bring deps in sync with the actual ones in googleapis, or to fix a specific import precedence issue.

I also added (in a form of bazel rules) a proto descriptor dumper and a runner from the dumped file (for debugging purposes). Not technically required here (but was very helpful for debugging purposes, so hopefully we can preserve it).
Release-As: 1.0.11
* chore: release 1.0.11

* Update CHANGELOG.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Mira Leung <miraleung@users.noreply.github.com>
* chore: Add comment context on null protobuf check

* Update AbstractServiceStubSettingsClassComposer.java
…ggj] (#760)

* fix(mocks): Use java.lang.Object if there are protos named 'Object'

* fix: add tests

* Update MockServiceImplClassComposer.java

* Update MockServiceImplClassComposer.java

* Update MockServiceImplClassComposer.java

* fix(resnames): Use anon resname classes when no non-only ds are present (#761)
Release-As: 1.0.12
…nt [ggj] (#763)

* fix(mocks): Use java.lang.Object if there are protos named 'Object'

* fix: add tests

* Update MockServiceImplClassComposer.java

* Update MockServiceImplClassComposer.java

* Update MockServiceImplClassComposer.java

* fix(resnames): Use anon resname classes when no non-only ds are present
* chore: release 1.0.12

* Update CHANGELOG.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Mira Leung <miraleung@users.noreply.github.com>
…or from dumped file (#765)

For debugging purposes.

Usage example:

```bzl
load("@gapic_generator_java//rules_java_gapic:java_gapic.bzl", "java_generator_request_dump")
java_generator_request_dump(
    name = "compute_small_request_dump",
    srcs = [":compute_small_proto_with_info"],
    transport = "rest",
)
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
…[ggj] (#764)

* fix(bazel): Remove monolith rule deps from the Java µgen Bazel rules

* fix: update library rules, add bazel clean to CI

* fix: remove Bazel clean from CI

* fix: add compute

* fix: update library goldens

* fix: simplify integration test targets in CI

* fix: CI build

* fix: CI build
Release-As: 1.0.14
* chore: release 1.0.14

* Update CHANGELOG.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Mira Leung <miraleung@users.noreply.github.com>
miraleung and others added 6 commits June 22, 2021 13:27
Release-As: 1.0.15
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
…client generation [ggj] (#781)

* fix(protoc): Mirror protoc's field name conflict resolution logic in client gen

* fix: update Field - set default value for originalName

* fix: update googleapis-discovery hash with monolith removal

* fix: post-conflict resolution goldens

* fix(build): Update googleapis-discovery hash to fix compute integration test

* fix(protoc): Mirror protoc's field name conflict resolution logic in client gen

* fix: update Field - set default value for originalName

* fix: post-conflict resolution goldens

* Update Parser.java

* Update Field.java
* fix(bazel): Eradicate monolith deps from Java µgen repo

* fix: update googleapis hash

* fix: update googleapis-discovery and deps' hashes
@miraleung miraleung requested a review from a team as a code owner July 1, 2021 18:19
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 1, 2021
@miraleung miraleung changed the base branch from master to diregapic July 1, 2021 18:20
@codecov
Copy link

codecov bot commented Jul 1, 2021

Codecov Report

Merging #786 (02be3ab) into diregapic (79b5504) will decrease coverage by 0.14%.
The diff coverage is 89.11%.

❗ Current head 02be3ab differs from pull request most recent head b856140. Consider uploading reports for the commit b856140 to get more accurate results
Impacted file tree graph

@@              Coverage Diff              @@
##           diregapic     #786      +/-   ##
=============================================
- Coverage      91.42%   91.28%   -0.15%     
=============================================
  Files            125      140      +15     
  Lines          13750    14951    +1201     
  Branches        1029     1074      +45     
=============================================
+ Hits           12571    13648    +1077     
- Misses           900     1010     +110     
- Partials         279      293      +14     
Impacted Files Coverage Δ
...oogle/api/generator/engine/ast/AssignmentExpr.java 73.33% <0.00%> (-5.24%) ⬇️
.../google/api/generator/gapic/composer/Composer.java 10.11% <0.00%> (-2.57%) ⬇️
...ic/composer/common/BatchingDescriptorComposer.java 99.73% <ø> (ø)
...r/gapic/composer/common/RetrySettingsComposer.java 97.76% <ø> (ø)
...apic/composer/common/ServiceStubClassComposer.java 99.18% <ø> (ø)
.../gapic/composer/grpc/MockServiceClassComposer.java 100.00% <ø> (ø)
...google/api/generator/gapic/model/GapicContext.java 94.73% <ø> (ø)
...erator/gapic/protoparser/PluginArgumentParser.java 51.61% <30.76%> (-17.96%) ⬇️
.../com/google/api/generator/gapic/model/Message.java 64.10% <47.05%> (-16.67%) ⬇️
...ic/composer/common/ServiceClientClassComposer.java 98.70% <50.00%> (ø)
... and 53 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 79b5504...b856140. Read the comment docs.

@miraleung
Copy link
Contributor Author

This PR was made for development demo purposes - closing.

@miraleung miraleung closed this Jul 1, 2021
@miraleung miraleung changed the title chore: test change DO NOT SUBMIT chore: Java µgen dev workflow demo DO NOT SUBMIT Jul 2, 2021
@chanseokoh chanseokoh deleted the dev/demo branch November 10, 2021 15:49
suztomo pushed a commit that referenced this pull request Mar 21, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [io.grpc:grpc-bom](https://togithub.com/grpc/grpc-java) | `1.48.1` -> `1.49.0` | [![age](https://badges.renovateapi.com/packages/maven/io.grpc:grpc-bom/1.49.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/io.grpc:grpc-bom/1.49.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/io.grpc:grpc-bom/1.49.0/compatibility-slim/1.48.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/io.grpc:grpc-bom/1.49.0/confidence-slim/1.48.1)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>grpc/grpc-java</summary>

### [`v1.49.0`](https://togithub.com/grpc/grpc-java/compare/v1.48.1...v1.49.0)

[Compare Source](https://togithub.com/grpc/grpc-java/compare/v1.48.1...v1.49.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-shared-dependencies).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjMyLjE3My4wIn0=-->
suztomo pushed a commit that referenced this pull request Mar 21, 2023
🤖 I have created a release *beep* *boop*
---


## [3.0.2](googleapis/java-shared-dependencies@v3.0.1...v3.0.2) (2022-09-08)


### Dependencies

* Update dependency com.fasterxml.jackson:jackson-bom to v2.13.4 ([#789](googleapis/java-shared-dependencies#789)) ([d0b6888](googleapis/java-shared-dependencies@d0b6888))
* Update dependency com.google.auth:google-auth-library-bom to v1.10.0 ([#781](googleapis/java-shared-dependencies#781)) ([450a3fe](googleapis/java-shared-dependencies@450a3fe))
* Update dependency com.google.auth:google-auth-library-bom to v1.11.0 ([#790](googleapis/java-shared-dependencies#790)) ([fdbab60](googleapis/java-shared-dependencies@fdbab60))
* Update dependency com.google.auth:google-auth-library-bom to v1.9.0 ([#773](googleapis/java-shared-dependencies#773)) ([f59be02](googleapis/java-shared-dependencies@f59be02))
* Update dependency com.google.errorprone:error_prone_annotations to v2.15.0 ([#776](googleapis/java-shared-dependencies#776)) ([8eddf23](googleapis/java-shared-dependencies@8eddf23))
* Update dependency com.google.protobuf:protobuf-bom to v3.21.5 ([#780](googleapis/java-shared-dependencies#780)) ([80c783f](googleapis/java-shared-dependencies@80c783f))
* Update dependency io.grpc:grpc-bom to v1.48.1 ([#768](googleapis/java-shared-dependencies#768)) ([c1e6978](googleapis/java-shared-dependencies@c1e6978))
* Update dependency io.grpc:grpc-bom to v1.49.0 ([#786](googleapis/java-shared-dependencies#786)) ([c5c4a0b](googleapis/java-shared-dependencies@c5c4a0b))
* Update dependency org.checkerframework:checker-qual to v3.24.0 ([#775](googleapis/java-shared-dependencies#775)) ([4bb5bee](googleapis/java-shared-dependencies@4bb5bee))
* Update dependency org.checkerframework:checker-qual to v3.25.0 ([#788](googleapis/java-shared-dependencies#788)) ([ad9e4f1](googleapis/java-shared-dependencies@ad9e4f1))
* Update dependency org.threeten:threetenbp to v1.6.1 ([#782](googleapis/java-shared-dependencies#782)) ([30717c3](googleapis/java-shared-dependencies@30717c3))
* Update gax.version to v2.19.0 ([#785](googleapis/java-shared-dependencies#785)) ([b5a674e](googleapis/java-shared-dependencies@b5a674e))
* Update google.core.version to v2.8.10 ([#787](googleapis/java-shared-dependencies#787)) ([754e622](googleapis/java-shared-dependencies@754e622))
* Update google.core.version to v2.8.7 ([#774](googleapis/java-shared-dependencies#774)) ([0c8e010](googleapis/java-shared-dependencies@0c8e010))
* Update google.core.version to v2.8.8 ([#777](googleapis/java-shared-dependencies#777)) ([e354fe1](googleapis/java-shared-dependencies@e354fe1))
* Update google.core.version to v2.8.9 ([#784](googleapis/java-shared-dependencies#784)) ([a9847d7](googleapis/java-shared-dependencies@a9847d7))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
suztomo pushed a commit that referenced this pull request Mar 21, 2023
🤖 I have created a release *beep* *boop*
---


## [2.6.0](googleapis/java-core@v2.5.11...v2.6.0) (2022-04-14)


### Features

* **java:** remove GoogleJsonClentFeature and OpenCensusFeature after relocation ([#793](googleapis/java-core#793)) ([cafd489](googleapis/java-core@cafd489))
* **java:** remove Netty Native Image configuration after relocation to gax ([#771](googleapis/java-core#771)) ([9cc7dba](googleapis/java-core@9cc7dba))
* **java:** remove protobuf Native Image configuration ([#784](googleapis/java-core#784)) ([7a8df66](googleapis/java-core@7a8df66))
* remove native-image.properties settings  after relocation ([#794](googleapis/java-core#794)) ([219a519](googleapis/java-core@219a519))
* remove resource-config after relocation ([#795](googleapis/java-core#795)) ([8ed3110](googleapis/java-core@8ed3110))
* remove substitutions after relocation to gax ([#789](googleapis/java-core#789)) ([85280b1](googleapis/java-core@85280b1))


### Bug Fixes

* **java:** register test class for reflection to fix native image test ([#766](googleapis/java-core#766)) ([fa07125](googleapis/java-core@fa07125))


### Dependencies

* revert protobuf to 3.19 and common-protos 2.8.3 ([#798](googleapis/java-core#798)) ([27ca70c](googleapis/java-core@27ca70c))
* update dependency com.google.api-client:google-api-client-bom to v1.34.0 ([#800](googleapis/java-core#800)) ([3abc47d](googleapis/java-core@3abc47d))
* update dependency com.google.api:gax-bom to v2.16.0 ([#785](googleapis/java-core#785)) ([bd33a76](googleapis/java-core@bd33a76))
* update dependency com.google.api.grpc:proto-google-common-protos to v2.8.1 ([#792](googleapis/java-core#792)) ([3f85e62](googleapis/java-core@3f85e62))
* update dependency com.google.api.grpc:proto-google-common-protos to v2.8.2 ([#796](googleapis/java-core#796)) ([d6ea18e](googleapis/java-core@d6ea18e))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.3.0 ([#783](googleapis/java-core#783)) ([48594f3](googleapis/java-core@48594f3))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.3.1 ([#799](googleapis/java-core#799)) ([9fe7d35](googleapis/java-core@9fe7d35))
* update dependency com.google.errorprone:error_prone_annotations to v2.12.1 ([#788](googleapis/java-core#788)) ([cfdabb4](googleapis/java-core@cfdabb4))
* update dependency com.google.http-client:google-http-client-bom to v1.41.6 ([#791](googleapis/java-core#791)) ([d9ff405](googleapis/java-core@d9ff405))
* update dependency com.google.http-client:google-http-client-bom to v1.41.7 ([#797](googleapis/java-core#797)) ([dfc3c57](googleapis/java-core@dfc3c57))
* update dependency com.google.protobuf:protobuf-bom to v3.20.0 ([#787](googleapis/java-core#787)) ([51f59fc](googleapis/java-core@51f59fc))
* update dependency io.grpc:grpc-bom to v1.45.1 ([#780](googleapis/java-core#780)) ([cd8a078](googleapis/java-core@cd8a078))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants