Skip to content

Commit

Permalink
Better logging in error reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed May 11, 2017
1 parent 5c6e7bc commit 5e9c716
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### 5.0.0-alpha022 - 11.05.2017
#### 5.0.0-alpha023 - 11.05.2017
* BUGFIX: Fixed dotnetcore integration:
* Paket now properly understands runtime and reference assemblies
* Paket now understands the runtime graph and restores runtime dependencies
Expand Down
4 changes: 2 additions & 2 deletions src/Paket.Bootstrapper/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
[assembly: AssemblyDescriptionAttribute("A dependency manager for .NET with support for NuGet packages and git repositories.")]
[assembly: AssemblyVersionAttribute("5.0.0")]
[assembly: AssemblyFileVersionAttribute("5.0.0")]
[assembly: AssemblyInformationalVersionAttribute("5.0.0-alpha022")]
[assembly: AssemblyInformationalVersionAttribute("5.0.0-alpha023")]
namespace System {
internal static class AssemblyVersionInformation {
internal const System.String AssemblyTitle = "Paket.Bootstrapper";
internal const System.String AssemblyProduct = "Paket";
internal const System.String AssemblyDescription = "A dependency manager for .NET with support for NuGet packages and git repositories.";
internal const System.String AssemblyVersion = "5.0.0";
internal const System.String AssemblyFileVersion = "5.0.0";
internal const System.String AssemblyInformationalVersion = "5.0.0-alpha022";
internal const System.String AssemblyInformationalVersion = "5.0.0-alpha023";
}
}
4 changes: 2 additions & 2 deletions src/Paket.Core/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ open System.Reflection
[<assembly: AssemblyDescriptionAttribute("A dependency manager for .NET with support for NuGet packages and git repositories.")>]
[<assembly: AssemblyVersionAttribute("5.0.0")>]
[<assembly: AssemblyFileVersionAttribute("5.0.0")>]
[<assembly: AssemblyInformationalVersionAttribute("5.0.0-alpha022")>]
[<assembly: AssemblyInformationalVersionAttribute("5.0.0-alpha023")>]
do ()

module internal AssemblyVersionInformation =
Expand All @@ -18,4 +18,4 @@ module internal AssemblyVersionInformation =
let [<Literal>] AssemblyDescription = "A dependency manager for .NET with support for NuGet packages and git repositories."
let [<Literal>] AssemblyVersion = "5.0.0"
let [<Literal>] AssemblyFileVersion = "5.0.0"
let [<Literal>] AssemblyInformationalVersion = "5.0.0-alpha022"
let [<Literal>] AssemblyInformationalVersion = "5.0.0-alpha023"
32 changes: 19 additions & 13 deletions src/Paket.Core/Dependencies/PackageResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -157,29 +157,35 @@ module Resolution =
|> Seq.toList

let buildConflictReport (errorReport:StringBuilder) (conflicts:PackageRequirement list) =
let formatVR (vr:VersionRequirement) =
vr.ToString ()
|> fun s -> if String.IsNullOrWhiteSpace s then ">= 0" else s

let formatPR hasPrereleases (vr:VersionRequirement) =
if hasPrereleases && vr.PreReleases = PreReleaseStatus.No then " (no prereleases)" else
match vr.PreReleases with
| PreReleaseStatus.Concrete [x] -> sprintf " (%s)" x
| PreReleaseStatus.Concrete x -> sprintf " %A" x
| _ -> ""

match conflicts with
| [] -> errorReport
| req::conflicts ->
let hasPrereleases = List.exists (fun r -> r.VersionRequirement.PreReleases <> PreReleaseStatus.No) conflicts

match req.Parent with
| DependenciesFile _ ->
errorReport.AddLine (sprintf " Could not resolve package %O %O (from dependencies file):" req.Name req.VersionRequirement.Range)
errorReport.AddLine (sprintf " Dependencies file requested package %O: %s%s" req.Name (formatVR req.VersionRequirement) (formatPR hasPrereleases req.VersionRequirement))
| Package (parentName,version,_) ->
errorReport.AddLine (sprintf " Could not resolve package %O %O (from %O %O):" req.Name req.VersionRequirement.Range parentName version)
let hasPrereleases =
conflicts |> List.exists (fun r -> r.VersionRequirement.PreReleases <> PreReleaseStatus.No)

errorReport.AddLine (sprintf " %O %O package %O: %s%s" parentName version req.Name (formatVR req.VersionRequirement) (formatPR hasPrereleases req.VersionRequirement))

let rec loop conflicts (errorReport:StringBuilder) =
match conflicts with
| [] -> errorReport
| hd::tl ->
let vr =
hd.VersionRequirement.ToString ()
|> fun s -> if String.IsNullOrWhiteSpace s then ">= 0" else s
let pr = if hasPrereleases && hd.VersionRequirement.PreReleases = PreReleaseStatus.No then " (no prereleases)" else
match hd.VersionRequirement.PreReleases with
| PreReleaseStatus.Concrete [x] -> sprintf " (%s)" x
| PreReleaseStatus.Concrete x -> sprintf " %A" x
| _ -> ""
let vr = formatVR hd.VersionRequirement
let pr = formatPR hasPrereleases hd.VersionRequirement

match hd.Parent with
| DependenciesFile _ ->
loop tl (errorReport.AppendLinef " - Dependencies file requested package %O: %s%s" req.Name vr pr)
Expand Down
4 changes: 2 additions & 2 deletions src/Paket/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ open System.Reflection
[<assembly: AssemblyDescriptionAttribute("A dependency manager for .NET with support for NuGet packages and git repositories.")>]
[<assembly: AssemblyVersionAttribute("5.0.0")>]
[<assembly: AssemblyFileVersionAttribute("5.0.0")>]
[<assembly: AssemblyInformationalVersionAttribute("5.0.0-alpha022")>]
[<assembly: AssemblyInformationalVersionAttribute("5.0.0-alpha023")>]
do ()

module internal AssemblyVersionInformation =
Expand All @@ -18,4 +18,4 @@ module internal AssemblyVersionInformation =
let [<Literal>] AssemblyDescription = "A dependency manager for .NET with support for NuGet packages and git repositories."
let [<Literal>] AssemblyVersion = "5.0.0"
let [<Literal>] AssemblyFileVersion = "5.0.0"
let [<Literal>] AssemblyInformationalVersion = "5.0.0-alpha022"
let [<Literal>] AssemblyInformationalVersion = "5.0.0-alpha023"
4 changes: 2 additions & 2 deletions tests/Paket.Tests/Resolver/ConflictGraphSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ let ``should resolve simple config with servers with RC requirement``() =
|> ignore
failwith "expected exception"
with
| exn when exn.Message.Contains " Could not resolve package My.Company.PackageA.Server" -> ()
| exn when exn.Message.Contains " package My.Company.PackageA.Server" -> ()

let configWithServersWithVersionRequirement = """
source https://www.nuget.org/api/v2
Expand All @@ -183,7 +183,7 @@ let ``should resolve simple config with servers with version requirement``() =
|> ignore
failwith "expected exception"
with
| exn when exn.Message.Contains " Could not resolve package My.Company.PackageA.Server" -> ()
| exn when exn.Message.Contains " package My.Company.PackageA.Server" -> ()


let configWithServersWithoutVersionRequirement = """
Expand Down

0 comments on commit 5e9c716

Please sign in to comment.