Skip to content

Commit

Permalink
Wrong paket ProjectRefences name causes incorrect packaging - fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Oct 7, 2015
1 parent 7e9bcfa commit 6192424
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 18 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 2.9.1 - 07.10.2015
* BUGFIX: Wrong paket ProjectRefences name causes incorrect packaging - https://github.com/fsprojects/Paket/issues/1113

#### 2.9.0 - 05.10.2015
* Allow to use GitHub tokens to access GitHub files - http://fsprojects.github.io/Paket/paket-config.html
* Allow to update a single group
Expand Down
11 changes: 5 additions & 6 deletions src/Paket.Core/PackageMetaData.fs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ let findDependencies (dependencies : DependenciesFile) config (template : Templa
let deps, files =
project.GetInterProjectDependencies()
|> Seq.fold (fun (deps, files) p ->
match Map.tryFind p.Name map with
match Map.tryFind p.Path map with
| Some packagedRef -> packagedRef :: deps, files
| None ->
let p =
Expand All @@ -172,7 +172,7 @@ let findDependencies (dependencies : DependenciesFile) config (template : Templa
[".xml"; ".dll"; ".exe"; ".pdb"; ".mdb"]
|> List.exists ((=) (f.Extension.ToLower()))

isSameFileName && isValidExtension)
isSameFileName && isValidExtension)
additionalFiles
|> Array.fold (fun template file -> addFile file.FullName targetDir template) template

Expand Down Expand Up @@ -214,7 +214,7 @@ let findDependencies (dependencies : DependenciesFile) config (template : Templa
|> Seq.map (fun kv -> kv.Value.NugetPackages |> List.map (fun p -> kv.Key,p))
|> List.concat
|> List.filter (fun (groupName,np) ->
try
try
// TODO: it would be nice if this data would be in the NuGet OData feed,
// then we would not need to parse every nuspec here
let info =
Expand All @@ -228,7 +228,7 @@ let findDependencies (dependencies : DependenciesFile) config (template : Templa
with
| _ -> true)
|> List.map (fun (groupName,np) ->
let dependencyVersionRequirement =
let dependencyVersionRequirement =
if not lockDependencies then
match dependencies.Groups |> Map.tryFind groupName with
| None -> None
Expand All @@ -249,8 +249,7 @@ let findDependencies (dependencies : DependenciesFile) config (template : Templa
// to current locked version
group.Resolution
|> Map.tryFind np.Name
|> Option.map (fun transient -> transient.Version)
|> Option.map (fun v -> VersionRequirement(Minimum v, PreReleaseStatus.No))
|> Option.map (fun transient -> VersionRequirement(Minimum transient.Version, PreReleaseStatus.No))
else
match lockFile.Groups |> Map.tryFind groupName with
| None -> None
Expand Down
8 changes: 1 addition & 7 deletions src/Paket.Core/PackageProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,7 @@ let Pack(workingDir,dependencies : DependenciesFile, packageOutputPath, buildCon
allTemplateFiles.Remove(templateFile.FileName) |> ignore

let merged = merge buildConfig version projectFile templateFile

let id =
match merged.Contents with
| CompleteInfo _ -> projectFile.NameWithoutExtension
| x -> failwithf "unexpected failure while merging meta data: %A" x

id,(merged,projectFile))
Path.GetFullPath projectFile.FileName,(merged,projectFile))
|> Map.ofArray

// add dependencies
Expand Down
8 changes: 6 additions & 2 deletions src/Paket.Core/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -566,14 +566,18 @@ type ProjectFile =
with
| _ -> Guid.Empty

member this.GetInterProjectDependencies() =
member this.GetInterProjectDependencies() =
let forceGetInnerText node name =
match node |> getNode name with
| Some n -> n.InnerText
| None -> failwithf "unable to parse %s" node.Name

[for node in this.Document |> getDescendants "ProjectReference" ->
{ Path = node.Attributes.["Include"].Value
{ Path =
let p = node.Attributes.["Include"].Value
if Path.IsPathRooted p then Path.GetFullPath p else
let di = FileInfo(this.FileName).Directory
Path.Combine(di.FullName,p) |> Path.GetFullPath
Name = forceGetInnerText node "Name"
GUID = forceGetInnerText node "Project" |> Guid.Parse }]

Expand Down
2 changes: 2 additions & 0 deletions src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@
<StartWorkingDirectory>D:\code\Pakettest</StartWorkingDirectory>
<StartWorkingDirectory>D:\code\Paketkopie</StartWorkingDirectory>
<StartArguments>update group Build</StartArguments>
<StartArguments>pack output D:\code\paketbug\output</StartArguments>
<StartAction>Project</StartAction>
<StartProgram>paket.exe</StartProgram>
<StartWorkingDirectory>c:\code\Paketkopie</StartWorkingDirectory>
<StartWorkingDirectory>C:\Temp\paket_test\</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\paketkopie</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\paketbug</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down
9 changes: 6 additions & 3 deletions tests/Paket.Tests/ProjectFile/InterProjectDependencySpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ let ``should detect Paket and Paket.Core dependency in Project2 proj file``() =

[<Test>]
let ``should detect path for dependencies in Project2 proj file``() =
ProjectFile.Load("./ProjectFile/TestData/Project2.fsprojtest").Value.GetInterProjectDependencies()
|> List.map (fun p -> p.Path)
|> shouldEqual ["..\..\src\Paket\Paket.fsproj"; "..\Paket.Core\Paket.Core.fsproj"]
let paths =
ProjectFile.Load("./ProjectFile/TestData/Project2.fsprojtest").Value.GetInterProjectDependencies()
|> List.map (fun p -> normalizePath p.Path)

paths.[0].EndsWith(normalizePath "src/Paket/Paket.fsproj") |> shouldEqual true
paths.[1].EndsWith(normalizePath "Paket.Core/Paket.Core.fsproj") |> shouldEqual true

[<Test>]
let ``should detect Guids for dependencies in Project2 proj file``() =
Expand Down

0 comments on commit 6192424

Please sign in to comment.