Skip to content

Commit

Permalink
paket install respects manual paket nodes - fixes #679
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Mar 11, 2015
1 parent ed65673 commit 598a6cb
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 0.33.4 - 11.03.2015
* BUGFIX: `paket install` respects manual paket nodes - https://github.com/fsprojects/Paket/issues/679

#### 0.33.3 - 11.03.2015
* `paket pack` pretty-prints it's nuspec - https://github.com/fsprojects/Paket/issues/691

Expand Down
11 changes: 7 additions & 4 deletions src/Paket.Core/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ type ProjectFile =
[for node in this.Document |> getDescendants name do
let isPaketNode = ref false
for child in node.ChildNodes do
if child.Name = "Paket" then isPaketNode := true
if child.Name = "Paket" && child.InnerText.ToLower() = "true" then
isPaketNode := true

if !isPaketNode = paketOnes then yield node]

Expand Down Expand Up @@ -187,10 +188,12 @@ type ProjectFile =
let libs =
model.GetLibReferencesLazy.Force()
|> Set.map (fun lib -> lib.ReferenceName)

this.GetCustomReferenceAndFrameworkNodes()
|> List.filter (fun node -> Set.contains (node.Attributes.["Include"].InnerText.Split(',').[0]) libs)

|> List.filter (fun node ->
let libName = node.Attributes.["Include"].InnerText.Split(',').[0]
Set.contains libName libs)

member this.DeleteCustomModelNodes(model:InstallModel) =
let nodesToDelete =
this.GetCustomModelNodes(model)
Expand Down
13 changes: 13 additions & 0 deletions tests/Paket.Tests/InstallModel/Xml/ManualNodes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ let ``should find custom nodes in doc``() =
ProjectFile.Load("./ProjectFile/TestData/CustomFantomasNode.fsprojtest").Value.GetCustomModelNodes(model).IsEmpty
|> shouldEqual false

[<Test>]
let ``should find custom Paket nodes in doc``() =
let model =
InstallModel.CreateFromLibs(PackageName "Fantomas", SemVer.Parse "1.5.0", [],
[ @"..\Fantomas\lib\FantomasLib.dll"
@"..\Fantomas\lib\FSharp.Core.dll"
@"..\Fantomas\lib\Fantomas.exe" ],
[],
Nuspec.Explicit ["FantomasLib.dll"])

ProjectFile.Load("./ProjectFile/TestData/CustomPaketFantomasNode.fsprojtest").Value.GetCustomModelNodes(model).IsEmpty
|> shouldEqual false


[<Test>]
let ``should not find custom nodes if there are none``() =
Expand Down
5 changes: 4 additions & 1 deletion tests/Paket.Tests/Paket.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -208,6 +208,9 @@
</None>
<None Include="ProjectFile\TestData\CustomFantomasNode.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\CustomPaketFantomasNode.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\NoCustomFantomasNode.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<ItemGroup>
<Reference Include="Fanta">
<HintPath>..\..\packages\Fanta\lib\Fanta.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FantomasLib">
<HintPath>..\..\packages\Fantomas\lib\FantomasLib.dll</HintPath>
<Private>True</Private>
<Paket>False</Paket>
</Reference>
</ItemGroup>
</Project>

0 comments on commit 598a6cb

Please sign in to comment.