-
Notifications
You must be signed in to change notification settings - Fork 842
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
Design discussion: for implicit snapshots, unify snapshot and local DB? #3783
Comments
Overall -1:
|
How's this for an implementation approach: the build cache would also get copied when installing. This way we can know if the local package has changed since it was installed.
True, but I think implicit snapshots will absolutely need GC. So, I don't see this as a problem.
There wouldn't be any This might require not using Cabal's copy / register step, which wouldn't work so well for custom setup. Since, with that packages need to be installed into a DB rather than just being referencable from a DB. I think I recall hearing about a hack where they just get installed into a DB that only has the single package. Seems gnarly.
Package promotion is computed separately from plan construction. I believe that package promotion logic could be removed if it's all in one DB. We would unfortunately still need promotion for global to project DB.
The precompiled cache hash will include the path to the local package, and, as usual, all of its dependencies. In order to determine when a local package in the DB needs to be rebuilt, we'd compare the installed build cache with the state of the local files. There is a tricky thing, though, take the following case:
I realize this is a major change in how things work, but I think it is a more elegant and functional design. I certainly haven't thought through every detail. |
Closing |
Previously, the discussion of implicit snapshots has mostly been around moving dependency packages (things from hackage, git repos) into the snapshot DB such that there can be more package sharing. The primary motivation, however, is making it so that build options can reliably applied to all snapshot packages without much hassle (see #3782).
However, what if we went even further and possibly simpler, and put everything in one package DB (except for global + extra)? So local project packages in the filesystem would also be installed to this DB. This would unify the local and snapshot DB.
I'm thinking this would work something like this:
Each stack.yaml would get its own package DB.
All packages, even local file ones, get installed somewhere in the stack root (~/.stack). The ones involved in the current project get registered to the project's package DB. For local file packages, the install path is based on hashing the local file package's path.
When possible, this means that multiple project configurations that reference the same local package can share compilation results! There is an issue with only hashing the local package's path, though, switching configurations would often require recompilation when sharing is not possible.
@snoyberg @borsboom Am I overlooking something that makes this infeasible? This could be both an optimization and a simplification.
The text was updated successfully, but these errors were encountered: