Skip to content

Commit

Permalink
BUGFIX: Exclude unlisted NuGet packages in Resolver - fixes #327
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Nov 6, 2014
1 parent 1ff5bd8 commit 502708e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 0.11.16 - 06.11.2014
* BUGFIX: Exclude unlisted NuGet packages in Resolver - https://github.com/fsprojects/Paket/issues/327

#### 0.11.15 - 06.11.2014
* BUGFIX: Detect Lib folder on Linux - https://github.com/fsprojects/Paket/issues/332

Expand Down
1 change: 1 addition & 0 deletions src/Paket.Core/LockFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ module LockFileParser =
{ Source = PackageSource.Parse(remote, None)
Name = parts.[0]
Dependencies = Set.empty
Unlisted = false
Version = SemVer.Parse version } :: state.Packages }
| None -> failwith "no source has been specified."
| NugetDependency (name, _) ->
Expand Down
7 changes: 5 additions & 2 deletions src/Paket.Core/PackageResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type ResolvedPackage =
{ Name : string
Version : SemVerInfo
Dependencies : (string * VersionRequirement * (FrameworkIdentifier option)) Set
Unlisted : bool
Source : PackageSource }

override this.ToString() = sprintf "%s %s" this.Name (this.Version.ToString())
Expand Down Expand Up @@ -86,6 +87,7 @@ let Resolve(getVersionsF, getPackageDetailsF, rootDependencies:PackageRequiremen
{ Name = packageDetails.Name
Version = version
Dependencies = packageDetails.DirectDependencies
Unlisted = packageDetails.Unlisted
Source = packageDetails.Source }
exploredPackages.Add((packageName.ToLower(),version),explored)
explored
Expand Down Expand Up @@ -160,7 +162,8 @@ let Resolve(getVersionsF, getPackageDetailsF, rootDependencies:PackageRequiremen
|> List.fold (fun state versionToExplore ->
match state with
| ResolvedPackages.Conflict _ ->
let exploredPackage = getExploredPackage(dependency.Sources,dependency.Name,versionToExplore)
let exploredPackage = getExploredPackage(dependency.Sources,dependency.Name,versionToExplore)
if exploredPackage.Unlisted then state else
let newFilteredVersion = Map.add dependency.Name ([versionToExplore],globalOverride) filteredVersions
let newDependencies =
exploredPackage.Dependencies
Expand All @@ -180,7 +183,7 @@ let Resolve(getVersionsF, getPackageDetailsF, rootDependencies:PackageRequiremen

improveModel (newFilteredVersion,exploredPackage::packages,Set.add dependency closed,Set.union rest newDependencies)
| ResolvedPackages.Ok _ -> state)
(ResolvedPackages.Conflict(closed,stillOpen))
(ResolvedPackages.Conflict(closed,stillOpen))

match improveModel (Map.empty, [], Set.empty, Set.ofList rootDependencies) with
| ResolvedPackages.Conflict(_) as c -> c
Expand Down
1 change: 1 addition & 0 deletions tests/Paket.Tests/Simplifier/BasicScenarioSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let toPackages =
{ Name = name
Version = SemVer.Parse ver
Source = PackageSources.DefaultNugetSource
Unlisted = false
Dependencies = deps |> List.map (fun (name, verRan) -> name, NugetVersionRangeParser.parse verRan,None) |> Set.ofList } : PackageResolver.ResolvedPackage)

let graph1 =
Expand Down

0 comments on commit 502708e

Please sign in to comment.