Skip to content

Commit df5e1c8

Browse files
committed
Parse new resolver settings as group setting
1 parent 0e5cde8 commit df5e1c8

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/Paket.Core/Dependencies/DependenciesFileParser.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ module DependenciesFileParser =
326326
let setting =
327327
match trimmed.Replace(":","").Trim() with
328328
| String.EqualsIC "max" -> Some ResolverStrategy.Max
329+
| String.EqualsIC "latest-patch" -> Some ResolverStrategy.LatestPatch
330+
| String.EqualsIC "latest-minor" -> Some ResolverStrategy.LatestMinor
329331
| String.EqualsIC "min" -> Some ResolverStrategy.Min
330332
| _ -> None
331333

src/Paket.Core/Versioning/VersionRange.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,4 +389,6 @@ type VersionRequirement =
389389
[<RequireQualifiedAccess>]
390390
type ResolverStrategy =
391391
| Max
392-
| Min
392+
| LatestPatch
393+
| LatestMinor
394+
| Min

tests/Paket.Tests/DependenciesFile/ParserSpecs.fs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,15 @@ let ``should read config with min and max strategy``() =
10861086
cfg.Groups.[GroupName "Test"].Options.ResolverStrategyForTransitives |> shouldEqual (Some ResolverStrategy.Max)
10871087

10881088
cfg.Groups.[Constants.MainDependencyGroup].Sources |> shouldEqual [PackageSource.NuGetV2Source "http://www.nuget.org/api/v2"]
1089+
1090+
1091+
[<Test>]
1092+
let ``should read config with latest-patch and latest-minor strategy``() =
1093+
let cfg = DependenciesFile.FromSource(strategyConfig "latest-patch" "latest-minor")
1094+
cfg.Groups.[Constants.MainDependencyGroup].Options.ResolverStrategyForTransitives |> shouldEqual (Some ResolverStrategy.LatestPatch)
1095+
cfg.Groups.[GroupName "Test"].Options.ResolverStrategyForTransitives |> shouldEqual (Some ResolverStrategy.LatestMinor)
1096+
1097+
cfg.Groups.[Constants.MainDependencyGroup].Sources |> shouldEqual [PackageSource.NuGetV2Source "http://www.nuget.org/api/v2"]
10891098

10901099
let noStrategyConfig = sprintf """
10911100
strategy %s

0 commit comments

Comments
 (0)