tarides / opam-monorepo

Assemble dune workspaces to build your project and its dependencies as a whole
ISC License
130 stars 27 forks source link

Write `opam-monorepo` invocation into lock file #308

Closed Leonidas-from-XIV closed 2 years ago

Leonidas-from-XIV commented 2 years ago

In #307 we discussed how to make the lockfiles reproducible in the presence of command line options (that are able to change the output of the lockfile in a non-trivial way). A compromise that would allow both people to overwrite values via the CLI and yet give hints how to reproduce the generated lockfile is to write the invocation of the opam-monorepo call that was used to create the lockfile into the lockfile itself.

The potential advantages are:

  1. It allows people who want to reproduce the lock file to reproduce it. At least provided they use the same version of opam-monorepo but we don't really provide cross-version reproducibility for plenty of good reasons.
  2. It serves as documentation how the lockfile came to be, so newcomers to a project using opam-monorepo are aware of it and due to the invocation written there, they have a pointer to see how to use opam-monorepo

While this feature will not be implemented in #307, this issue was created to keep track of the idea.

NathanReb commented 2 years ago

I'm working on it as we speak.

Following up the original discussion, I was thinking about writing it in an extension rather than a comment.

We wouldn't parse it back for now but we'll have that ability if we ever need to in the future!