From 76c84ac65d9622bf2ef897fd9af535d9131a9dac Mon Sep 17 00:00:00 2001 From: Vassili Geronimos Date: Thu, 7 Mar 2024 14:58:02 +1000 Subject: [PATCH] Add integration test suite for group conditions --- .paket/Paket.Restore.targets | 997 +++++++++--------- .../Paket.IntegrationTests/ConditionSpecs.fs | 209 ++++ .../Paket.IntegrationTests.fsproj | 3 +- .../Paket.IntegrationTests/TestHelper.fs | 2 +- .../before/.gitignore | 2 + .../before/Packages/Directory.Build.targets | 17 + .../before/Packages/Packages.sln | 28 + .../PackageDescription.cs | 10 + .../PaketTest2394.PackageA.csproj | 17 + .../build/PaketTest2394.PackageA.targets | 5 + .../PackageDescription.cs | 10 + .../PaketTest2394.PackageB.Transient.csproj | 9 + .../PackageDescription.cs | 10 + .../PaketTest2394.PackageB.csproj | 13 + .../TestProjects/.paket/Paket.Restore.targets | 570 ++++++++++ .../ConfigurationDependent.fsproj | 14 + ...igurationDependent.fsproj.paket.references | 9 + .../before/TestProjects/Directory.Build.props | 6 + .../before/TestProjects/FixedProperty.fsproj | 12 + .../FixedProperty.fsproj.paket.references | 9 + .../before/TestProjects/MainGroup.fsproj | 12 + .../MainGroup.fsproj.paket.references | 4 + .../TestProjects/MixedProperties.fsproj | 13 + .../MixedProperties.fsproj.paket.references | 11 + .../TestProjects/NonConditionalGroup.fsproj | 11 + ...onConditionalGroup.fsproj.paket.references | 5 + .../before/TestProjects/Program.fs | 21 + .../before/TestProjects/TestProjects.sln | 40 + .../before/TestProjects/global.json | 7 + .../before/TestProjects/paket.dependencies | 41 + .../before/TestProjects/paket.lock | 42 + 31 files changed, 1657 insertions(+), 502 deletions(-) create mode 100644 integrationtests/Paket.IntegrationTests/ConditionSpecs.fs create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/.gitignore create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/Packages/Directory.Build.targets create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/Packages/Packages.sln create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/PackageDescription.cs create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/PaketTest2394.PackageA.csproj create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/build/PaketTest2394.PackageA.targets create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB.Transient/PackageDescription.cs create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB.Transient/PaketTest2394.PackageB.Transient.csproj create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB/PackageDescription.cs create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB/PaketTest2394.PackageB.csproj create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/.paket/Paket.Restore.targets create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/ConfigurationDependent.fsproj create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/ConfigurationDependent.fsproj.paket.references create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/Directory.Build.props create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/FixedProperty.fsproj create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/FixedProperty.fsproj.paket.references create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MainGroup.fsproj create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MainGroup.fsproj.paket.references create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MixedProperties.fsproj create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MixedProperties.fsproj.paket.references create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/NonConditionalGroup.fsproj create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/NonConditionalGroup.fsproj.paket.references create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/Program.fs create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/TestProjects.sln create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/global.json create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/paket.dependencies create mode 100644 integrationtests/scenarios/i002394-group-conditions/before/TestProjects/paket.lock diff --git a/.paket/Paket.Restore.targets b/.paket/Paket.Restore.targets index bbeec153f5..4deb15bcd1 100644 --- a/.paket/Paket.Restore.targets +++ b/.paket/Paket.Restore.targets @@ -1,325 +1,322 @@ - - - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - $(MSBuildVersion) - 15.0.0 - false - true - - true - $(MSBuildThisFileDirectory) - $(MSBuildThisFileDirectory)..\ - $(PaketRootPath)paket-files\paket.restore.cached - $(PaketRootPath)paket.lock - classic - proj - assembly - native - /Library/Frameworks/Mono.framework/Commands/mono - mono - - - $(PaketRootPath)paket.bootstrapper.exe - $(PaketToolsPath)paket.bootstrapper.exe - $([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\ - - "$(PaketBootStrapperExePath)" - $(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)" - - - - - true - true - - - True - - - False - - $(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/')) - - - - - - - - - $(PaketRootPath)paket - $(PaketToolsPath)paket - - - - - - $(PaketRootPath)paket.exe - $(PaketToolsPath)paket.exe - - - - - - <_DotnetToolsJson Condition="Exists('$(PaketRootPath)/.config/dotnet-tools.json')">$([System.IO.File]::ReadAllText("$(PaketRootPath)/.config/dotnet-tools.json")) - <_ConfigContainsPaket Condition=" '$(_DotnetToolsJson)' != ''">$(_DotnetToolsJson.Contains('"paket"')) - <_ConfigContainsPaket Condition=" '$(_ConfigContainsPaket)' == ''">false - - - - - - - - - - - <_PaketCommand>dotnet paket - - - - - - $(PaketToolsPath)paket - $(PaketBootStrapperExeDir)paket - - - paket - - - - - <_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)")) - <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)" - <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" - <_PaketCommand Condition=" '$(_PaketCommand)' == '' ">"$(PaketExePath)" - - - - - - - - - - - - - - - - - - - - - true - $(NoWarn);NU1603;NU1604;NU1605;NU1608 - false - true - - - - - - - - - $([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)')) - - - - - - - $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[0].Replace(`"`, ``).Replace(` `, ``)) - $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[1].Replace(`"`, ``).Replace(` `, ``)) - - - - - %(PaketRestoreCachedKeyValue.Value) - %(PaketRestoreCachedKeyValue.Value) - - - - - true - false - true - - - + + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + $(MSBuildVersion) + 15.0.0 + false + true + + true + $(MSBuildThisFileDirectory) + $(MSBuildThisFileDirectory)..\ + $(PaketRootPath)paket-files\paket.restore.cached + $(PaketRootPath)paket.lock + classic + proj + assembly + native + /Library/Frameworks/Mono.framework/Commands/mono + mono + + + $(PaketRootPath)paket.bootstrapper.exe + $(PaketToolsPath)paket.bootstrapper.exe + $([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\ + + "$(PaketBootStrapperExePath)" + $(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)" + + + + + true + true + + + True + + + False + + $(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/')) + + + + + + + + + $(PaketRootPath)paket + $(PaketToolsPath)paket + + + + + + $(PaketRootPath)paket.exe + $(PaketToolsPath)paket.exe + + + + + + <_DotnetToolsJson Condition="Exists('$(PaketRootPath)/.config/dotnet-tools.json')">$([System.IO.File]::ReadAllText("$(PaketRootPath)/.config/dotnet-tools.json")) + <_ConfigContainsPaket Condition=" '$(_DotnetToolsJson)' != ''">$(_DotnetToolsJson.Contains('"paket"')) + <_ConfigContainsPaket Condition=" '$(_ConfigContainsPaket)' == ''">false + + + + + + + + + + + <_PaketCommand>dotnet paket + + + + + + $(PaketToolsPath)paket + $(PaketBootStrapperExeDir)paket + + + paket + + + + + <_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)")) + <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)" + <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" + <_PaketCommand Condition=" '$(_PaketCommand)' == '' ">"$(PaketExePath)" + + + + + + + + + + + + + + + + + + + + + true + $(NoWarn);NU1603;NU1604;NU1605;NU1608 + false + true + + + + + + + + + $([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)')) + + + + + + + $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[0].Replace(`"`, ``).Replace(` `, ``)) + $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[1].Replace(`"`, ``).Replace(` `, ``)) + + + + + %(PaketRestoreCachedKeyValue.Value) + %(PaketRestoreCachedKeyValue.Value) + + + + + true + false + true + + + - - true - - - - - - - - - - - - - - - - - - - $(PaketIntermediateOutputPath)\$(MSBuildProjectFile).paket.references.cached - - $(MSBuildProjectFullPath).paket.references - - $(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references - - $(MSBuildProjectDirectory)\paket.references - - false - true - true - references-file-or-cache-not-found - - - - - $([System.IO.File]::ReadAllText('$(PaketReferencesCachedFilePath)')) - $([System.IO.File]::ReadAllText('$(PaketOriginalReferencesFilePath)')) - references-file - false - - - - - false - - - - - true - target-framework '$(TargetFramework)' or '$(TargetFrameworks)' files @(PaketResolvedFilePaths) - - - - - - - - - - - false - true - - - - - - - - - - - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',').Length) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0]) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1]) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4]) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5]) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[6]) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[7]) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[8]) - - - %(PaketReferencesFileLinesInfo.PackageVersion) - All - runtime - $(ExcludeAssets);contentFiles - $(ExcludeAssets);build;buildMultitargeting;buildTransitive - %(PaketReferencesFileLinesInfo.Aliases) - true - true - - - - - - $(PaketIntermediateOutputPath)/$(MSBuildProjectFile).paket.clitools - - - - - - - - - $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[0]) - $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[1]) - - - %(PaketCliToolFileLinesInfo.PackageVersion) - - - - + + + + + + + + + + + + + + + + $(PaketIntermediateOutputPath)\$(MSBuildProjectFile).paket.references.cached + + $(MSBuildProjectFullPath).paket.references + + $(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references + + $(MSBuildProjectDirectory)\paket.references + + false + true + true + references-file-or-cache-not-found + + + + + $([System.IO.File]::ReadAllText('$(PaketReferencesCachedFilePath)')) + $([System.IO.File]::ReadAllText('$(PaketOriginalReferencesFilePath)')) + references-file + false + + + + + false + + + + + true + target-framework '$(TargetFramework)' or '$(TargetFrameworks)' files @(PaketResolvedFilePaths) + + + + + + + + + + + false + true + + + + + + + + + + + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',').Length) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[6]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[7]) + + + %(PaketReferencesFileLinesInfo.PackageVersion) + All + runtime + $(ExcludeAssets);contentFiles + $(ExcludeAssets);build;buildMultitargeting;buildTransitive + true + true + + + + + $(PaketIntermediateOutputPath)/$(MSBuildProjectFile).paket.clitools + + + + + + + + + $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[0]) + $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[1]) + + + %(PaketCliToolFileLinesInfo.PackageVersion) + + + + - - - - - false - - - - - - <_NuspecFilesNewLocation Include="$(PaketIntermediateOutputPath)\$(Configuration)\*.nuspec"/> - - - - - - $(MSBuildProjectDirectory)/$(MSBuildProjectFile) - true - false - true - false - true - false - true - false - true - false - true - $(PaketIntermediateOutputPath)\$(Configuration) - $(PaketIntermediateOutputPath) - - - - <_NuspecFiles Include="$(AdjustedNuspecOutputPath)\*.$(PackageVersion.Split(`+`)[0]).nuspec"/> - - - - - - - - - + + + + + false + + + + + + <_NuspecFilesNewLocation Include="$(PaketIntermediateOutputPath)\$(Configuration)\*.nuspec"/> + + + + + + $(MSBuildProjectDirectory)/$(MSBuildProjectFile) + true + false + true + false + true + false + true + false + true + false + true + $(PaketIntermediateOutputPath)\$(Configuration) + $(PaketIntermediateOutputPath) + + + + <_NuspecFiles Include="$(AdjustedNuspecOutputPath)\*.$(PackageVersion.Split(`+`)[0]).nuspec"/> + + + + + + + + + - - - - - - - - - + + + + + + + + + diff --git a/integrationtests/Paket.IntegrationTests/ConditionSpecs.fs b/integrationtests/Paket.IntegrationTests/ConditionSpecs.fs new file mode 100644 index 0000000000..e4a9e57fb5 --- /dev/null +++ b/integrationtests/Paket.IntegrationTests/ConditionSpecs.fs @@ -0,0 +1,209 @@ +module Paket.IntegrationTests.ConditionSpecs + +open System.Text.RegularExpressions +open Fake +open System +open NUnit.Framework +open FsUnit +open System +open System.IO +open System.Diagnostics +open Paket +open Paket.Domain + +let preparePackages workingDir = + let packagesDir = workingDir @@ "Packages" + + [1..5] + |> List.filter (fun v -> fileExists (workingDir @@ "Packages" @@ $"PaketTest2394.PackageA.%d{v}.0.0.nupkg") |> not) + |> List.map (fun v -> directDotnet false $"pack -o . -p:Version=%d{v}.0" packagesDir) + |> ignore + +let private shouldIncludeVersionedString (pattern: string) (version: int) (inputs: string seq) = + let expected = pattern.Replace("XX", version.ToString()) + let regex = $"""^%s{Regex.Escape(pattern).Replace("XX", "(\d)")}$""" + + inputs + |> Seq.filter (fun input -> Regex.IsMatch(input, regex)) + |> Seq.iter (fun input -> Assert.That(input, Is.EqualTo expected)) + +let private shouldIncludePackageA v i = shouldIncludeVersionedString "PackageA XX.0" v i +let private shouldIncludePackageB v i = shouldIncludeVersionedString "PackageB XX.0 (references PackageB.Transient XX.0)" v i +let private shouldIncludePackageBTransient v i = shouldIncludeVersionedString "PackageB.Transient XX.0" v i +let private shouldIncludeConstant v i = shouldIncludeVersionedString "Constant PACKAGEA_XX set" v i + +[] +let ``#2394 default group with no condition`` () = + let scenario = "i002394-group-conditions" + preparePackages (originalScenarioPath scenario) + + use __ = prepare scenario + let root = scenarioTempPath scenario + let projectDir = root @@ "TestProjects" + + directPaketInPath "install" projectDir |> ignore + let output = directDotnet false "run --project MainGroup.fsproj" projectDir |> Seq.map (_.Message) + directDotnet false "pack MainGroup.fsproj -o ." projectDir |> ignore + + output |> shouldIncludePackageA 1 + output |> shouldIncludePackageB 1 + output |> shouldIncludePackageBTransient 1 + output |> shouldIncludeConstant 1 + + let nupkgPath = projectDir @@ "MainGroup.1.0.0.nupkg" + + if File.Exists nupkgPath |> not then Assert.Fail $"Expected '%s{nupkgPath}' to exist" + let nuspec = NuGetCache.getNuSpecFromNupkg nupkgPath + let dependencies = nuspec.Dependencies.Value + |> List.map (fun (n, v, _) -> n.Name, v.Range.ToString()) + + let expected = [("PaketTest2394.PackageA", ">= 1.0 < 2.0"); ("PaketTest2394.PackageB", ">= 1.0 < 2.0")] + Assert.That(dependencies, Is.SupersetOf expected) + +[] +let ``#2394 alternate group with no condition`` () = + let scenario = "i002394-group-conditions" + preparePackages (originalScenarioPath scenario) + + use __ = prepare scenario + let root = scenarioTempPath scenario + let projectDir = root @@ "TestProjects" + + directPaketInPath "install" projectDir |> ignore + let output = directDotnet false "run --project NonConditionalGroup.fsproj" projectDir |> Seq.map (_.Message) + directDotnet false "pack NonConditionalGroup.fsproj -o ." projectDir |> ignore + + output |> shouldIncludePackageA 2 + output |> shouldIncludePackageB 2 + output |> shouldIncludePackageBTransient 2 + output |> shouldIncludeConstant 2 + + let nupkgPath = projectDir @@ "NonConditionalGroup.1.0.0.nupkg" + + if File.Exists nupkgPath |> not then Assert.Fail $"Expected '%s{nupkgPath}' to exist" + let nuspec = NuGetCache.getNuSpecFromNupkg nupkgPath + let dependencies = nuspec.Dependencies.Value + |> List.map (fun (n, v, _) -> n.Name, v.Range.ToString()) + + let expected = [("PaketTest2394.PackageA", ">= 2.0 < 3.0"); ("PaketTest2394.PackageB", ">= 2.0 < 3.0")] + Assert.That(dependencies, Is.SupersetOf expected) + +[] +let ``#2394 group with fixed property condition`` () = + let scenario = "i002394-group-conditions" + preparePackages (originalScenarioPath scenario) + + use __ = prepare scenario + let root = scenarioTempPath scenario + let projectDir = root @@ "TestProjects" + + directPaketInPath "install" projectDir |> ignore + let output = directDotnet false "run --project FixedProperty.fsproj" projectDir |> Seq.map (_.Message) + directDotnet false "pack FixedProperty.fsproj -o ." projectDir |> ignore + + output |> shouldIncludePackageA 3 + output |> shouldIncludePackageB 3 + output |> shouldIncludePackageBTransient 3 + output |> shouldIncludeConstant 3 + + let nupkgPath = projectDir @@ "FixedProperty.1.0.0.nupkg" + + if File.Exists nupkgPath |> not then Assert.Fail $"Expected '%s{nupkgPath}' to exist" + let nuspec = NuGetCache.getNuSpecFromNupkg nupkgPath + let dependencies = nuspec.Dependencies.Value + |> List.map (fun (n, v, _) -> n.Name, v.Range.ToString()) + + let expected = [("PaketTest2394.PackageA", ">= 3.0 < 4.0"); ("PaketTest2394.PackageB", ">= 3.0 < 4.0")] + Assert.That(dependencies, Is.SupersetOf expected) + +[] +let ``#2394 mix dependencies from multiple groups with conditions`` () = + let scenario = "i002394-group-conditions" + preparePackages (originalScenarioPath scenario) + + use __ = prepare scenario + let root = scenarioTempPath scenario + let projectDir = root @@ "TestProjects" + + directPaketInPath "install" projectDir |> ignore + let output = directDotnet false "run --project MixedProperties.fsproj" projectDir |> Seq.map (_.Message) + directDotnet false "pack MixedProperties.fsproj -o ." projectDir |> ignore + + output |> shouldIncludePackageA 4 + output |> shouldIncludePackageB 5 + output |> shouldIncludePackageBTransient 5 + output |> shouldIncludeConstant 4 + + let expected = ["PackageA 4.0"; "PackageB 5.0 (references PackageB.Transient 5.0)"; "PackageB.Transient 5.0"; "Constant PACKAGEA_4 set"] + let rejected = ["PackageA 1.0"; "PackageB.Transient 1.0"; "Constant PACKAGEA_1 set" + "PackageA 2.0"; "PackageB.Transient 2.0"; "Constant PACKAGEA_2 set" + "PackageA 3.0"; "PackageB.Transient 3.0"; "Constant PACKAGEA_3 set" + "PackageA 5.0"; "PackageB.Transient 4.0"; "Constant PACKAGEA_5 set"] + Assert.That(output, Is.SupersetOf expected) + Assert.That(output, Is.Not.SubsetOf rejected) + + let nupkgPath = projectDir @@ "MixedProperties.1.0.0.nupkg" + + if File.Exists nupkgPath |> not then Assert.Fail $"Expected '%s{nupkgPath}' to exist" + let nuspec = NuGetCache.getNuSpecFromNupkg nupkgPath + let dependencies = nuspec.Dependencies.Value + |> List.map (fun (n, v, _) -> n.Name, v.Range.ToString()) + + let expected = [("PaketTest2394.PackageA", ">= 4.0 < 5.0"); ("PaketTest2394.PackageB", ">= 5.0 < 6.0")] + Assert.That(dependencies, Is.SupersetOf expected) + +[] +let ``#2394 project with dynamic condition based on configuration 1`` () = + let scenario = "i002394-group-conditions" + preparePackages (originalScenarioPath scenario) + + use __ = prepare scenario + let root = scenarioTempPath scenario + let projectDir = root @@ "TestProjects" + + directPaketInPath "install" projectDir |> ignore + let output = directDotnet false "run --project ConfigurationDependent.fsproj" projectDir |> Seq.map (_.Message) + directDotnet false "pack ConfigurationDependent.fsproj -o ." projectDir |> ignore + + output |> shouldIncludePackageA 3 + output |> shouldIncludePackageB 3 + output |> shouldIncludePackageBTransient 3 + output |> shouldIncludeConstant 3 + + let nupkgPath = projectDir @@ "ConfigurationDependent.1.0.0.nupkg" + + if File.Exists nupkgPath |> not then Assert.Fail $"Expected '%s{nupkgPath}' to exist" + let nuspec = NuGetCache.getNuSpecFromNupkg nupkgPath + let dependencies = nuspec.Dependencies.Value + |> List.map (fun (n, v, _) -> n.Name, v.Range.ToString()) + + let expected = [("PaketTest2394.PackageA", ">= 3.0 < 4.0"); ("PaketTest2394.PackageB", ">= 3.0 < 4.0")] + Assert.That(dependencies, Is.SupersetOf expected) + +[] +let ``#2394 project with dynamic condition based on configuration 2`` () = + let scenario = "i002394-group-conditions" + preparePackages (originalScenarioPath scenario) + + use __ = prepare scenario + let root = scenarioTempPath scenario + let projectDir = root @@ "TestProjects" + + directPaketInPath "install" projectDir |> ignore + let output = directDotnet false "run --project ConfigurationDependent.fsproj --configuration Alternate" projectDir |> Seq.map (_.Message) + directDotnet false "pack ConfigurationDependent.fsproj --configuration Alternate -o ." projectDir |> ignore + + output |> shouldIncludePackageA 4 + output |> shouldIncludePackageB 4 + output |> shouldIncludePackageBTransient 4 + output |> shouldIncludeConstant 4 + + let nupkgPath = projectDir @@ "ConfigurationDependent.1.0.0.nupkg" + + if File.Exists nupkgPath |> not then Assert.Fail $"Expected '%s{nupkgPath}' to exist" + let nuspec = NuGetCache.getNuSpecFromNupkg nupkgPath + let dependencies = nuspec.Dependencies.Value + |> List.map (fun (n, v, _) -> n.Name, v.Range.ToString()) + + let expected = [("PaketTest2394.PackageA", ">= 4.0 < 5.0"); ("PaketTest2394.PackageB", ">= 4.0 < 5.0")] + Assert.That(dependencies, Is.SupersetOf expected) diff --git a/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj b/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj index f134ed92c0..641146eec4 100644 --- a/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj +++ b/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj @@ -40,6 +40,7 @@ + @@ -51,4 +52,4 @@ - \ No newline at end of file + diff --git a/integrationtests/Paket.IntegrationTests/TestHelper.fs b/integrationtests/Paket.IntegrationTests/TestHelper.fs index 61b7181710..99b2581080 100644 --- a/integrationtests/Paket.IntegrationTests/TestHelper.fs +++ b/integrationtests/Paket.IntegrationTests/TestHelper.fs @@ -10,7 +10,7 @@ open System open System.IO open Paket.Logging -let disableScenarioCleanup = false // change to true to debug a single test temporarily. +let disableScenarioCleanup = true // change to true to debug a single test temporarily. let isLiveUnitTesting = AppDomain.CurrentDomain.GetAssemblies() |> Seq.exists (fun a -> a.GetName().Name = "Microsoft.CodeAnalysis.LiveUnitTesting.Runtime") diff --git a/integrationtests/scenarios/i002394-group-conditions/before/.gitignore b/integrationtests/scenarios/i002394-group-conditions/before/.gitignore new file mode 100644 index 0000000000..09417ada6d --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/.gitignore @@ -0,0 +1,2 @@ +*.nupkg +bin/ \ No newline at end of file diff --git a/integrationtests/scenarios/i002394-group-conditions/before/Packages/Directory.Build.targets b/integrationtests/scenarios/i002394-group-conditions/before/Packages/Directory.Build.targets new file mode 100644 index 0000000000..11cd321c71 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/Packages/Directory.Build.targets @@ -0,0 +1,17 @@ + + + + + <_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.PackageVersion)' != ''" /> + <_ProjectReferenceWithExactPackageVersion Include="@(ProjectReference->'%(FullPath)')" /> + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExplicitPackageVersion)' == '@(_ProjectReferencesWithVersions)'"> + @(_ProjectReferenceWithExplicitPackageVersion->'%(PackageVersion)') + + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExactPackageVersion)' == '@(_ProjectReferencesWithVersions)'"> + [@(_ProjectReferencesWithVersions->'%(ProjectVersion)')] + + <_ProjectReferencesWithVersions Remove="@(_ProjectReferenceWithReassignedVersion)" /> + <_ProjectReferencesWithVersions Include="@(_ProjectReferenceWithReassignedVersion)" /> + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i002394-group-conditions/before/Packages/Packages.sln b/integrationtests/scenarios/i002394-group-conditions/before/Packages/Packages.sln new file mode 100644 index 0000000000..45e37625f2 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/Packages/Packages.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaketTest2394.PackageA", "PaketTest2394.PackageA\PaketTest2394.PackageA.csproj", "{A0449AB0-A1EA-4BE6-8D03-701BC5A2FD46}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaketTest2394.PackageB", "PaketTest2394.PackageB\PaketTest2394.PackageB.csproj", "{59B3FFCE-AA5A-4AAA-B73D-108A6A15E524}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaketTest2394.PackageB.Transient", "PaketTest2394.PackageB.Transient\PaketTest2394.PackageB.Transient.csproj", "{C763B8F6-18BF-4018-B852-CA8EE39C94F5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A0449AB0-A1EA-4BE6-8D03-701BC5A2FD46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0449AB0-A1EA-4BE6-8D03-701BC5A2FD46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0449AB0-A1EA-4BE6-8D03-701BC5A2FD46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0449AB0-A1EA-4BE6-8D03-701BC5A2FD46}.Release|Any CPU.Build.0 = Release|Any CPU + {59B3FFCE-AA5A-4AAA-B73D-108A6A15E524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59B3FFCE-AA5A-4AAA-B73D-108A6A15E524}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59B3FFCE-AA5A-4AAA-B73D-108A6A15E524}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59B3FFCE-AA5A-4AAA-B73D-108A6A15E524}.Release|Any CPU.Build.0 = Release|Any CPU + {C763B8F6-18BF-4018-B852-CA8EE39C94F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C763B8F6-18BF-4018-B852-CA8EE39C94F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C763B8F6-18BF-4018-B852-CA8EE39C94F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C763B8F6-18BF-4018-B852-CA8EE39C94F5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/PackageDescription.cs b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/PackageDescription.cs new file mode 100644 index 0000000000..22278a36b3 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/PackageDescription.cs @@ -0,0 +1,10 @@ +namespace PaketTest2394.PackageA; + +public static class PackageDescription +{ + public static string GetDescription() + { + var assemblyName = typeof(PackageDescription).Assembly.GetName(); + return $"PackageA {assemblyName.Version!.ToString(2)}"; + } +} diff --git a/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/PaketTest2394.PackageA.csproj b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/PaketTest2394.PackageA.csproj new file mode 100644 index 0000000000..5839d8b818 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/PaketTest2394.PackageA.csproj @@ -0,0 +1,17 @@ + + + + net6.0 + enable + enable + + + + + + + %24(DefineConstants)%3BPACKAGEA_$(Version.Split('.')[0]) + + + + diff --git a/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/build/PaketTest2394.PackageA.targets b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/build/PaketTest2394.PackageA.targets new file mode 100644 index 0000000000..0e0fe5b3aa --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageA/build/PaketTest2394.PackageA.targets @@ -0,0 +1,5 @@ + + + $(DefineConstants);PACKAGEA_5 + + \ No newline at end of file diff --git a/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB.Transient/PackageDescription.cs b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB.Transient/PackageDescription.cs new file mode 100644 index 0000000000..3f26273206 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB.Transient/PackageDescription.cs @@ -0,0 +1,10 @@ +namespace PaketTest2394.PackageB.Transient; + +public static class PackageDescription +{ + public static string GetDescription() + { + var assemblyName = typeof(PackageDescription).Assembly.GetName(); + return $"PackageB.Transient {assemblyName.Version!.ToString(2)}"; + } +} diff --git a/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB.Transient/PaketTest2394.PackageB.Transient.csproj b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB.Transient/PaketTest2394.PackageB.Transient.csproj new file mode 100644 index 0000000000..eb2460e910 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB.Transient/PaketTest2394.PackageB.Transient.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB/PackageDescription.cs b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB/PackageDescription.cs new file mode 100644 index 0000000000..5cf468a8d4 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB/PackageDescription.cs @@ -0,0 +1,10 @@ +namespace PaketTest2394.PackageB; + +public static class PackageDescription +{ + public static string GetDescription() + { + var assemblyName = typeof(PackageDescription).Assembly.GetName(); + return $"PackageB {assemblyName.Version!.ToString(2)} (references {Transient.PackageDescription.GetDescription()})"; + } +} diff --git a/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB/PaketTest2394.PackageB.csproj b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB/PaketTest2394.PackageB.csproj new file mode 100644 index 0000000000..729e97cd65 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/Packages/PaketTest2394.PackageB/PaketTest2394.PackageB.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/.paket/Paket.Restore.targets b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/.paket/Paket.Restore.targets new file mode 100644 index 0000000000..0749ac7968 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/.paket/Paket.Restore.targets @@ -0,0 +1,570 @@ + + + + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + $(MSBuildVersion) + 15.0.0 + false + true + + true + $(MSBuildThisFileDirectory) + $(MSBuildThisFileDirectory)..\ + $(PaketRootPath)paket-files\paket.restore.cached + $(PaketRootPath)paket.lock + classic + proj + assembly + native + /Library/Frameworks/Mono.framework/Commands/mono + mono + + + $(PaketRootPath)paket.bootstrapper.exe + $(PaketToolsPath)paket.bootstrapper.exe + $([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\ + + "$(PaketBootStrapperExePath)" + $(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)" + + + + + true + true + + + True + + + False + + $(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/')) + + + + + + + + + $(PaketRootPath)paket + $(PaketToolsPath)paket + + + + + + $(PaketRootPath)paket.exe + $(PaketToolsPath)paket.exe + + + + + + <_DotnetToolsJson Condition="Exists('$(PaketRootPath)/.config/dotnet-tools.json')">$([System.IO.File]::ReadAllText("$(PaketRootPath)/.config/dotnet-tools.json")) + <_ConfigContainsPaket Condition=" '$(_DotnetToolsJson)' != ''">$(_DotnetToolsJson.Contains('"paket"')) + <_ConfigContainsPaket Condition=" '$(_ConfigContainsPaket)' == ''">false + + + + + + + + + + + <_PaketCommand>dotnet paket + + + + + + $(PaketToolsPath)paket + $(PaketBootStrapperExeDir)paket + + + paket + + + + + <_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)")) + <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)" + <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" + <_PaketCommand Condition=" '$(_PaketCommand)' == '' ">"$(PaketExePath)" + + + + + + + + + + + + + + + + + + + + + true + $(NoWarn);NU1603;NU1604;NU1605;NU1608 + false + true + + + + + + + + + $([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)')) + + + + + + + $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[0].Replace(`"`, ``).Replace(` `, ``)) + $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[1].Replace(`"`, ``).Replace(` `, ``)) + + + + + %(PaketRestoreCachedKeyValue.Value) + %(PaketRestoreCachedKeyValue.Value) + + + + + true + false + true + + + + + true + + + + + + + + + + + + + + + + + + + $(PaketIntermediateOutputPath)\$(MSBuildProjectFile).paket.references.cached + + $(MSBuildProjectFullPath).paket.references + + $(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references + + $(MSBuildProjectDirectory)\paket.references + + false + true + true + references-file-or-cache-not-found + + + + + $([System.IO.File]::ReadAllText('$(PaketReferencesCachedFilePath)')) + $([System.IO.File]::ReadAllText('$(PaketOriginalReferencesFilePath)')) + references-file + false + + + + + false + + + + + true + target-framework '$(TargetFramework)' or '$(TargetFrameworks)' files @(PaketResolvedFilePaths) + + + + + + + + + + + false + true + + + + + + + + + + + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',').Length) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[6]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[7]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[8]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[9]) + + + %(PaketReferencesFileLinesInfo.PackageVersion) + All + runtime + $(ExcludeAssets);contentFiles + $(ExcludeAssets);build;buildMultitargeting;buildTransitive + %(PaketReferencesFileLinesInfo.Aliases) + true + true + + + + + $(PaketIntermediateOutputPath)/$(MSBuildProjectFile).paket.clitools + + + + + + + + + $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[0]) + $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[1]) + + + %(PaketCliToolFileLinesInfo.PackageVersion) + + + + + + + + + + false + + + + + + <_NuspecFilesNewLocation Include="$(PaketIntermediateOutputPath)\$(Configuration)\*.nuspec"/> + + + + + + $(MSBuildProjectDirectory)/$(MSBuildProjectFile) + true + false + true + false + true + false + true + false + true + false + true + $(PaketIntermediateOutputPath)\$(Configuration) + $(PaketIntermediateOutputPath) + + + + <_NuspecFiles Include="$(AdjustedNuspecOutputPath)\*.$(PackageVersion.Split(`+`)[0]).nuspec"/> + + + + + + + + <_DefinedConditionProperties Include="@(_ConditionProperties)" Condition="$(%(Identity)) == 'true'"/> + + + <_ConditionsParameter> + <_ConditionsParameter Condition="@(_DefinedConditionProperties) != ''">--conditions @(_DefinedConditionProperties) + + + + + + + + + + + + + + + + + + + + + diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/ConfigurationDependent.fsproj b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/ConfigurationDependent.fsproj new file mode 100644 index 0000000000..29e48eb752 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/ConfigurationDependent.fsproj @@ -0,0 +1,14 @@ + + + + Exe + net6.0 + Debug;Release;Alternate + true + true + + + + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/ConfigurationDependent.fsproj.paket.references b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/ConfigurationDependent.fsproj.paket.references new file mode 100644 index 0000000000..9eea92382a --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/ConfigurationDependent.fsproj.paket.references @@ -0,0 +1,9 @@ +FSharp.Core + +group condition-x + PaketTest2394.PackageA + PaketTest2394.PackageB + +group condition-y + PaketTest2394.PackageA + PaketTest2394.PackageB diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/Directory.Build.props b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/Directory.Build.props new file mode 100644 index 0000000000..5dc225d133 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/Directory.Build.props @@ -0,0 +1,6 @@ + + + bin/$(MSBuildProjectName)/$(Configuration) + obj/$(MSBuildProjectName)/$(Configuration) + + \ No newline at end of file diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/FixedProperty.fsproj b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/FixedProperty.fsproj new file mode 100644 index 0000000000..3d3757ee07 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/FixedProperty.fsproj @@ -0,0 +1,12 @@ + + + + Exe + net6.0 + true + + + + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/FixedProperty.fsproj.paket.references b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/FixedProperty.fsproj.paket.references new file mode 100644 index 0000000000..9eea92382a --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/FixedProperty.fsproj.paket.references @@ -0,0 +1,9 @@ +FSharp.Core + +group condition-x + PaketTest2394.PackageA + PaketTest2394.PackageB + +group condition-y + PaketTest2394.PackageA + PaketTest2394.PackageB diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MainGroup.fsproj b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MainGroup.fsproj new file mode 100644 index 0000000000..b98919214b --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MainGroup.fsproj @@ -0,0 +1,12 @@ + + + + Exe + net6.0 + true + + + + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MainGroup.fsproj.paket.references b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MainGroup.fsproj.paket.references new file mode 100644 index 0000000000..3da58c9656 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MainGroup.fsproj.paket.references @@ -0,0 +1,4 @@ +FSharp.Core + +PaketTest2394.PackageA +PaketTest2394.PackageB diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MixedProperties.fsproj b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MixedProperties.fsproj new file mode 100644 index 0000000000..40f9d26f51 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MixedProperties.fsproj @@ -0,0 +1,13 @@ + + + + Exe + net6.0 + true + true + + + + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MixedProperties.fsproj.paket.references b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MixedProperties.fsproj.paket.references new file mode 100644 index 0000000000..0b359ab2fe --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/MixedProperties.fsproj.paket.references @@ -0,0 +1,11 @@ +FSharp.Core + +group condition-x + PaketTest2394.PackageA + PaketTest2394.PackageB + +group condition-y + PaketTest2394.PackageA + +group condition-z + PaketTest2394.PackageB diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/NonConditionalGroup.fsproj b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/NonConditionalGroup.fsproj new file mode 100644 index 0000000000..11f775015e --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/NonConditionalGroup.fsproj @@ -0,0 +1,11 @@ + + + + Exe + net6.0 + + + + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/NonConditionalGroup.fsproj.paket.references b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/NonConditionalGroup.fsproj.paket.references new file mode 100644 index 0000000000..d4841182b9 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/NonConditionalGroup.fsproj.paket.references @@ -0,0 +1,5 @@ +FSharp.Core + +group no-condition + PaketTest2394.PackageA + PaketTest2394.PackageB diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/Program.fs b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/Program.fs new file mode 100644 index 0000000000..8b03e7923b --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/Program.fs @@ -0,0 +1,21 @@ +// To verify versions of referenced packages +printfn "%s" (PaketTest2394.PackageA.PackageDescription.GetDescription()) +printfn "%s" (PaketTest2394.PackageB.PackageDescription.GetDescription()) +printfn "%s" (PaketTest2394.PackageB.Transient.PackageDescription.GetDescription()) + +// To verify that *.targets file is loaded from the correct package version +#if PACKAGEA_1 +printfn "Constant PACKAGEA_1 set" +#endif +#if PACKAGEA_2 +printfn "Constant PACKAGEA_2 set" +#endif +#if PACKAGEA_3 +printfn "Constant PACKAGEA_3 set" +#endif +#if PACKAGEA_4 +printfn "Constant PACKAGEA_4 set" +#endif +#if PACKAGEA_5 +printfn "Constant PACKAGEA_5 set" +#endif diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/TestProjects.sln b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/TestProjects.sln new file mode 100644 index 0000000000..5678045ab0 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/TestProjects.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MainGroup", "MainGroup.fsproj", "{D5F04B31-1026-4F46-A75D-7F0989F73364}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "NonConditionalGroup", "NonConditionalGroup.fsproj", "{D43053B0-6860-454A-B42B-617B83514B3A}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FixedProperty", "FixedProperty.fsproj", "{5A5E1C52-7626-40C1-8522-24FA71826D46}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MixedProperties", "MixedProperties.fsproj", "{E6290682-7B89-4E1F-A282-3B8545F2DBFC}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ConfigurationDependent", "ConfigurationDependent.fsproj", "{6CC1CEA1-9F9A-4F8D-84C8-B5837391A114}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D5F04B31-1026-4F46-A75D-7F0989F73364}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5F04B31-1026-4F46-A75D-7F0989F73364}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5F04B31-1026-4F46-A75D-7F0989F73364}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D5F04B31-1026-4F46-A75D-7F0989F73364}.Release|Any CPU.Build.0 = Release|Any CPU + {D43053B0-6860-454A-B42B-617B83514B3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D43053B0-6860-454A-B42B-617B83514B3A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D43053B0-6860-454A-B42B-617B83514B3A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D43053B0-6860-454A-B42B-617B83514B3A}.Release|Any CPU.Build.0 = Release|Any CPU + {5A5E1C52-7626-40C1-8522-24FA71826D46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A5E1C52-7626-40C1-8522-24FA71826D46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5A5E1C52-7626-40C1-8522-24FA71826D46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5A5E1C52-7626-40C1-8522-24FA71826D46}.Release|Any CPU.Build.0 = Release|Any CPU + {E6290682-7B89-4E1F-A282-3B8545F2DBFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E6290682-7B89-4E1F-A282-3B8545F2DBFC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E6290682-7B89-4E1F-A282-3B8545F2DBFC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E6290682-7B89-4E1F-A282-3B8545F2DBFC}.Release|Any CPU.Build.0 = Release|Any CPU + {6CC1CEA1-9F9A-4F8D-84C8-B5837391A114}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6CC1CEA1-9F9A-4F8D-84C8-B5837391A114}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6CC1CEA1-9F9A-4F8D-84C8-B5837391A114}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6CC1CEA1-9F9A-4F8D-84C8-B5837391A114}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/global.json b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/global.json new file mode 100644 index 0000000000..1bcf6c03c6 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "6.0.0", + "rollForward": "latestMinor", + "allowPrerelease": false + } +} \ No newline at end of file diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/paket.dependencies b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/paket.dependencies new file mode 100644 index 0000000000..01f45aa608 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/paket.dependencies @@ -0,0 +1,41 @@ +source https://api.nuget.org/v3/index.json +source ../Packages + +nuget FSharp.Core + +nuget PaketTest2394.PackageA ~> 1.0 +nuget PaketTest2394.PackageB ~> 1.0 + +group no-condition + source https://api.nuget.org/v3/index.json + source ../Packages + + nuget PaketTest2394.PackageA ~> 2.0 + nuget PaketTest2394.PackageB ~> 2.0 + +group condition-x + condition PropertyX + + source https://api.nuget.org/v3/index.json + source ../Packages + + nuget PaketTest2394.PackageA ~> 3.0 + nuget PaketTest2394.PackageB ~> 3.0 + +group condition-y + condition PropertyY + + source https://api.nuget.org/v3/index.json + source ../Packages + + nuget PaketTest2394.PackageA ~> 4.0 + nuget PaketTest2394.PackageB ~> 4.0 + +group condition-z + condition PropertyZ + + source https://api.nuget.org/v3/index.json + source ../Packages + + nuget PaketTest2394.PackageB ~> 5.0 + diff --git a/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/paket.lock b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/paket.lock new file mode 100644 index 0000000000..a77270da33 --- /dev/null +++ b/integrationtests/scenarios/i002394-group-conditions/before/TestProjects/paket.lock @@ -0,0 +1,42 @@ +NUGET + remote: https://api.nuget.org/v3/index.json + FSharp.Core (8.0.200) + remote: ../Packages + PaketTest2394.PackageA (1.0.0) + PaketTest2394.PackageB (1.0.0) + PaketTest2394.PackageB.Transient (1.0) - restriction: >= net6.0 + PaketTest2394.PackageB.Transient (1.0.0) - restriction: >= net6.0 + +GROUP condition-x +CONDITION: PROPERTYX +NUGET + remote: ../Packages + PaketTest2394.PackageA (3.0.0) + PaketTest2394.PackageB (3.0.0) + PaketTest2394.PackageB.Transient (3.0) - restriction: >= net6.0 + PaketTest2394.PackageB.Transient (3.0.0) - restriction: >= net6.0 + +GROUP condition-y +CONDITION: PROPERTYY +NUGET + remote: ../Packages + PaketTest2394.PackageA (4.0.0) + PaketTest2394.PackageB (4.0.0) + PaketTest2394.PackageB.Transient (4.0) - restriction: >= net6.0 + PaketTest2394.PackageB.Transient (4.0.0) - restriction: >= net6.0 + +GROUP condition-z +CONDITION: PROPERTYZ +NUGET + remote: ../Packages + PaketTest2394.PackageB (5.0.0) + PaketTest2394.PackageB.Transient (5.0) - restriction: >= net6.0 + PaketTest2394.PackageB.Transient (5.0.0) - restriction: >= net6.0 + +GROUP no-condition +NUGET + remote: ../Packages + PaketTest2394.PackageA (2.0.0) + PaketTest2394.PackageB (2.0.0) + PaketTest2394.PackageB.Transient (2.0) - restriction: >= net6.0 + PaketTest2394.PackageB.Transient (2.0.0) - restriction: >= net6.0