Pkg.jl
Pkg.jl copied to clipboard
[workspace] Preserve top level dependencies better
When adding package that is already in the manifest because of a top level dependency of a different project (or as a transient dependency, but those almost always track the registry) we should try to preserve the version. For example:
$ tree .
.
├── Manifest.toml
├── Project.toml
└── test
└── Project.toml
$ cat Project.toml
[deps]
Example = "7876af07-990d-54b4-ab0e-23690620f79a"
[workspace]
projects = ["test"]
$ julia -e 'using Pkg; Pkg.status()'
Status `/tmp/tmp.C9bJWtPVPR/Project.toml`
[7876af07] Example v0.5.4 `https://github.com/JuliaLang/Example.jl.git#master`
$ julia --project=test -e 'using Pkg; Pkg.status()'
Status `/tmp/tmp.C9bJWtPVPR/test/Project.toml` (empty project)
$ julia --project=test -e 'using Pkg; Pkg.add("Example")'
Resolving package versions...
Updating `/tmp/tmp.C9bJWtPVPR/test/Project.toml`
[7876af07] + Example v0.5.3
Updating `/tmp/tmp.C9bJWtPVPR/Manifest.toml`
[7876af07] + Example v0.5.3
$ julia -e 'using Pkg; Pkg.status()'
Status `/tmp/tmp.C9bJWtPVPR/Project.toml`
[7876af07] Example v0.5.3
I think this would be fixed by pinning top level dependencies of all projects in the first stage of the tiered resolver.