Write a Bazel module extension to download the `cosmos` binaries.
We currently list all the binaries, integrities and repository rules in MODULE.bazel
.
This has been sufficient for the most part but now that we are doing more regular updates it is becoming a challenge to maintain.
I propose writing a extension that can be used as so:
cosmos = use_extension("//ape/cosmos:defs.bzl", "ape_cosmos")
cosmos.download(
version = "4.0.2",
lock = "//ape/cosmos/lock.json",
)
use_repo(cosmo, "zstd")
Where the lock.json
contains the binary name and integrity:
{
"zstd": "sha256-...",
"chmod.ape": "sha256-...",
...
}
It would generate the various download, entrypoint and exported symlink repositories for each binary.
We should implement a way to update the lockfile. An option would be to set the integrity to null
and then the module context does a download and updates the integrity.