Skip to content

Commit

Permalink
Merge pull request #444 from fsprojects/satellite
Browse files Browse the repository at this point in the history
Don't reference satellite assemblies - fixes #439
  • Loading branch information
forki committed Dec 9, 2014
2 parents 5a8553e + 6efacb7 commit 4194214
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 5 deletions.
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"
| _ -> 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

0 comments on commit 4194214

Please sign in to comment.