Skip to content

Commit

Permalink
store prior step's flags to cut resolution time
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudRoutine committed Dec 3, 2016
1 parent cd6d161 commit 2625e15
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Paket.Core/PackageResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,9 @@ type private StepFlags (ready:bool,useUnlisted:bool,hasUnlisted:bool,forceBreak:


type private Stage =
| Step of currentConflict : (ConflictState * ResolverStep * PackageRequirement) * priorConflictSteps : (ConflictState * ResolverStep * PackageRequirement) list
| Outer of currentConflict : (ConflictState * ResolverStep * PackageRequirement) * priorConflictSteps : (ConflictState * ResolverStep * PackageRequirement) list
| Inner of currentConflict : (ConflictState * ResolverStep * PackageRequirement) * priorConflictSteps : (ConflictState * ResolverStep * PackageRequirement) list
| Step of currentConflict : (ConflictState * ResolverStep * PackageRequirement) * priorConflictSteps : (ConflictState * ResolverStep * PackageRequirement * StepFlags) list
| Outer of currentConflict : (ConflictState * ResolverStep * PackageRequirement) * priorConflictSteps : (ConflictState * ResolverStep * PackageRequirement * StepFlags) list
| Inner of currentConflict : (ConflictState * ResolverStep * PackageRequirement) * priorConflictSteps : (ConflictState * ResolverStep * PackageRequirement * StepFlags) list


/// Resolves all direct and transitive dependencies
Expand Down Expand Up @@ -637,11 +637,11 @@ let Resolve (getVersionsF, getPackageDetailsF, groupName:GroupName, globalStrate

let fuseConflicts currentConflict priorConflictSteps =
match currentConflict, priorConflictSteps with
| currentConflict, (lastConflict,lastStep,lastRequirement)::priorConflictSteps ->
| currentConflict, (lastConflict,lastStep,lastRequirement,lastFlags)::priorConflictSteps ->
let continueConflict =
{ currentConflict with VersionsToExplore = lastConflict.VersionsToExplore }

step (Inner((continueConflict,lastStep,lastRequirement),priorConflictSteps)) stackpack compatibleVersions flags
step (Inner((continueConflict,lastStep,lastRequirement),priorConflictSteps)) stackpack compatibleVersions lastFlags
| currentConflict, [] -> currentConflict

match stage with
Expand All @@ -652,7 +652,7 @@ let Resolve (getVersionsF, getPackageDetailsF, groupName:GroupName, globalStrate
Status = Resolution.Ok (cleanupNames currentStep.CurrentResolution) }

match currentConflict, priorConflictSteps with
| currentConflict, (lastConflict,lastStep,lastRequirement)::priorConflictSteps ->
| currentConflict, (lastConflict,lastStep,lastRequirement,lastFlags)::priorConflictSteps ->
let continueConflict = {
currentConflict with
VersionsToExplore = lastConflict.VersionsToExplore
Expand All @@ -666,7 +666,7 @@ let Resolve (getVersionsF, getPackageDetailsF, groupName:GroupName, globalStrate
r = lastRequirement
|| r.Graph |> List.contains lastRequirement)) ->
let flags =
StepFlags(flags.Ready,flags.UseUnlisted,flags.HasUnlisted,true,flags.FirstTrial)
StepFlags(lastFlags.Ready,lastFlags.UseUnlisted,lastFlags.HasUnlisted,true,lastFlags.FirstTrial)

step (Inner((continueConflict,lastStep,lastRequirement),priorConflictSteps)) stackpack compatibleVersions flags
| _ ->
Expand Down Expand Up @@ -784,7 +784,7 @@ let Resolve (getVersionsF, getPackageDetailsF, groupName:GroupName, globalStrate
This will result in an endless loop.%sCurrent Requirement: %A%sRequirements: %A"
Environment.NewLine currentRequirement Environment.NewLine nextStep.OpenRequirements

step (Step((currentConflict,nextStep,currentRequirement), (currentConflict,currentStep,currentRequirement)::priorConflictSteps)) stackpack compatibleVersions flags
step (Step((currentConflict,nextStep,currentRequirement), (currentConflict,currentStep,currentRequirement,flags)::priorConflictSteps)) stackpack compatibleVersions flags


let startingStep = {
Expand Down

0 comments on commit 2625e15

Please sign in to comment.