diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c4c075a667..dfff42887b 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,17 +1,10 @@ -#### 2.15.9 - 21.10.2015 -* USABILITY: If caching fails we should recover - https://github.com/fsprojects/Paket/issues/1152 - -#### 2.15.8 - 20.10.2015 -* Try to report better error when file is blocked by Firewall - https://github.com/fsprojects/Paket/pull/1155 - -#### 2.15.7 - 20.10.2015 -* Check that download http status code was 200 - -#### 2.15.6 - 19.10.2015 +#### 2.16.0-alpha004 - 21.10.2015 * Log Request performance - -#### 2.15.5 - 19.10.2015 +* Check that download http status code was 200 +* Try to report better error when file is blocked by Firewall - https://github.com/fsprojects/Paket/pull/1155 * BUGFIX: Fixed loading of Project files on mono - https://github.com/fsprojects/Paket/pull/1149 +* PERFORMANCE: Caching proxy scheme - https://github.com/fsprojects/Paket/pull/1153 +* USABILITY: If caching fails we should recover - https://github.com/fsprojects/Paket/issues/1152 #### 2.15.1 - 17.10.2015 * BUGFIX: Fixed framework restriction filter - https://github.com/fsprojects/Paket/pull/1146 diff --git a/src/Paket.Bootstrapper/Properties/AssemblyInfo.cs b/src/Paket.Bootstrapper/Properties/AssemblyInfo.cs index 43c64c213d..23d255b999 100644 --- a/src/Paket.Bootstrapper/Properties/AssemblyInfo.cs +++ b/src/Paket.Bootstrapper/Properties/AssemblyInfo.cs @@ -4,11 +4,11 @@ [assembly: AssemblyTitleAttribute("Paket.Bootstrapper")] [assembly: AssemblyProductAttribute("Paket")] [assembly: AssemblyDescriptionAttribute("A package dependency manager for .NET with support for NuGet packages and GitHub repositories.")] -[assembly: AssemblyVersionAttribute("2.15.9")] -[assembly: AssemblyFileVersionAttribute("2.15.9")] -[assembly: AssemblyInformationalVersionAttribute("2.15.9")] +[assembly: AssemblyVersionAttribute("2.16.0")] +[assembly: AssemblyFileVersionAttribute("2.16.0")] +[assembly: AssemblyInformationalVersionAttribute("2.16.0-alpha004")] namespace System { internal static class AssemblyVersionInformation { - internal const string Version = "2.15.9"; + internal const string Version = "2.16.0"; } } diff --git a/src/Paket.Core/AssemblyInfo.fs b/src/Paket.Core/AssemblyInfo.fs index 4cbfb2a0c0..a400b583db 100644 --- a/src/Paket.Core/AssemblyInfo.fs +++ b/src/Paket.Core/AssemblyInfo.fs @@ -5,10 +5,10 @@ open System.Reflection [] [] [] -[] -[] -[] +[] +[] +[] do () module internal AssemblyVersionInformation = - let [] Version = "2.15.9" + let [] Version = "2.16.0" diff --git a/src/Paket.Core/NuGetV2.fs b/src/Paket.Core/NuGetV2.fs index 9311b3b385..2ebd0ae044 100644 --- a/src/Paket.Core/NuGetV2.fs +++ b/src/Paket.Core/NuGetV2.fs @@ -62,15 +62,12 @@ let rec private followODataLink auth url = } - let tryGetAllVersionsFromNugetODataWithFilter (auth, nugetURL, package:PackageName) = async { try - let sw = System.Diagnostics.Stopwatch.StartNew() let url = sprintf "%s/Packages?$filter=Id eq '%O'" nugetURL package verbosefn "getAllVersionsFromNugetODataWithFilter from url '%s'" url let! result = followODataLink auth url - traceVerbose <| sprintf "PERF: ODataWithFilter %O: %dms" package sw.ElapsedMilliseconds return Some result with _ -> return None } @@ -78,18 +75,15 @@ let tryGetAllVersionsFromNugetODataWithFilter (auth, nugetURL, package:PackageNa let tryGetPackageVersionsViaOData (auth, nugetURL, package:PackageName) = async { try - let sw = System.Diagnostics.Stopwatch.StartNew() let url = sprintf "%s/FindPackagesById()?id='%O'" nugetURL package verbosefn "getAllVersionsFromNugetOData from url '%s'" url let! result = followODataLink auth url - traceVerbose <| sprintf "PERF: OData %O: %dms" package sw.ElapsedMilliseconds return Some result with _ -> return None } let tryGetPackageVersionsViaJson (auth, nugetURL, package:PackageName) = async { - let sw = System.Diagnostics.Stopwatch.StartNew() let url = sprintf "%s/package-versions/%O?includePrerelease=true" nugetURL package let! raw = safeGetFromUrl (auth, url, acceptJson) @@ -97,22 +91,18 @@ let tryGetPackageVersionsViaJson (auth, nugetURL, package:PackageName) = | None -> return None | Some data -> try - traceVerbose <| sprintf "PERF: json %O: %dms" package sw.ElapsedMilliseconds return Some(JsonConvert.DeserializeObject data) with _ -> return None } let tryNuGetV3 (auth, nugetV3Url, package:PackageName) = - async { - try - let sw = System.Diagnostics.Stopwatch.StartNew() + async { + try let! data = NuGetV3.findVersionsForPackage(nugetV3Url, auth, package, true, 100000) match data with | Some data when Array.isEmpty data -> return None | None -> return None - | _ -> - traceVerbose <| sprintf "PERF: V3 %O: %dms" package sw.ElapsedMilliseconds - return data + | _ -> return data with exn -> return None } diff --git a/src/Paket.Core/SemVer.fs b/src/Paket.Core/SemVer.fs index 6eacac0b74..f0967a502c 100644 --- a/src/Paket.Core/SemVer.fs +++ b/src/Paket.Core/SemVer.fs @@ -65,6 +65,8 @@ type PreRelease = match yobj with | :? PreRelease as y -> x.Origin = y.Origin | _ -> false + + override x.ToString() = x.Origin override x.GetHashCode() = hash x.Origin interface System.IComparable with @@ -171,7 +173,7 @@ module SemVer = let firstDash = version.IndexOf("-") let plusIndex = version.IndexOf("+") - let majorMinorPatch = + let majorMinorPatch = let firstSigil = if firstDash > 0 then firstDash else plusIndex match firstSigil with | -1 -> version @@ -181,7 +183,7 @@ module SemVer = match firstDash, plusIndex with | -1, _ -> "" | d, p when p = -1 -> version.Substring(d+1) - | d, p -> version.Substring(d+1, (version.Length - 1 - p) ) + | d, p -> version.Substring(d+1, (version.Length - 1 - p) ) /// there can only be one piece of build metadata, and it is signified by a + and then any number of dot-separated alphanumeric groups. /// this just greedily takes the whole remaining string :( diff --git a/src/Paket.Core/Utils.fs b/src/Paket.Core/Utils.fs index fab39fb42d..058aaf0f29 100644 --- a/src/Paket.Core/Utils.fs +++ b/src/Paket.Core/Utils.fs @@ -127,7 +127,7 @@ let envProxies () = let getEnvValue (name:string) = let v = Environment.GetEnvironmentVariable(name.ToUpperInvariant()) // under mono, env vars are case sensitive - if v = null then Environment.GetEnvironmentVariable(name.ToLowerInvariant()) else v + if isNull v then Environment.GetEnvironmentVariable(name.ToLowerInvariant()) else v let bypassList = let noproxy = getEnvValue "NO_PROXY" if String.IsNullOrEmpty(noproxy) then [||] else @@ -141,7 +141,7 @@ let envProxies () = let getProxy (scheme:string) = let envVarName = sprintf "%s_PROXY" (scheme.ToUpperInvariant()) let envVarValue = getEnvValue envVarName - if envVarValue = null then + if isNull envVarValue then None else match Uri.TryCreate(envVarValue, UriKind.Absolute) with @@ -159,24 +159,35 @@ let envProxies () = | _ -> map [ "http"; "https" ] - |> List.fold addProxy Map.empty + |> List.fold addProxy Map.empty + +let calcEnvProxies = lazy (envProxies()) + +let private proxies = System.Collections.Concurrent.ConcurrentDictionary<_,_>() let getDefaultProxyFor url = let uri = new Uri(url) - let getDefault () = - let result = WebRequest.GetSystemWebProxy() - let address = result.GetProxy(uri) - - if address = uri then null else - let proxy = new WebProxy(address) - proxy.Credentials <- CredentialCache.DefaultCredentials - proxy.BypassProxyOnLocal <- true + let key = uri.Host,uri.Port,uri.Scheme + match proxies.TryGetValue key with + | true,proxy -> proxy + | _ -> + let getDefault () = + let result = WebRequest.GetSystemWebProxy() + let address = result.GetProxy(uri) + + if address = uri then null else + let proxy = new WebProxy(address) + proxy.Credentials <- CredentialCache.DefaultCredentials + proxy.BypassProxyOnLocal <- true + proxy + + let proxy = + match calcEnvProxies.Force().TryFind uri.Scheme with + | Some p -> if p.GetProxy(uri) <> uri then p else getDefault() + | None -> getDefault() + proxies.TryAdd(key,proxy) |> ignore proxy - match envProxies().TryFind uri.Scheme with - | Some p -> if p.GetProxy(uri) <> uri then p else getDefault() - | None -> getDefault() - let inline createWebClient(url,auth:Auth option) = let client = new WebClient() match auth with @@ -188,7 +199,7 @@ let inline createWebClient(url,auth:Auth option) = //ONLY after a 401 //client.Credentials <- new NetworkCredential(auth.Username,auth.Password) - //so use THIS instead to send credenatials RIGHT AWAY + //so use THIS instead to send credentials RIGHT AWAY let credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(username + ":" + password)) client.Headers.[HttpRequestHeader.Authorization] <- sprintf "Basic %s" credentials | Some(Token token) -> client.Headers.[HttpRequestHeader.Authorization] <- sprintf "token %s" token @@ -253,12 +264,13 @@ let getXmlFromUrl (auth:Auth option, url : string) = let safeGetFromUrl (auth:Auth option, url : string, contentType : string) = async { try + let uri = Uri(url) use client = createWebClient(url,auth) if notNullOrEmpty contentType then client.Headers.Add(HttpRequestHeader.Accept, contentType) - let s = client.DownloadStringTaskAsync(Uri(url)) |> Async.AwaitTask + let s = client.DownloadStringTaskAsync(uri) |> Async.AwaitTask let! raw = s return Some raw with _ -> return None diff --git a/src/Paket.PowerShell/AssemblyInfo.fs b/src/Paket.PowerShell/AssemblyInfo.fs index 2b60aaba0f..8d617e6e89 100644 --- a/src/Paket.PowerShell/AssemblyInfo.fs +++ b/src/Paket.PowerShell/AssemblyInfo.fs @@ -5,10 +5,10 @@ open System.Reflection [] [] [] -[] -[] -[] +[] +[] +[] do () module internal AssemblyVersionInformation = - let [] Version = "2.15.9" + let [] Version = "2.16.0" diff --git a/src/Paket/AssemblyInfo.fs b/src/Paket/AssemblyInfo.fs index 18cb2a1ae6..39c9fb9c71 100644 --- a/src/Paket/AssemblyInfo.fs +++ b/src/Paket/AssemblyInfo.fs @@ -5,10 +5,10 @@ open System.Reflection [] [] [] -[] -[] -[] +[] +[] +[] do () module internal AssemblyVersionInformation = - let [] Version = "2.15.9" + let [] Version = "2.16.0" diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index c805fd9510..48c9badc3f 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -37,7 +37,7 @@ update group Build pack output D:\code\paketbug\output install - update -f + update Project paket.exe c:\code\Paketkopie diff --git a/tests/Paket.Tests/SemVerSpecs.fs b/tests/Paket.Tests/SemVerSpecs.fs index 5d373e6c72..2e3623759b 100644 --- a/tests/Paket.Tests/SemVerSpecs.fs +++ b/tests/Paket.Tests/SemVerSpecs.fs @@ -118,6 +118,31 @@ let ``can normalize CI versions in prerelease``() = let ``should parse very large prerelease numbers (aka timestamps)``() = (SemVer.Parse "0.22.0-pre20150223185624").Normalize() |> shouldEqual "0.22.0-pre20150223185624" +[] +let ``should parse paket prerelease versions``() = + let v = SemVer.Parse "1.2.3-alpha002" + + v.Major |> shouldEqual 1u + v.Minor |> shouldEqual 2u + v.Patch |> shouldEqual 3u + v.PreRelease.Value.ToString() |> shouldEqual "alpha002" + v.PreRelease.Value.Name |> shouldEqual "alpha" + + +[] +let ``should parse CoreClr prerelease versions``() = + let v = SemVer.Parse "1.2.3-beta-22819" + + v.Major |> shouldEqual 1u + v.Minor |> shouldEqual 2u + v.Patch |> shouldEqual 3u + v.PreRelease.Value.ToString() |> shouldEqual "beta-22819" + v.PreRelease.Value.Name |> shouldEqual "beta" + +[] +let ``should compare CoreClr prerelease versions``() = + (SemVer.Parse "1.2.3-beta-22819") |> shouldBeGreaterThan (SemVer.Parse "1.2.3-beta-22818") + (SemVer.Parse "1.2.3-beta-22817") |> shouldBeSmallerThan (SemVer.Parse "1.2.3-beta-22818") [] let ``version core elements must be non-negative (SemVer 2.0.0/2)`` () =