Skip to content

Commit

Permalink
Ignore DotNET 5.0 framework when TargetFramework 4 is specified - fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Sep 22, 2015
1 parent 9518955 commit fa52703
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 26 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.3.5 - 22.09.2015
* BUGFIX: Ignore DotNET 5.0 framework when TargetFramework 4 is specified - https://github.com/fsprojects/Paket/issues/1066

#### 2.3.4 - 21.09.2015
* BUGFIX: Paket failed with: The input sequence was empty - https://github.com/fsprojects/Paket/issues/1071

Expand Down
2 changes: 1 addition & 1 deletion src/Paket.Core/FrameworkHandling.fs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ module FrameworkDetection =
| "wp8" | "wp80" | "wpv80" -> Some (WindowsPhoneSilverlight "v8.0")
| "wpa00" | "wpa" | "wpa81" | "wpapp81" | "wpapp" -> Some (WindowsPhoneApp "v8.1")
| "dnx451" -> Some(DNX FrameworkVersion.V4_5_1)
| "dnxcore50" | "netplatform50" | "netcore50" | "aspnetcore50" | "aspnet50" -> Some(DNXCore FrameworkVersion.V5_0)
| "dnxcore50" | "netplatform50" | "netcore50" | "aspnetcore50" | "aspnet50" | "dotnet" -> Some(DNXCore FrameworkVersion.V5_0)
| _ -> None

cache.[path] <- result
Expand Down
17 changes: 11 additions & 6 deletions src/Paket.Core/PackageResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,17 @@ let calcOpenRequirements (exploredPackage:ResolvedPackage,globalFrameworkRestric
let rest = Set.remove dependency stillOpen

dependenciesByName
|> Set.map (fun (n,v,r) ->
{dependency with
Name = n
VersionRequirement = v
Parent = Package(dependency.Name,versionToExplore)
Settings = { dependency.Settings with FrameworkRestrictions = r @ globalFrameworkRestrictions }})
|> Set.map (fun (n,v,restriction) ->
let newRestrictions =
restriction @ exploredPackage.Settings.FrameworkRestrictions @ globalFrameworkRestrictions
|> List.distinct

{ dependency with
Name = n
VersionRequirement = v
Parent = Package(dependency.Name,versionToExplore)
Settings = { dependency.Settings with FrameworkRestrictions = newRestrictions }})

|> Set.filter (fun d -> Set.contains d closed |> not)
|> Set.filter (fun d -> Set.contains d stillOpen |> not)
|> Set.filter (fun d ->
Expand Down
2 changes: 1 addition & 1 deletion src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<StartWorkingDirectory>c:\code\Paket09x</StartWorkingDirectory>
<StartWorkingDirectory>D:\code\Pakettest</StartWorkingDirectory>
<StartWorkingDirectory>D:\code\Paketkopie</StartWorkingDirectory>
<StartArguments>install</StartArguments>
<StartArguments>update -f</StartArguments>
<StartAction>Project</StartAction>
<StartProgram>paket.exe</StartProgram>
<StartWorkingDirectory>c:\code\Paketkopie</StartWorkingDirectory>
Expand Down
35 changes: 19 additions & 16 deletions tests/Paket.Tests/Lockfile/GeneratorSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ let ``should generate lock file for packages``() =
Rx-Core (2.1)
Rx-Main (2.0)
Rx-Core (>= 2.1)"""

let cfg = DependenciesFile.FromCode(config1)
ResolveWithGraph(cfg,noSha1,VersionsFromGraph graph, PackageDetailsFromGraph graph).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail()
|> LockFileSerializer.serializePackages cfg.Groups.[Constants.MainDependencyGroup].Options
Expand All @@ -59,16 +60,17 @@ let ``should generate lock file with framework restrictions for packages``() =
let expected = """NUGET
remote: http://nuget.org/api/v2
specs:
Castle.Windsor (2.1)
Castle.Windsor (2.1) - framework: net35
Castle.Windsor-log4net (3.3) - framework: net35
Castle.Windsor (>= 2.0)
log4net (>= 1.0)
log (1.2)
log4net (1.1)
log (1.2) - framework: net35
log4net (1.1) - framework: net35
log (>= 1.0)
Rx-Core (2.1)
Rx-Core (2.1) - framework: >= net40
Rx-Main (2.0) - framework: >= net40
Rx-Core (>= 2.1)"""

let cfg = DependenciesFile.FromCode(configWithRestrictions)
ResolveWithGraph(cfg,noSha1,VersionsFromGraph graph, PackageDetailsFromGraph graph).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail()
|> LockFileSerializer.serializePackages cfg.Groups.[Constants.MainDependencyGroup].Options
Expand All @@ -86,16 +88,17 @@ let ``should generate lock file with no targets import for packages``() =
let expected = """NUGET
remote: "D:\code\temp with space"
specs:
Castle.Windsor (2.1) - import_targets: false
Castle.Windsor (2.1) - import_targets: false, framework: net35
Castle.Windsor-log4net (3.3) - import_targets: false, framework: net35
Castle.Windsor (>= 2.0)
log4net (>= 1.0)
log (1.2) - import_targets: false
log4net (1.1) - import_targets: false
log (1.2) - import_targets: false, framework: net35
log4net (1.1) - import_targets: false, framework: net35
log (>= 1.0)
Rx-Core (2.1)
Rx-Core (2.1) - framework: >= net40
Rx-Main (2.0) - framework: >= net40
Rx-Core (>= 2.1)"""

let cfg = DependenciesFile.FromCode(configWithNoImport)
ResolveWithGraph(cfg,noSha1,VersionsFromGraph graph, PackageDetailsFromGraph graph).[Constants.MainDependencyGroup].ResolvedPackages.GetModelOrFail()
|> LockFileSerializer.serializePackages cfg.Groups.[Constants.MainDependencyGroup].Options
Expand All @@ -112,14 +115,14 @@ let ``should generate lock file with no copy local for packages``() =
let expected = """NUGET
remote: http://nuget.org/api/v2
specs:
Castle.Windsor (2.1) - copy_local: false, import_targets: false
Castle.Windsor (2.1) - copy_local: false, import_targets: false, framework: net35
Castle.Windsor-log4net (3.3) - copy_local: false, import_targets: false, framework: net35
Castle.Windsor (>= 2.0)
log4net (>= 1.0)
log (1.2) - copy_local: false, import_targets: false
log4net (1.1) - copy_local: false, import_targets: false
log (1.2) - copy_local: false, import_targets: false, framework: net35
log4net (1.1) - copy_local: false, import_targets: false, framework: net35
log (>= 1.0)
Rx-Core (2.1)
Rx-Core (2.1) - framework: >= net40
Rx-Main (2.0) - framework: >= net40
Rx-Core (>= 2.1)"""
let cfg = DependenciesFile.FromCode(configWithCopyLocal)
Expand All @@ -139,14 +142,14 @@ let ``should generate lock file with disabled content for packages``() =
let expected = """NUGET
remote: http://nuget.org/api/v2
specs:
Castle.Windsor (2.1)
Castle.Windsor (2.1) - framework: net35
Castle.Windsor-log4net (3.3) - framework: net35
Castle.Windsor (>= 2.0)
log4net (>= 1.0)
log (1.2)
log4net (1.1)
log (1.2) - framework: net35
log4net (1.1) - framework: net35
log (>= 1.0)
Rx-Core (2.1) - content: none
Rx-Core (2.1) - content: none, framework: >= net40
Rx-Main (2.0) - content: none, framework: >= net40
Rx-Core (>= 2.1)"""
let cfg = DependenciesFile.FromCode(configWithDisabledContent)
Expand Down
53 changes: 53 additions & 0 deletions tests/Paket.Tests/Nuspec/FluentAssertions4.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>FluentAssertions</id>
<version>4.0.0</version>
<title>Fluent Assertions</title>
<authors>Dennis Doomen, Oren Novotny, Adam Voss</authors>
<owners>Dennis Doomen</owners>
<licenseUrl>https://github.com/dennisdoomen/FluentAssertions/blob/master/LICENSE</licenseUrl>
<projectUrl>http://www.fluentassertions.com</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or
BDD-style unit test. Runs on 4.0 and 4.5 (Desktop and Windows Store), CoreCLR, Silverlight 5 and Windows Phone 8, 8.1 and 8.1 for Silverlight. Supports the unit test frameworks NUnit, XUnit, XUnit2, MBUnit, Gallio, MSpec, and NSpec.</description>
<summary>Fluent methods for asserting the result of TDD/BDD specs for .NET 4.0/4.5 (Desktop and Windows Store), CoreCLR, SL5, WP8, WP8.1 and WPA8.1. Supports the unit test frameworks NUnit, XUnit, XUnit2, MBUnit, Gallio, MSpec, and NSpec.</summary>
<releaseNotes>See https://github.com/dennisdoomen/fluentassertions/releases/</releaseNotes>
<copyright>Copyright Dennis Doomen 2010-2014</copyright>
<language>en-US</language>
<tags>MSTest xUnit xUnit2 NUnit MSpec NSpec Gallio MbUnit TDD BDD Fluent Silverlight WinRT WP8 WP8.1 WPA8.1 CoreCLR</tags>
<dependencies>
<group targetFramework=".NETFramework4.0" />
<group targetFramework="Silverlight5.0" />
<group targetFramework="Windows8.0" />
<group targetFramework="WindowsPhone8.0" />
<group targetFramework="WindowsPhoneApp8.1" />
<group targetFramework="Xamarin.iOS0.0" />
<group targetFramework="MonoTouch0.0" />
<group targetFramework="MonoAndroid0.0" />
<group targetFramework=".NETPortable0.0-net40+sl5+win8+wp8+wpa81" />
<group targetFramework=".NETPlatform5.0">
<dependency id="System.Collections" version="4.0.10" />
<dependency id="System.Diagnostics.Debug" version="4.0.10" />
<dependency id="System.Globalization" version="4.0.10" />
<dependency id="System.Linq" version="4.0.0" />
<dependency id="System.Linq.Expressions" version="4.0.10" />
<dependency id="System.ObjectModel" version="4.0.10" />
<dependency id="System.Reflection" version="4.0.10" />
<dependency id="System.Reflection.Extensions" version="4.0.0" />
<dependency id="System.Reflection.Primitives" version="4.0.0" />
<dependency id="System.Reflection.TypeExtensions" version="4.0.0" />
<dependency id="System.Runtime" version="4.0.20" />
<dependency id="System.Runtime.Extensions" version="4.0.10" />
<dependency id="System.Text.RegularExpressions" version="4.0.10" />
<dependency id="System.Threading" version="4.0.10" />
<dependency id="System.Threading.Tasks" version="4.0.10" />
<dependency id="System.Xml.XDocument" version="4.0.10" />
</group>
</dependencies>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Xml" targetFramework=".NETPortable0.0-net45+monoandroid+xamarin.ios10+monotouch" />
<frameworkAssembly assemblyName="System.Xml.Linq" targetFramework=".NETPortable0.0-net45+monoandroid+xamarin.ios10+monotouch" />
</frameworkAssemblies>
</metadata>
</package>
14 changes: 13 additions & 1 deletion tests/Paket.Tests/Nuspec/NuspecSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,16 @@ let ``can detect framework assemblies for Microsoft.Framework.Logging``() =

let name,_,restrictions = nuspec.Dependencies.[2]
name |> shouldEqual (PackageName "System.Collections.Concurrent")
restrictions |> shouldEqual [FrameworkRestriction.Exactly(DNXCore(FrameworkVersion.V5_0))]
restrictions |> shouldEqual [FrameworkRestriction.Exactly(DNXCore(FrameworkVersion.V5_0))]



[<Test>]
let ``can detect explicit dependencies for FluentAssertions 4``() =
let deps = Nuspec.Load("Nuspec/FluentAssertions4.nuspec").Dependencies |> List.toArray

deps.[0]
|> shouldEqual
(PackageName "System.Collections",
DependenciesFileParser.parseVersionRequirement(">= 4.0.10"),
[FrameworkRestriction.Exactly(DNXCore(FrameworkVersion.V5_0))])
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 @@ -131,6 +131,9 @@
<Content Include="Nuspec\FluentAssertions.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\FluentAssertions4.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\FSharp.Data.SqlClient.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down

0 comments on commit fa52703

Please sign in to comment.