Skip to content

Commit

Permalink
Fix error message when resolver already resolved to GlobalOverride - f…
Browse files Browse the repository at this point in the history
…ixes #1142
  • Loading branch information
forki committed Oct 16, 2015
1 parent efe6bd8 commit f545c3c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 2.14.3 - 16.10.2015
* COSMETICS: Fix error message when resolver already resolved to GlobalOverride - https://github.com/fsprojects/Paket/issues/1142

#### 2.14.2 - 16.10.2015
* PERFORMANCE: Use locked version as prefered version when resolver strategy is min - https://github.com/fsprojects/Paket/pull/1141

Expand Down
12 changes: 10 additions & 2 deletions src/Paket.Core/PackageResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,16 @@ let calcOpenRequirements (exploredPackage:ResolvedPackage,globalFrameworkRestric
|> Set.filter (fun d ->
if Set.contains d stillOpen then false else
if Set.contains d closed then false else
if closed |> Seq.exists (fun x -> x.Name = d.Name && x.VersionRequirement.Range.IsIncludedIn d.VersionRequirement.Range) then false else
rest |> Seq.exists (fun x -> x.Name = d.Name && x.VersionRequirement.Range.IsIncludedIn d.VersionRequirement.Range) |> not)
if closed |> Seq.exists (fun x ->
x.Name = d.Name &&
(x.VersionRequirement.Range.IsIncludedIn d.VersionRequirement.Range ||
x.VersionRequirement.Range.IsGlobalOverride)) then
false
else
stillOpen |> Seq.exists (fun x ->
x.Name = d.Name &&
(x.VersionRequirement.Range.IsIncludedIn d.VersionRequirement.Range ||
x.VersionRequirement.Range.IsGlobalOverride)) |> not)
|> Set.union rest

type Resolved = {
Expand Down
4 changes: 2 additions & 2 deletions src/Paket.Core/VersionRange.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ type PreReleaseStatus =
| Concrete of string list

/// Represents version information.
type VersionRange =
type VersionRange =
| Minimum of SemVerInfo
| GreaterThan of SemVerInfo
| Maximum of SemVerInfo
| LessThan of SemVerInfo
| Specific of SemVerInfo
| Specific of SemVerInfo
| OverrideAll of SemVerInfo
| Range of fromB : VersionRangeBound * from : SemVerInfo * _to : SemVerInfo * _toB : VersionRangeBound

Expand Down
4 changes: 2 additions & 2 deletions src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
<StartArguments>update group Build</StartArguments>
<StartArguments>pack output D:\code\paketbug\output</StartArguments>
<StartArguments>install</StartArguments>
<StartArguments>update -f</StartArguments>
<StartArguments>update</StartArguments>
<StartAction>Project</StartAction>
<StartProgram>paket.exe</StartProgram>
<StartWorkingDirectory>c:\code\Paketkopie</StartWorkingDirectory>
<StartWorkingDirectory>C:\Temp\paket_test\</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\paketkopie</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\paketbug</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\paketrepro</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\Paket</StartWorkingDirectory>
<StartWorkingDirectory>c:\code\Paketkopie</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down
28 changes: 27 additions & 1 deletion tests/Paket.Tests/Resolver/ConflictGraphSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,30 @@ let ``should override graph2 conflict to first version``() =
[<Test>]
let ``should override graph2 conflict to second version``() =
let resolved = resolve graph2 ["A",VersionRange.AtLeast "1.0"; "D",VersionRange.OverrideAll(SemVer.Parse "1.6")]
getVersion resolved.[PackageName "D"] |> shouldEqual "1.6"
getVersion resolved.[PackageName "D"] |> shouldEqual "1.6"

let graph3 =
[ "A", "1.0",
[ "B", VersionRequirement(VersionRange.Exactly "1.1",PreReleaseStatus.No)
"C", VersionRequirement(VersionRange.Exactly "1.0",PreReleaseStatus.No) ]
"A", "1.1", []
"B", "1.0",
[ "A", VersionRequirement(VersionRange.Exactly "1.1",PreReleaseStatus.No)
"C", VersionRequirement(VersionRange.Exactly "2.0",PreReleaseStatus.No) ]
"B", "1.1", []
"C", "1.0", []
"C", "2.0", [] ]

[<Test>]
let ``should override graph3 conflict to package C``() =
let resolved =
safeResolve graph3
["A",VersionRange.OverrideAll(SemVer.Parse "1.0")
"B",VersionRange.OverrideAll(SemVer.Parse "1.0")]

match resolved with
| Resolution.Ok _ -> failwith "we expected an error"
| Resolution.Conflict(_,stillOpen,_) ->
let conflicting = stillOpen |> Seq.head
conflicting.Name
|> shouldEqual (PackageName "C")

0 comments on commit f545c3c

Please sign in to comment.