-
-
Notifications
You must be signed in to change notification settings - Fork 289
Use rules_jvm_external
for fetching Maven artifacts
#1775
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
base: master
Are you sure you want to change the base?
Use rules_jvm_external
for fetching Maven artifacts
#1775
Conversation
It's my goal to remove `dev_deps`, and switching to `buildifier-prebuilt` gets us one step closer to doing that. It should also make CI faster.
We need `--incompatible_use_plus_in_repo_names` to be set in wokrspaces using this repository, since we construct the canonical repository name for `rules_scala_maven` in a few places.
`overridden_artifacts` is no longer possible with the new `rules_jvm_external` setup and has been removed. We could fetch artifacts for the non-scala toolchains as we do with the scala toolchain, using `maven_install`, which would allow for overriding artifacts, but I don't think we should do that for a couple reasons: - That wouldn't allow us to share external dependencies across repositories or utilize lockfiles - We already support providing custom dependencies via `scala_compiler_classpath`, etc. Arguably, `overridden_artifacts` is a redundant feature
For reference:
In the root project, people can define an |
This may take some time to digest. 🙂 I'm also focusing on polishing my Bzlmod Migration Bootcamp for BazelCon, so that'll slow me down a bit. But I'm definitely interested in exploring this, and hearing what others think. If this lands, since it does contain breaking API changes (which do sound like good changes to me), it will precipitate a I've yet to look at this at all, but a few early thoughts/assumptions:
Also interested in any input or insight that @WojciechMazur may have. cc: @BillyAutrey |
Good to know! Regarding the
|
I can definitely do that. This PR is already divided into commits that migrate each toolchain incrementally, so I can add the initial
Understood. I'll plan on preserving |
Description
This PR refactors the ruleset to use
rules_jvm_external
for fetching all Maven artifacts. It deletes all of the rules inthird_party/repositories
andscala/scala_maven_import_external.bzl
.Please read the "Maven Dependencies" section in our Unifying the Scala Rulesets proposal for more information:
https://docs.google.com/document/d/12BmUPpJpworA9ep2P_J00TxXwFRBZDQttUCsoYo0Yao/edit?tab=t.0#heading=h.h50z2i1vo4z6
Motivation
Advantages of using
rules_jvm_external
over using our own rules include:rules_jvm_external
, and it's easier for newcomers to contribute to this ruleset as they're more likely to have experience withrules_jvm_external
than the existing rulesthird_party/repositories
, but these files aren't generated in the sense that deleting them and re-creating them produces an identical file. There's also no testing in place to ensure they aren't arbitrarily modified.rules_scala_maven
with these changes) imposes numerous benefits:use_repo
calls neededBreaking Changes
There aren't many breaking changes, as I did my best to preserve the existing interfaces as much as possible. The only breaking changes are:
overridden_artifact
tag class fromscala_deps
has been removedsettings
tag class fromscala_deps
has been removedfetch_sources
: Sources are now always fetchedmaven_sources
: Setting the Maven servers without providing your own artifacts is now impossiblevalidate_scala_version
: Scala version validation is no longer neededUnresolved Questions
WORKSPACE
SupportSince we now declare all of the artifacts we need in
MODULE.bazel
, I haven't found a way to avoid duplicating that list in bothMODULE.bazel
andWORKSPACE
. include exists, but:rules_scala
wouldn't be when used by another repository)load
, in that the variables defined in an included file are isolated to that fileThe two solutions I can think of are:
WORKSPACE
supportWORKSPACE
supportOption 1 may be less painful if we can slim down the number of artifacts fetched. In this PR, I've copied toolchains' dependencies verbatim, but I realize that many of the artifacts we fetch are transitive dependencies not used directly. For example, the Scala compilation toolchain defines JLine as a dependency, despite us never using JLine. As a dependency of the compiler, it would've been included on the compiler classpath anyway.
I'm curious about others' thoughts on this.