Skip to content

Commit

Permalink
Merge pull request #618 from betgenius/blacklist-bcl-build
Browse files Browse the repository at this point in the history
blacklisted Microsoft.Bcl.Build.targets
  • Loading branch information
forki committed Feb 18, 2015
2 parents 849a6c3 + 8f02f50 commit 1110b90
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 4 deletions.
15 changes: 15 additions & 0 deletions src/Paket.Core/Blacklist.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Paket

type Blacklist =
{ TargetsFiles : string list
LibraryFiles : string list }

// default set of blacklisted references we don't want to install
static member TheBlacklist =
{ TargetsFiles =
[
"Microsoft.Bcl.Build.targets" // would install a targets file causing the build to fail in VS if no packages.config files
]
LibraryFiles = [] }


10 changes: 9 additions & 1 deletion src/Paket.Core/InstallModel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,17 @@ type InstallModel =
| Reference.Library lib -> lib.EndsWith ".resources.dll"
| _ -> false

let blacklisted (blacklist : string list) (file : string) = blacklist |> List.exists (fun blf -> file.ToLower().EndsWith (blf.ToLower()))

let excludeBlacklistedTargets = function
| Reference.TargetsFile targetsFile -> targetsFile |> blacklisted Blacklist.TheBlacklist.TargetsFiles
| Reference.Library lib -> lib |> blacklisted Blacklist.TheBlacklist.LibraryFiles
| _ -> false

let blackList =
[ includeLibs
excludeSatelliteAssemblies]
excludeSatelliteAssemblies
excludeBlacklistedTargets ]

blackList
|> List.map (fun f -> f >> not) // inverse
Expand Down
3 changes: 2 additions & 1 deletion src/Paket.Core/Paket.Core.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 @@ -87,6 +87,7 @@
<Compile Include="RemoteDownload.fs" />
<Compile Include="PackageResolver.fs" />
<Compile Include="Nuspec.fs" />
<Compile Include="Blacklist.fs" />
<Compile Include="InstallModel.fs" />
<Compile Include="ReferencesFile.fs" />
<Compile Include="ProjectFile.fs" />
Expand Down
20 changes: 20 additions & 0 deletions tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Paket.InstallModel.Xml.MicrosoftBclBuildSpecs

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

[<Test>]
let ``should not install targets node for Microsoft.Bcl.Build``() =
let model =
InstallModel.CreateFromLibs(PackageName "Microsoft.Bcl.Build", SemVer.Parse "1.0.21", [],
[ ],
[ @"..\Microsoft.Bcl.Build\build\Microsoft.Bcl.Build.Tasks.dll"; @"..\Microsoft.Bcl.Build\build\Microsoft.Bcl.Build.targets" ],
Nuspec.All)

model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldNotContain @"..\Microsoft.Bcl.Build\build\Microsoft.Bcl.Build.targets"

let propertyNodes,_,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true)

propertyNodes |> Seq.length |> shouldEqual 0
5 changes: 3 additions & 2 deletions 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 @@ -125,7 +125,7 @@
</Content>
<Content Include="NuGetOData\Microsoft.AspNet.WebApi.Client.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</Content>
<Content Include="NuGetOData\Fleece.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -228,6 +228,7 @@
<Compile Include="InstallModel\Xml\ManualNodes.fs" />
<Compile Include="InstallModel\Xml\FSharp.Data.SqlClient.fs" />
<Compile Include="InstallModel\Xml\RxXaml.fs" />
<Compile Include="InstallModel\Xml\Microsoft.Bcl.Build.fs" />
<Compile Include="InstallModel\Penalty\PenaltySpecs.fs" />
<Compile Include="InstallModel\Penalty\FrameworkConditionsSpecs.fs" />
<Compile Include="DependencyModel\ProjectDependencySpecs.fs" />
Expand Down

0 comments on commit 1110b90

Please sign in to comment.