Allow rulesets to integrate with bazel mod tidy
to update lock files.
#24951
Labels
team-ExternalDeps
External dependency handling, remote repositiories, WORKSPACE file.
type: feature request
untriaged
Description of the feature request:
Most rulesets that integrate with third-party deps maintain their own lock files. These are read at build-time to generate various workspaces (eg.
@maven
is commonly created when usingrules_jvm_external
). At present, the way to fully update a module file to incorporate changes made in these definitions is:bazel mod tidy
It would be a smoother user experience if there was some way to tell Bazel that the second step could be performed using some target that can be
bazel run
. Could we extendmodule_context.extension_metadata
to include a list of runnable targets, env vars, and possibly command line flags that could be called to update deps?Which category does this issue belong to?
No response
What underlying problem are you trying to solve with this feature?
Simplifying developer workflows when updating third party dependencies. This is handled differently by every ruleset, and makes working in a polyglot repo hard, especially for users who seldom update dependencies.
Which operating system are you running Bazel on?
No response
What is the output of
bazel info release
?No response
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?Have you found anything relevant by searching the web?
There is a proposal for the module lock file to have persistent storage: #24777. It is possible that as part of this, we could use the bazel lock file to store resolution results (or similar) for third party dependencies, but to do so, we'd still need to use
bazel run
.As an example, in
rules_jvm_external
the resolution is done using a target that can be executed viabazel run
, as the target has its own dependencies, is too large to include as a binary, and requires the use of the hermetic java toolchain provided byrules_java
. We don't want to prebuild the resolver since that would require additional infrastructure for us to manage release and would complicate developing the ruleset.Any other information, logs, or outputs that you want to share?
Discussion on the Bazel Slack channel
The text was updated successfully, but these errors were encountered: