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

fix(build_gen): use consistent names for open source package #59

Closed
wants to merge 2 commits into from
Closed

Conversation

jpoehnelt
Copy link
Contributor

@jpoehnelt jpoehnelt commented Jul 1, 2021

This makes it easier to depend on these rules. I added a deprecated alias to maintain the current names.

closes #56

@jpoehnelt jpoehnelt requested a review from a team as a code owner July 1, 2021 18:06
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 1, 2021
Copy link
Contributor

@miraleung miraleung left a comment

Choose a reason for hiding this comment

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

This will affect all ~200 API teams that use build_gen, with downstream effects on GitHub and our publishing pipeline.

Could you please describe what end goal you have in mind? Let's explore ways to achieve that while minimizing the blast radius.

@jpoehnelt
Copy link
Contributor Author

Goals:

  1. remove cloud from non-cloud apis
  2. use consistent naming to better enable downstream tooling, not having to switch on language in my scripts to get the package name and resulting tar file
  3. not having to undo changes in the build file every time buildgen is executed on the directory

with downstream effects on GitHub and our publishing pipeline

the alias should minimize these effects. if we remove the deprecation message there should be no blast radius

@jpoehnelt jpoehnelt requested a review from miraleung July 6, 2021 15:06
@miraleung
Copy link
Contributor

miraleung commented Jul 7, 2021

CC @vam-google

Thanks for the context, @jpoehnelt. Since the objective of this change is primarily for a non-cloud use case, could we instead introduce a --cloud flag (or similar) on the CLI? This would default to true, and when set to false, it could use a new BUILD file template with the changes in this PR, minus the Cloud-specific aliases. WDYT?

We would like to support non-Cloud APIs as well, and these seem like different use cases. As the vast majority of our users consist of Cloud APIs, introducing a different run-mode could help address your (Geo's?) use case while maintaining existing behavior for Cloud teams.

@jpoehnelt
Copy link
Contributor Author

I'm not sure the complexity of adding a different run mode is worth it. This change should have zero impact on cloud teams.

@jpoehnelt
Copy link
Contributor Author

I guess it would change the tar output name. :/

Copy link
Contributor

@vam-google vam-google left a comment

Choose a reason for hiding this comment

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

That naming is horrible and comes from the package names produced by Artman (legacy tool used to generate these things). Unfortunately too many things are currently depending on the generated name format for each individual language (like owl-bot used to populate googleapis-gen repository, many internal tools/scripts which we are not even aware of).

In other words, I agree that the current naming is very bad, but unless somebody has capacity to fix not only current naming but everything else which already depends on this naming, I believe we have to keep it as is.

Copy link
Contributor

@vam-google vam-google left a comment

Choose a reason for hiding this comment

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

Please do not do this. This adds too many hacks to the generated file to fix a relatively minor issue with naming. Notice, this file is on the surface of all builds. People interact with it very often, it must be kept as clean as possible. Local variables and aliasing is not idiomatic for build files and in general over complicates things without providing much benefit.

Please think about it this way: if we push this change, it will sacrifice the readability of build files of all cloud in the name of Google Maps. With all respect to maps, we can't do it.

If you really need a custom template, you can specify it as a command line arg to the build file generator: https://github.com/googleapis/rules_gapic/blob/main/bazel/src/main/java/com/google/api/codegen/bazel/ArgsParser.java#L75

@@ -81,14 +81,22 @@ java_gapic_test(
)

# Open Source Packages
java_gapic_assembly_gradle_pkg_deps = [
Copy link
Contributor

@vam-google vam-google Jul 9, 2021

Choose a reason for hiding this comment

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

this is too verbose and non-idiomatic (to keep dependencies in a separate variable; also in that chase the variable shoudd be named _LIKE_THIS).

@@ -97,6 +97,12 @@ java_gapic_assembly_gradle_pkg(
],
)

alias(
Copy link
Contributor

@vam-google vam-google Jul 9, 2021

Choose a reason for hiding this comment

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

This adds aliasing to solve the non-pretty name issue. This is too verbose and seems not worth it.

@jpoehnelt jpoehnelt closed this Jul 9, 2021
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.

Consistent bazel rule names open source gapic packages
3 participants