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.testsets up the temporary sandbox project.Pkg.testruns the resolver inside the temporary sandbox project.force_latest_compatible_versionisfalse, we do nothing. Ifforce_latest_compatible_versionistrue, we assemble the list of all direct dependencies, and then loop over the list; for each direct dependencyDepName, we take the following steps:DepNamethe resolver selected.DepName.[compat]entry forDepName. At the end of this step, we have a list of all registered versions ofDepNamethat are compatible with the[compat]entry forDepName.maximumof the list from step (iii). This gives us the latest registered version ofDepNamethat is compatible with the[compat]entry forDepName.Vsuch that all changes fromVto the result of step (iv) are backwards-compatible.Pkg.testruns thetests/runtests.jlfile.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.0tox.y.zare backwards-compatible.)y > 0, return0.y.0. (This is because, fory > 0, all changes from0.y.0to0.y.zare backwards-compatible.)0.0.z.After this PR:
Pkg.testsets up the temporary sandbox project.force_latest_compatible_versionisfalse, we do nothing. Ifforce_latest_compatible_versionistrue, 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 ofDepNamethat are compatible with the original[compat]entry forDepName.maximumof the list from step (iii). This gives us the latest registered version ofDepNamethat is compatible with the original[compat]entry forDepName.Vsuch that all changes fromVto the result of step (iv) are backwards-compatible. The result of this step is a version numberVof the formmajor.minor.patch.[compat]entry forDepNameand set the new[compat]entry forDepNameto"^major.minor.patch", where the numbersmajor,minor, andpatchare taken from the result of step (v).Pkg.testruns the resolver inside the temporary sandbox project. Note that this will use the new[compat]entries that we generated.Pkg.testruns thetests/runtests.jlfile.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.0tox.y.zare backwards-compatible.)y > 0, return0.y.0. (This is because, fory > 0, all changes from0.y.0to0.y.zare backwards-compatible.)0.0.z.