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

Why an extra layer of indirection? #265

Closed
pauldraper opened this issue Oct 14, 2019 · 3 comments
Closed

Why an extra layer of indirection? #265

pauldraper opened this issue Oct 14, 2019 · 3 comments

Comments

@pauldraper
Copy link

pauldraper commented Oct 14, 2019

Consider publishing a example_tool workspace.

Normally, the client workspace would have

http_respository(name = "example_tool", ....)

load("@example_tool//:workspace.bzl", example_tool_repositories = "repositories")

example_tool_repositories() # default repository definitions

However, if I change to using this project, the client now has to

http_archive(name = "example_tool", ...)

load("@example_tool//:workspace.bzl", example_tool_repositories = "repositories")

example_tool_repositories() # default repository definitions, including rules_jvm_external and maven_install(...)

load("@example_tool_maven//:defs.bzl", example_tool_maven_repositories =  "pinned_maven_install")

example_tool_maven_repositories()

The last two statements seem to be entirely superfluous, especially when the client requires no direct interaction with Maven artifacts. (E.g. Google Closure Compiler is a Java project with third party/Maven dependencies, but it's used by JavaScript developers that hardly need to understand the first thing about JVM/Maven/classpaths.)


I think this is an artifact of wanting to operate in a non-pinned mode(?).

In any case the extra WORKSPACE complexity imposed on clients is a regression compared to bazel-deps or hand-coded dependencies.

@pauldraper pauldraper changed the title Why an extra layer of indiection? Why an extra layer of indirection? Oct 14, 2019
@pauldraper
Copy link
Author

Another thing the indirection provides is the ability for the client to avoid loading a large Skylark file if it does not use it. But I consider that to be a minor cost.

I'd like for my Maven repos to be able to be loaded in a single repositories() call, just like all my other repositories.

@jin
Copy link
Member

jin commented Oct 20, 2019

I think this is an artifact of wanting to operate in a non-pinned mode(?).

This is it. For library/tool maintainers, we recommend the approach of exporting a list of coordinate strings, and concatenating it into the consuming repository's maven_install. This is a lighter weight approach of performing one-version resolution, and avoids futzing around with using a dependency repo's maven_install.json. The client can then decide if they want to use artifact pinning. We should make this clearer in the docs.

See https://github.com/bazelbuild/rules_jvm_external#exporting-and-consuming-artifacts-from-external-repositories

Does this clarify things?

@jin
Copy link
Member

jin commented Oct 30, 2019

I'll close this issue for now, please let me know if you have a proposal to make regular non-pinned workflows work in conjunction with the pinned mode (so users can switch between the two easily) without the indirection of loading from a generated bzl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants