Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't reference satellite assemblies - fixes #439 #444

Merged
merged 2 commits into from
Dec 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 10 additions & 4 deletions src/Paket.Core/InstallModel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,17 @@ type InstallModel =
|> Seq.fold (fun model reference -> model.AddFrameworkAssemblyReference reference) this

member this.FilterBlackList() =
let includeLibs = function
| Reference.Library lib -> not (lib.EndsWith ".dll" || lib.EndsWith ".exe")
| _ -> false

let excludeSatelliteAssemblies = function
| Reference.Library lib -> lib.EndsWith "resources.dll"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be extended to check for ".resources.dll", otherwise dlls like SomeResources.dll would also be filtered out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good. will do

| _ -> false

let blackList =
[ fun (reference : Reference) ->
match reference with
| Reference.Library lib -> not (lib.EndsWith ".dll" || lib.EndsWith ".exe")
| _ -> false ]
[ includeLibs
excludeSatelliteAssemblies]

blackList
|> List.map (fun f -> f >> not) // inverse
Expand Down
50 changes: 50 additions & 0 deletions tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module Paket.InstallModel.Xml.SystemSpatialSpecs

open Paket
open NUnit.Framework
open FsUnit
open Paket.TestHelpers
open Paket.Domain

let expected = """
<Choose xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<When Condition="$(TargetFrameworkIdentifier) == 'Silverlight' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v5.0')">
<ItemGroup>
<Reference Include="System.Spatial">
<HintPath>..\..\..\System.Spatial\lib\sl4\System.Spatial.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch')">
<ItemGroup>
<Reference Include="System.Spatial">
<HintPath>..\..\..\System.Spatial\lib\net40\System.Spatial.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>"""

[<Test>]
let ``should generate Xml for System.Spatial``() =
let model =
InstallModel.CreateFromLibs(PackageName "System.Spatial", SemVer.Parse "5.6.3", None,
[ @"..\System.Spatial\lib\net40\System.Spatial.dll"
@"..\System.Spatial\lib\net40\de\System.Spatial.resources.dll"
@"..\System.Spatial\lib\net40\es\System.Spatial.resources.dll"
@"..\System.Spatial\lib\net40\zh-Hans\System.Spatial.resources.dll"

@"..\System.Spatial\lib\sl4\System.Spatial.dll"
@"..\System.Spatial\lib\sl4\de\System.Spatial.resources.dll"
@"..\System.Spatial\lib\sl4\es\System.Spatial.resources.dll"
@"..\System.Spatial\lib\sl4\zh-Hans\System.Spatial.resources.dll"
],
Nuspec.All)

let chooseNode = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model)
chooseNode.OuterXml
|> normalizeXml
|> shouldEqual (normalizeXml expected)
3 changes: 2 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 @@ -193,6 +193,7 @@
<Compile Include="InstallModel\ProcessingSpecs.fs" />
<Compile Include="InstallModel\Xml\Fantomas.fs" />
<Compile Include="InstallModel\Xml\Plossum.fs" />
<Compile Include="InstallModel\Xml\System.Spatial.fs" />
<Compile Include="InstallModel\Xml\FantomasLib.fs" />
<Compile Include="InstallModel\Xml\Fuchu.fs" />
<Compile Include="InstallModel\Xml\SystemNetHttp.fs" />
Expand Down