Skip to content

Commit

Permalink
Version in path and load scripts should work together - fixes #2534
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jul 17, 2017
1 parent e3d7acb commit 1efeae3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 5.7.2 - 17.07.2017
* BUGFIX: Version in path and load scripts should work together - https://github.com/fsprojects/Paket/issues/2534

#### 5.7.1 - 17.07.2017
* BUGFIX: Detect subfolders like "Lib" - https://github.com/fsprojects/Paket/issues/2533

Expand Down
6 changes: 5 additions & 1 deletion src/Paket.Core/Dependencies/NuGet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ let ofFiles filesList =
|> Seq.fold (fun state file -> addContent file state) []

let GetContent dir =
let di = DirectoryInfo(dir)
if not di.Exists then
failwithf "%s doesn't exist. nuspec file can't be loaded." di.FullName

let spec =
DirectoryInfo(dir).EnumerateFiles("*.nuspec", SearchOption.TopDirectoryOnly)
di.EnumerateFiles("*.nuspec", SearchOption.TopDirectoryOnly)
|> Seq.exactlyOne
|> fun f -> Nuspec.Load(f.FullName)
{ Content = (ofDirectory dir).Contents
Expand Down
15 changes: 9 additions & 6 deletions src/Paket.Core/PaketConfigFiles/DependencyCache.fs
Original file line number Diff line number Diff line change
Expand Up @@ -184,24 +184,27 @@ type DependencyCache (dependencyFile:DependenciesFile, lockFile:LockFile) =

member __.SetupGroup (groupName:GroupName) : bool =
if loadedGroups.Contains groupName then true else
match tryGet groupName orderedGroupCache with
match tryGet groupName orderedGroupCache with
| None -> false
| Some resolvedPackageList ->
let exprs =
if resolvedPackageList <> [] then
if verbose then
verbosefn "[ Loading packages from group - %O ]\n" groupName
resolvedPackageList |> List.map (fun package -> async {
resolvedPackageList
|> List.map (fun package -> async {
let packageName = package.Name
let groupFolder = if groupName = Constants.MainDependencyGroup then "" else "/" + groupName.CompareString
let folder = DirectoryInfo(sprintf "%s/packages%s/%O" lockFile.RootPath groupFolder packageName)
let nuspecShort = sprintf "/packages%s/%O/%O.nuspec" groupFolder packageName packageName
let folder =
getTargetFolder lockFile.RootPath groupName packageName package.Version (defaultArg package.Settings.IncludeVersionInPath false)
|> Path.GetFullPath

let nuspecShort = Path.Combine(folder, sprintf "%O.nuspec" packageName)
if verbose then
verbosefn " -- %s" nuspecShort
let nuspec = FileInfo <| Path.Combine (lockFile.RootPath,nuspecShort)
let nuspec = Nuspec.Load nuspec.FullName
nuspecCache.TryAdd((package.Name,package.Version),nuspec)|>ignore
let content = NuGet.GetContent(folder.FullName)
let content = NuGet.GetContent(folder)
let model = InstallModel.CreateFromContent(packageName, package.Version, Paket.Requirements.FrameworkRestriction.NoRestriction, content)
installModelCache.TryAdd((groupName,package.Name) , model) |> ignore
}) |> Array.ofSeq
Expand Down
8 changes: 5 additions & 3 deletions src/Paket.Core/PublicAPI.fs
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,11 @@ type Dependencies(dependenciesFileName: string) =
| None -> failwithf "Package %O is not installed in group %O." packageName groupName
| Some resolvedPackage ->
let packageName = resolvedPackage.Name
let groupFolder = if groupName = Constants.MainDependencyGroup then "" else "/" + groupName.CompareString
let folder = DirectoryInfo(sprintf "%s/packages%s/%O" this.RootPath groupFolder packageName)
let content = NuGet.GetContent(folder.FullName)
let folder =
getTargetFolder this.RootPath groupName packageName resolvedPackage.Version (defaultArg resolvedPackage.Settings.IncludeVersionInPath false)
|> Path.GetFullPath

let content = NuGet.GetContent folder
InstallModel.CreateFromContent(packageName, resolvedPackage.Version, Paket.Requirements.FrameworkRestriction.NoRestriction, content)

/// Returns all libraries for the given package and framework.
Expand Down
8 changes: 4 additions & 4 deletions src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<StartAction>Project</StartAction>
<StartProgram>paket.exe</StartProgram>
<StartAction>Project</StartAction>
<StartArguments>update</StartArguments>
<StartWorkingDirectory>C:\proj\testing\</StartWorkingDirectory>
<StartArguments>install</StartArguments>
<StartWorkingDirectory>D:\temp\test</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
Expand All @@ -42,8 +42,8 @@
<WarningLevel>3</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<StartArguments>convert-from-nuget</StartArguments>
<StartWorkingDirectory>D:\temp\convert\PaketReferenceBug</StartWorkingDirectory>
<StartArguments>install -v</StartArguments>
<StartWorkingDirectory>D:\temp\test</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup>
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">14.0</VisualStudioVersion>
Expand Down

0 comments on commit 1efeae3

Please sign in to comment.