Skip to content
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
2 changes: 1 addition & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
66 changes: 65 additions & 1 deletion integrationtests/Paket.IntegrationTests/PackSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -788,4 +788,68 @@ let ``#2776 transitive references stops on project with template`` () =
dependencies |> shouldContain (PackageName "C")
dependencies |> shouldNotContain (PackageName "nlog")

CleanDir rootPath
CleanDir rootPath

[<Test>]
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace MyProj.Common
{
public class Class1
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
</PropertyGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FSharp.Core
Suave framework: net45
Argu framework: netstandard2.0
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace MyProj.Main
{
public class Class1
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\MyProj.Common\MyProj.Common.csproj" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FSharp.Core
Suave
Argu
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Loading