force_latest_compatible_version
: explicitly ask the resolver to look for a solution
#2468
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR is a follow-up to #2439.
Specifically, this PR implements @00vareladavid's suggestion in #2439 (comment):
Before this PR:
Pkg.test
sets up the temporary sandbox project.Pkg.test
runs the resolver inside the temporary sandbox project.force_latest_compatible_version
isfalse
, we do nothing. Ifforce_latest_compatible_version
istrue
, we assemble the list of all direct dependencies, and then loop over the list; for each direct dependencyDepName
, we take the following steps:DepName
the resolver selected.DepName
.[compat]
entry forDepName
. At the end of this step, we have a list of all registered versions ofDepName
that are compatible with the[compat]
entry forDepName
.maximum
of the list from step (iii). This gives us the latest registered version ofDepName
that is compatible with the[compat]
entry forDepName
.V
such that all changes fromV
to the result of step (iv) are backwards-compatible.Pkg.test
runs thetests/runtests.jl
file.The algorithm for computing step (v) above is as follows. The input is a version number of the form
x.y.z
.x > 0
, returnx.0.0
. (This is because, forx > 0
, all changes fromx.0.0
tox.y.z
are backwards-compatible.)y > 0
, return0.y.0
. (This is because, fory > 0
, all changes from0.y.0
to0.y.z
are backwards-compatible.)0.0.z
.After this PR:
Pkg.test
sets up the temporary sandbox project.force_latest_compatible_version
isfalse
, we do nothing. Ifforce_latest_compatible_version
istrue
, we assemble the list of all direct dependencies, and then loop over the list. For each direct dependencyDepName
, we check if the project has a[compat]
entry forDepName
. If the project does not have a[compat]
entry forDepName
, we do nothing. If the project has a[compat]
entry forDepName
, we take the following steps:[compat]
entry forDepName
.DepName
.[compat]
entry forDepName
. At the end of this step, we have a list of all registered versions ofDepName
that are compatible with the original[compat]
entry forDepName
.maximum
of the list from step (iii). This gives us the latest registered version ofDepName
that is compatible with the original[compat]
entry forDepName
.V
such that all changes fromV
to the result of step (iv) are backwards-compatible. The result of this step is a version numberV
of the formmajor.minor.patch
.[compat]
entry forDepName
and set the new[compat]
entry forDepName
to"^major.minor.patch"
, where the numbersmajor
,minor
, andpatch
are taken from the result of step (v).Pkg.test
runs the resolver inside the temporary sandbox project. Note that this will use the new[compat]
entries that we generated.Pkg.test
runs thetests/runtests.jl
file.The algorithm for computing step (v) above is as follows. The input is a version number of the form
x.y.z
.x > 0
, returnx.0.0
. (This is because, forx > 0
, all changes fromx.0.0
tox.y.z
are backwards-compatible.)y > 0
, return0.y.0
. (This is because, fory > 0
, all changes from0.y.0
to0.y.z
are backwards-compatible.)0.0.z
.