From c80222c60b6f30be44accaa30df6e19d78866d03 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Fri, 19 Apr 2019 10:44:49 +0200 Subject: [PATCH 1/4] example of package with framework restrictions --- .../before/MyProj.Common/Class1.cs | 8 ++++++ .../before/MyProj.Common/MyProj.Common.csproj | 7 +++++ .../before/MyProj.Common/paket.references | 3 +++ .../before/MyProj.Common/paket.template | 7 +++++ .../before/MyProj.Main/Class1.cs | 8 ++++++ .../before/MyProj.Main/MyProj.Main.csproj | 10 +++++++ .../before/MyProj.Main/paket.references | 3 +++ .../before/MyProj.Main/paket.template | 7 +++++ .../before/paket.dependencies | 6 +++++ .../before/paket.lock | 26 +++++++++++++++++++ 10 files changed, 85 insertions(+) create mode 100644 integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/Class1.cs create mode 100644 integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/MyProj.Common.csproj create mode 100644 integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/paket.references create mode 100644 integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/paket.template create mode 100644 integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/Class1.cs create mode 100644 integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/MyProj.Main.csproj create mode 100644 integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/paket.references create mode 100644 integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/paket.template create mode 100644 integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/paket.dependencies create mode 100644 integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/paket.lock diff --git a/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/Class1.cs b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/Class1.cs new file mode 100644 index 0000000000..a196336c02 --- /dev/null +++ b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace MyProj.Common +{ + public class Class1 + { + } +} diff --git a/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/MyProj.Common.csproj b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/MyProj.Common.csproj new file mode 100644 index 0000000000..79d8302f5e --- /dev/null +++ b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/MyProj.Common.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0;net45 + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/paket.references b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/paket.references new file mode 100644 index 0000000000..d44e85de4a --- /dev/null +++ b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/paket.references @@ -0,0 +1,3 @@ +FSharp.Core +Suave framework: net45 +Argu framework: netstandard2.0 \ No newline at end of file diff --git a/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/paket.template b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/paket.template new file mode 100644 index 0000000000..c5d372a905 --- /dev/null +++ b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Common/paket.template @@ -0,0 +1,7 @@ +type project +dependencies + framework: net45 + framework: netstandard2.0 +files + bin/Release/net45/MyProj.Common.dll ==> lib/net45 + bin/Release/netstandard2.0/MyProj.Common.dll ==> lib/netstandard2.0 diff --git a/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/Class1.cs b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/Class1.cs new file mode 100644 index 0000000000..9a1729f132 --- /dev/null +++ b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace MyProj.Main +{ + public class Class1 + { + } +} diff --git a/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/MyProj.Main.csproj b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/MyProj.Main.csproj new file mode 100644 index 0000000000..a3fa2eb35e --- /dev/null +++ b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/MyProj.Main.csproj @@ -0,0 +1,10 @@ + + + + netstandard2.0;net45 + + + + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/paket.references b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/paket.references new file mode 100644 index 0000000000..a6bdce707a --- /dev/null +++ b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/paket.references @@ -0,0 +1,3 @@ +FSharp.Core +Suave +Argu \ No newline at end of file diff --git a/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/paket.template b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/paket.template new file mode 100644 index 0000000000..147cafa27f --- /dev/null +++ b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/MyProj.Main/paket.template @@ -0,0 +1,7 @@ +type project +dependencies + framework: net45 + framework: netstandard2.0 +files + bin/Release/net45/MyProj.Main.dll ==> lib/net45 + bin/Release/netstandard2.0/MyProj.Main.dll ==> lib/netstandard2.0 diff --git a/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/paket.dependencies b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/paket.dependencies new file mode 100644 index 0000000000..0979c5b688 --- /dev/null +++ b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/paket.dependencies @@ -0,0 +1,6 @@ +source https://www.nuget.org/api/v2 +framework: net45, netstandard2.0 + +nuget FSharp.Core >= 3.1.2.5 lowest_matching: true +nuget Suave 1.1.3 framework: net45 +nuget Argu 5.2.0 framework: netstandard2.0 diff --git a/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/paket.lock b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/paket.lock new file mode 100644 index 0000000000..667235a270 --- /dev/null +++ b/integrationtests/scenarios/i003166-pack-multitarget-with-p2p-by-tfm/before/paket.lock @@ -0,0 +1,26 @@ +RESTRICTION: || (== net45) (== netstandard2.0) +NUGET + remote: https://www.nuget.org/api/v2 + Argu (5.2) - restriction: == netstandard2.0 + FSharp.Core (>= 4.3.2) - restriction: == netstandard2.0 + System.Configuration.ConfigurationManager (>= 4.4) - restriction: == netstandard2.0 + FSharp.Core (4.3.2) + Suave (1.1.3) - restriction: == net45 + FSharp.Core (>= 3.1.2.5) + System.Buffers (4.5) - restriction: == netstandard2.0 + System.Configuration.ConfigurationManager (4.5) - restriction: == netstandard2.0 + System.Security.Cryptography.ProtectedData (>= 4.5) - restriction: || (&& (== net45) (>= netstandard2.0)) (== netstandard2.0) + System.Security.Permissions (>= 4.5) - restriction: || (&& (== net45) (>= monoandroid)) (&& (== net45) (>= monotouch)) (&& (== net45) (>= net461)) (&& (== net45) (>= netstandard2.0)) (&& (== net45) (>= xamarintvos)) (&& (== net45) (>= xamarinwatchos)) (== netstandard2.0) + System.Memory (4.5.2) - restriction: == netstandard2.0 + System.Buffers (>= 4.4) + System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== net45) (>= net461)) (== netstandard2.0) + System.Runtime.CompilerServices.Unsafe (>= 4.5.2) + System.Numerics.Vectors (4.5) - restriction: == netstandard2.0 + System.Runtime.CompilerServices.Unsafe (4.5.2) - restriction: == netstandard2.0 + System.Security.AccessControl (4.5) - restriction: == netstandard2.0 + System.Security.Principal.Windows (>= 4.5) - restriction: || (&& (== net45) (>= net461)) (&& (== net45) (>= netcoreapp2.0)) (&& (== net45) (>= netstandard2.0)) (== netstandard2.0) + System.Security.Cryptography.ProtectedData (4.5) - restriction: == netstandard2.0 + System.Memory (>= 4.5) - restriction: || (&& (== net45) (>= netstandard2.0)) (== netstandard2.0) + System.Security.Permissions (4.5) - restriction: == netstandard2.0 + System.Security.AccessControl (>= 4.5) - restriction: || (&& (== net45) (>= net461)) (&& (== net45) (>= netstandard2.0)) (== netstandard2.0) + System.Security.Principal.Windows (4.5.1) - restriction: == netstandard2.0 From 1773fb53a141eaa33e1eb473965e8384a21d82cd Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Fri, 19 Apr 2019 13:49:04 +0200 Subject: [PATCH 2/4] add test --- .../Paket.IntegrationTests/PackSpecs.fs | 66 ++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/integrationtests/Paket.IntegrationTests/PackSpecs.fs b/integrationtests/Paket.IntegrationTests/PackSpecs.fs index 6aae578389..cf4df4446b 100644 --- a/integrationtests/Paket.IntegrationTests/PackSpecs.fs +++ b/integrationtests/Paket.IntegrationTests/PackSpecs.fs @@ -788,4 +788,68 @@ let ``#2776 transitive references stops on project with template`` () = dependencies |> shouldContain (PackageName "C") dependencies |> shouldNotContain (PackageName "nlog") - CleanDir rootPath \ No newline at end of file + CleanDir rootPath + +[] +let ``#3166 pack multitarget with p2p by tfm`` () = + let scenario = "i003166-pack-multitarget-with-p2p-by-tfm" + prepareSdk scenario + let rootPath = scenarioTempPath scenario + + directDotnet true "build MyProj.Main -c Release" rootPath + |> Seq.iter (printfn "%A") + + let outPath = Path.Combine(rootPath, "out") + directPaket (sprintf """pack "%s" """ outPath) scenario + |> printfn "%s" + + let tfmNET45 = FrameworkIdentifier.DotNetFramework(FrameworkVersion.V4_5) + let ``>= net45`` = FrameworkRestriction.AtLeast(tfmNET45) + let tfmNETSTANDARD2_0 = FrameworkIdentifier.DotNetStandard(DotNetStandardVersion.V2_0) + let ``>= netstandard2.0`` = FrameworkRestriction.And [FrameworkRestriction.NotAtLeast(tfmNET45); FrameworkRestriction.AtLeast(tfmNETSTANDARD2_0)] + + let _checkNupkgCommon = + + let nupkgPath = Path.Combine(outPath, "MyProj.Common.1.0.0.nupkg") + + if File.Exists nupkgPath |> not then Assert.Fail(sprintf "Expected '%s' to exist" nupkgPath) + let nuspec = NuGetLocal.getNuSpecFromNupgk nupkgPath + printfn "%A" nuspec + printfn "%A" nuspec.Dependencies.Value + let depsByTfm byTfm = nuspec.Dependencies.Value |> Seq.choose (fun (pkgName,version,tfm) -> if (tfm.GetExplicitRestriction()) = byTfm then Some (pkgName,version) else None) |> Seq.toList + let pkgVer name version = (PackageName name), (VersionRequirement.Parse version) + + CollectionAssert.AreEquivalent([ pkgVer "Suave" "[1.1.3]" ], depsByTfm (``>= net45``)) + + CollectionAssert.AreEquivalent([ pkgVer "Argu" "[5.2.0]" ], depsByTfm (``>= netstandard2.0``)) + + CollectionAssert.AreEquivalent([ pkgVer "FSharp.Core" "3.1.2.5" ], depsByTfm (FrameworkRestriction.Or [``>= net45``; ``>= netstandard2.0``])) + + let unzippedNupkgPath = Path.Combine(outPath, "MyProj.Common") + ZipFile.ExtractToDirectory(nupkgPath, unzippedNupkgPath) + Path.Combine(unzippedNupkgPath, "lib", "net45", "MyProj.Common.dll") |> checkFileExists + Path.Combine(unzippedNupkgPath, "lib", "netstandard2.0", "MyProj.Common.dll") |> checkFileExists + + let _checkNupkgMain = + + let nupkgPath = Path.Combine(outPath, "MyProj.Main.1.0.0.nupkg") + + if File.Exists nupkgPath |> not then Assert.Fail(sprintf "Expected '%s' to exist" nupkgPath) + let nuspec = NuGetLocal.getNuSpecFromNupgk nupkgPath + printfn "%A" nuspec + printfn "%A" nuspec.Dependencies.Value + let depsByTfm byTfm = nuspec.Dependencies.Value |> Seq.choose (fun (pkgName,version,tfm) -> if (tfm.GetExplicitRestriction()) = byTfm then Some (pkgName,version) else None) |> Seq.toList + let pkgVer name version = (PackageName name), (VersionRequirement.Parse version) + + CollectionAssert.AreEquivalent([ pkgVer "Suave" "[1.1.3]" ], depsByTfm (``>= net45``)) + + CollectionAssert.AreEquivalent([ pkgVer "Argu" "[5.2.0]" ], depsByTfm (``>= netstandard2.0``)) + + CollectionAssert.AreEquivalent([ pkgVer "FSharp.Core" "3.1.2.5"; pkgVer "MyProj.Common" "1.0.0" ], depsByTfm (FrameworkRestriction.Or [``>= net45``; ``>= netstandard2.0``])) + + let unzippedNupkgPath = Path.Combine(outPath, "MyProj.Main") + ZipFile.ExtractToDirectory(nupkgPath, unzippedNupkgPath) + Path.Combine(unzippedNupkgPath, "lib", "net45", "MyProj.Main.dll") |> checkFileExists + Path.Combine(unzippedNupkgPath, "lib", "netstandard2.0", "MyProj.Main.dll") |> checkFileExists + + CleanDir rootPath From 52cc7e049e862d25df061ac4de86a6c91c49d3d9 Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Fri, 19 Apr 2019 13:50:27 +0200 Subject: [PATCH 3/4] consider dependencies target framework restriction in paket pack --- src/Paket.Core/Packaging/PackageMetaData.fs | 90 ++++++++++++++------- 1 file changed, 61 insertions(+), 29 deletions(-) diff --git a/src/Paket.Core/Packaging/PackageMetaData.fs b/src/Paket.Core/Packaging/PackageMetaData.fs index d3c4ce9cf4..cde41151a6 100644 --- a/src/Paket.Core/Packaging/PackageMetaData.fs +++ b/src/Paket.Core/Packaging/PackageMetaData.fs @@ -108,21 +108,43 @@ let (|Valid|Invalid|) md = Symbols = s } | _ -> Invalid -let addDependencyToFrameworkGroup framework dependencyGroups dependency = +let addDependencyToFrameworkGroup framework dependencyGroups dependencyWithFwRestriction = + let dependency, (fwRestriction: FrameworkRestrictions) = + let pkgName, version, fwRestriction = dependencyWithFwRestriction + (pkgName, version), fwRestriction + + let isCompatibleWith (fwOption: FrameworkIdentifier option) = + match fwOption with + | None -> true + | Some fw -> + if fwRestriction.IsSupersetOf (FrameworkRestriction.Exactly fw) then + true + else + false + dependencyGroups |> List.tryFind (fun g -> g.Framework = framework) |> function - | None -> { Dependencies = [dependency]; Framework = framework } :: dependencyGroups + | None -> + if isCompatibleWith framework then + let newGroup = OptionalDependencyGroup.For framework [dependency] + newGroup :: dependencyGroups + else + dependencyGroups | _ -> dependencyGroups |> List.map (fun g -> if g.Framework <> framework then g - else { g with Dependencies = dependency :: g.Dependencies }) + else + if isCompatibleWith g.Framework then + { g with Dependencies = dependency :: g.Dependencies } + else + g) -let addDependency (templateFile : TemplateFile) (dependency : PackageName * VersionRequirement) = +let addDependency (templateFile : TemplateFile) (dependency : PackageName * VersionRequirement * FrameworkRestrictions) = match templateFile with | CompleteTemplate(core, opt) -> - let packageName = dependency |> (fun (n,_) -> n) + let packageName = dependency |> (fun (n,_,_) -> n) let newDeps = opt.DependencyGroups |> List.tryFind (fun g -> @@ -340,7 +362,8 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp match core.Version with | Some v -> let versionConstraint = interprojectReferencesConstraint.CreateVersionRequirements v - PackageName core.Id, VersionRequirement(versionConstraint, getPreReleaseStatus v) + let anyFw = FrameworkRestrictions.ExplicitRestriction (FrameworkRestriction.NoRestriction) + PackageName core.Id, VersionRequirement(versionConstraint, getPreReleaseStatus v), anyFw | None -> failwithf "There was no version given for %s." evaluatedTemplate.FileName | IncompleteTemplate -> failwithf "You cannot create a dependency on a template file (%s) with incomplete metadata." evaluatedTemplate.FileName) @@ -442,12 +465,13 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp | _ -> true) |> List.map (fun (group, np, specificVersionRequirement) -> let specificVersionRequirement = defaultArg specificVersionRequirement VersionRequirement.AllReleases + let noFrameworkRestriction = FrameworkRestrictions.ExplicitRestriction (FrameworkRestriction.NoRestriction) match group with | None -> match version with | Some v -> let vr = interprojectReferencesConstraint.CreateVersionRequirements v - np.Name,VersionRequirement(vr, getPreReleaseStatus v) + np,VersionRequirement(vr, getPreReleaseStatus v),noFrameworkRestriction | None -> if minimumFromLockFile then let groupName = @@ -458,18 +482,18 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp |> Option.map fst match groupName with - | None -> np.Name,specificVersionRequirement + | None -> np,specificVersionRequirement,noFrameworkRestriction | Some groupName -> let group = lockFile.GetGroup groupName - let lockedVersion = + let lockedVersion, fwRestriction = match Map.tryFind np.Name group.Resolution with - | Some resolvedPackage -> VersionRequirement(GreaterThan resolvedPackage.Version, getPreReleaseStatus resolvedPackage.Version) - | None -> specificVersionRequirement + | Some resolvedPackage -> VersionRequirement(GreaterThan resolvedPackage.Version, getPreReleaseStatus resolvedPackage.Version), resolvedPackage.Settings.FrameworkRestrictions + | None -> specificVersionRequirement, noFrameworkRestriction - np.Name,lockedVersion + np,lockedVersion,fwRestriction else - np.Name,specificVersionRequirement + np,specificVersionRequirement,noFrameworkRestriction | Some groupName -> let dependencyVersionRequirement = if not lockDependencies then @@ -481,7 +505,7 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp if minimumFromLockFile || requirement.VersionRequirement = VersionRequirement.NoRestriction then match lockFile.Groups |> Map.tryFind groupName with - | None -> Some requirement.VersionRequirement + | None -> Some (requirement.VersionRequirement, requirement.Settings.FrameworkRestrictions) | Some group -> match Map.tryFind np.Name group.Resolution with | Some resolvedPackage -> @@ -490,22 +514,22 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp | OverrideAll v -> if v <> resolvedPackage.Version then failwithf "Versions in %s and %s are not identical for package %O." lockFile.FileName dependenciesFile.FileName np.Name - Some(VersionRequirement(Specific resolvedPackage.Version,pre)) + Some(VersionRequirement(Specific resolvedPackage.Version,pre), resolvedPackage.Settings.FrameworkRestrictions) | Specific v -> if v <> resolvedPackage.Version then failwithf "Versions in %s and %s are not identical for package %O." lockFile.FileName dependenciesFile.FileName np.Name - Some(VersionRequirement(Specific resolvedPackage.Version,pre)) + Some(VersionRequirement(Specific resolvedPackage.Version,pre), resolvedPackage.Settings.FrameworkRestrictions) | Maximum v -> if v = resolvedPackage.Version then - Some(VersionRequirement(Specific resolvedPackage.Version,pre)) + Some(VersionRequirement(Specific resolvedPackage.Version,pre), resolvedPackage.Settings.FrameworkRestrictions) else - Some(VersionRequirement(VersionRange.Range(VersionRangeBound.Including,resolvedPackage.Version,v,VersionRangeBound.Including),pre)) + Some(VersionRequirement(VersionRange.Range(VersionRangeBound.Including,resolvedPackage.Version,v,VersionRangeBound.Including),pre), resolvedPackage.Settings.FrameworkRestrictions) | Range(_,_,v2,ub) -> - Some(VersionRequirement(VersionRange.Range(VersionRangeBound.Including,resolvedPackage.Version,v2,ub),pre)) - | _ -> Some(VersionRequirement(Minimum resolvedPackage.Version,pre)) - | None -> Some requirement.VersionRequirement + Some(VersionRequirement(VersionRange.Range(VersionRangeBound.Including,resolvedPackage.Version,v2,ub),pre), resolvedPackage.Settings.FrameworkRestrictions) + | _ -> Some(VersionRequirement(Minimum resolvedPackage.Version,pre), resolvedPackage.Settings.FrameworkRestrictions) + | None -> Some (requirement.VersionRequirement, requirement.Settings.FrameworkRestrictions) else - Some requirement.VersionRequirement + Some (requirement.VersionRequirement, requirement.Settings.FrameworkRestrictions) | None -> match lockFile.Groups |> Map.tryFind groupName with | None -> None @@ -515,20 +539,28 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp // to current locked version group.Resolution |> Map.tryFind np.Name - |> Option.map (fun transitive -> VersionRequirement(Minimum transitive.Version, getPreReleaseStatus transitive.Version)) + |> Option.map (fun transitive -> VersionRequirement(Minimum transitive.Version, getPreReleaseStatus transitive.Version), transitive.Settings.FrameworkRestrictions) else match lockFile.Groups |> Map.tryFind groupName with | None -> None | Some group -> Map.tryFind np.Name group.Resolution - |> Option.map (fun resolvedPackage -> resolvedPackage.Version) - |> Option.map (fun version -> VersionRequirement(Specific version, getPreReleaseStatus version)) - let dep = + |> Option.map (fun resolvedPackage -> + let version = resolvedPackage.Version + VersionRequirement(Specific version, getPreReleaseStatus version), resolvedPackage.Settings.FrameworkRestrictions) + let dep, depFwRestriction = match dependencyVersionRequirement with | Some installed -> installed | None -> failwithf "No package with id '%O' installed in group %O." np.Name groupName - - np.Name, dep) - + + np, dep, depFwRestriction) + |> List.map (fun (np, dep, depFwRestriction) -> + let fwRestriction = + match depFwRestriction, np.Settings.FrameworkRestrictions with + | AutoDetectFramework, AutoDetectFramework -> ExplicitRestriction(FrameworkRestriction.NoRestriction) + | AutoDetectFramework, ExplicitRestriction fr -> ExplicitRestriction fr + | ExplicitRestriction fr, AutoDetectFramework -> ExplicitRestriction fr + | ExplicitRestriction fr1, ExplicitRestriction fr2 -> ExplicitRestriction (FrameworkRestriction.combineRestrictionsWithAnd fr1 fr2) + np.Name, dep, fwRestriction) deps |> List.fold addDependency withDepsAndIncluded From 0c0b17db129014cc9c8e5a9ac179f5e9b9655f8a Mon Sep 17 00:00:00 2001 From: Enrico Sada Date: Fri, 19 Apr 2019 16:05:57 +0200 Subject: [PATCH 4/4] increment integration tests timeout --- build.fsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.fsx b/build.fsx index e1ec5e501e..83b4272fbf 100644 --- a/build.fsx +++ b/build.fsx @@ -277,7 +277,7 @@ Target "RunIntegrationTestsNetCore" (fun _ -> AdditionalArgs = [ "--filter"; (if testSuiteFilterFlakyTests then "TestCategory=Flaky" else "TestCategory!=Flaky") sprintf "--logger:trx;LogFileName=%s" ("tests_result/netcore/Paket.IntegrationTests/TestResult.trx" |> Path.GetFullPath) ] - TimeOut = TimeSpan.FromMinutes 50. + TimeOut = TimeSpan.FromMinutes 60. }) ) "Clean" ==> "DotnetPublish" ==> "RunIntegrationTestsNetCore"