Skip to content

Lock the plugins, build time dependencies #28

Open
@roberth

Description

@roberth

What are you suggesting?

I think sbt-dependency-lock should lock the versions of used build plugins.
Sbt plugins versions can obviously have a significant effect on the build output, so they should be included in the lock file.

This may be a hard problem to solve.

How will this benefit other users?

This will make sure that they will notice changes to their build system. Furthermore, it works towards making the build hermetic; accounting for all inputs that affect the result.

Is there a workaround that can do this now?

Another tool, Sbtix has been reasonably successful at achieving this. Its goal is to make the build completely hermetic, proven by running inside the Nix package manager, which enforces hermeticity.
Its main limitation is that it requires to be run as a separate tool; not just an sbt plugin in the regular build. The author did intend to fix this problem in a rewrite, but did not get around to its completion.

Will this require a lock file change?

This will add more entries to the lockfile; perhaps in a new field. This might either count as an addition or a change.

Other details

Besides benefits for regular sbt users, this project has the potential to solve the packaging of sbt-based projects in Nix, for NixOS, home-manager, etc. It seems that a number of people are interested in this; those participating in zaninime/sbt-derivation#5 and some others I know.

For this to be work, the lock file has to contain all dependencies that will be fetched over the wire. I don't think members of this project need to know anything about Nix. It might turn out to be useful for this project's testing in the future, but not at this stage.

Current state of packaging sbt software with Nix

This is quite a rabbit hole. Feel free to skip this.

At the moment, such software is either not packaged at all, not buildable from source, or built using a fragile solution that does fetch all dependencies but fails whenever the entire local 'm2 repo' doesn't match the recorded Merkle hash. This gives no insight into the cause of the problem, requires a magical hash value to be maintained and is inefficient because it duplicates all dependencies every time.

Sbtix is usable for private projects as long as they can avoid bad combinations of dependency overrides. This is feasible for medium-sized projects but perhaps only when using sbtix from the start (because that helps avoiding aforemention bug). This appears to have made it unsuitable for use in Nixpkgs, the central package repo used by NixOS etc.

Perhaps a combination of an Sbtix-like approach for the plugins and the current sbt-dependency-lock for regular dependencies might be necessary. I am by no means an expert on sbt internals though, so I hope a better solution is possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions