Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed restore after paket.lock is created.
  • Loading branch information
xavierzwirtz committed Nov 9, 2015
commit a093443e721d8e2b7e128e42e446ed24ebaca0b6
11 changes: 9 additions & 2 deletions src/Paket.Core/NuGetV2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ let DownloadLicense(root,force,packageName:PackageName,version:SemVerInfo,licens
}

/// Downloads the given package to the NuGet Cache folder
let DownloadPackage(root, auth, url, groupName, packageName:PackageName, version:SemVerInfo, includeVersionInPath, force) =
let DownloadPackage(root, auth, (source : PackageSource), groupName, packageName:PackageName, version:SemVerInfo, includeVersionInPath, force) =
async {
let targetFileName = Path.Combine(CacheFolder, packageName.ToString() + "." + version.Normalize() + ".nupkg")
let targetFile = FileInfo targetFileName
Expand All @@ -493,7 +493,14 @@ let DownloadPackage(root, auth, url, groupName, packageName:PackageName, version
verbosefn "%O %O already downloaded." packageName version
else
// discover the link on the fly
let! nugetPackage = getDetailsFromNuGet force auth url packageName version
let url, nugetPackage =
match source with
| Nuget source ->
source.Url, (getDetailsFromNuGet force auth source.Url packageName version)
| NugetV3 source ->
source.Url, (NuGetV3.GetPackageDetails source packageName version)
| _ -> failwith "shouldnt be here"
let! nugetPackage = nugetPackage
try
tracefn "Downloading %O %O" packageName version
verbosefn " to %s" targetFileName
Expand Down
9 changes: 7 additions & 2 deletions src/Paket.Core/PackageSources.fs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,16 @@ type NugetV3Source(url : string,
authentication : NugetSourceAuthentication option,
basicAuthentication : Auth option,
resources : Map<string, string>) =

let normalizeUrl (value : string) =
if value.EndsWith "/" then
value
else
value + "/"

let getResource (resourceType : string) =
match resources |> Map.tryFind (resourceType.ToLower()) with
| None -> failwithf "could not find an %s endpoint" resourceType
| Some x -> x
| Some x -> normalizeUrl x
let searchautoCompleteService = lazy((getResource "SearchAutoCompleteService"))
let registrationsBaseUrl = lazy((getResource "RegistrationsBaseUrl"))
member this.Url = url
Expand Down
19 changes: 5 additions & 14 deletions src/Paket.Core/RestoreProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ open Paket.PackageResolver
open Paket.PackageSources
open FSharp.Polyfill

let private extractPackage package root auth sourceUrl groupName version includeVersionInPath force =
let private extractPackage package root auth source groupName version includeVersionInPath force =
async {
try
let! folder = NuGetV2.DownloadPackage(root, auth, sourceUrl, groupName, package.Name, version, includeVersionInPath, force)
let! folder = NuGetV2.DownloadPackage(root, auth, source, groupName, package.Name, version, includeVersionInPath, force)
return package, NuGetV2.GetLibFiles folder, NuGetV2.GetTargetsFiles folder, NuGetV2.GetAnalyzerFiles folder
with _ when not force ->
tracefn "Something went wrong while downloading %O %A - Trying again." package.Name version
let! folder = NuGetV2.DownloadPackage(root, auth, sourceUrl, groupName, package.Name, version, includeVersionInPath, true)
let! folder = NuGetV2.DownloadPackage(root, auth, source, groupName, package.Name, version, includeVersionInPath, true)
return package, NuGetV2.GetLibFiles folder, NuGetV2.GetTargetsFiles folder, NuGetV2.GetAnalyzerFiles folder
}
/// Downloads and extracts a package.
Expand All @@ -25,23 +25,14 @@ let ExtractPackage(root, groupName, sources, force, package : ResolvedPackage) =
let v = package.Version
let includeVersionInPath = defaultArg package.Settings.IncludeVersionInPath false
match package.Source with
| Nuget source ->
| Nuget _ | NugetV3 _ ->
let auth =
sources |> List.tryPick (fun s ->
match s with
| Nuget s -> s.Authentication |> Option.map toBasicAuth
| _ -> None)
let! result =
extractPackage package root auth source.Url groupName v includeVersionInPath force
return result
| NugetV3 source ->
let auth =
sources |> List.tryPick (fun s ->
match s with
| Nuget s -> s.Authentication |> Option.map toBasicAuth
| _ -> None)
let! result =
extractPackage package root auth source.Url groupName v includeVersionInPath force
extractPackage package root auth package.Source groupName v includeVersionInPath force
return result
| LocalNuget path ->
let path = Utils.normalizeLocalPath path
Expand Down