Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for #4183 #4184

Merged
merged 1 commit into from
Nov 18, 2022
Merged

Conversation

TheAngryByrd
Copy link
Contributor

@TheAngryByrd TheAngryByrd commented Nov 10, 2022

Fixes for #4183

cc @baronfel

@TheAngryByrd TheAngryByrd force-pushed the 4183-multitarget-pack branch 5 times, most recently from 2441975 to ecd66b3 Compare November 10, 2022 04:47
Copy link
Contributor Author

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left self code review

@@ -1,5 1,6 @@
{
"sdk": {
"version": "6.0.301"
"version": "6.0.301",
"rollForward": "latestMinor"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed since dotnet versions keep moving on

integrationtests/Paket.IntegrationTests/PackSpecs.fs Outdated Show resolved Hide resolved
Comment on lines 1058 to 1094
let ``#4183 writes ranges for floating deps``() =
let scenario = "i004183-apply-with-multiple-groups"
use __ = prepareSdk scenario
let scenarioRoot = scenarioTempPath scenario
let fsprojPath = Path.Combine(scenarioRoot, "before.fsproj")

let inputNuspecPath = Path.Combine(scenarioRoot, "before.nuspec")
let refFile = Path.Combine(scenarioRoot, "paket.references")
let inputDeps = scrapeDeps inputNuspecPath

let dispose, messages = paket (sprintf "fix-nuspecs files %s project-file %s" inputNuspecPath fsprojPath) scenario
use __ = dispose
let outputDeps = scrapeDeps inputNuspecPath

let actualPackages = outputDeps |> Seq.filter (fst>>(=)"FSharp.Core")
let expectedVersionRanges =
[
"[4.7.2,5.0.0)"
"[7.0.0,8.0.0)"
]
|> Set.ofSeq

let actualVersionRanges =
actualPackages
|> Seq.map snd
|> Set.ofSeq

let diff = Set.difference expectedVersionRanges actualVersionRanges


if diff |> Seq.length = 0 then ()
else

failwithf "Expected to modify deps for FSharp.Core package with floating version constraint.\nBefore:\t%A\nAfter:\t%A\nMessages:\t%A"
inputDeps
outputDeps
messages
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test to simulate multi-targeting

Comment on lines 9 to 14
<group targetFramework=".NETStandard2.0">
<dependency id="FSharp.Core" version="4.7.2" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.1">
<dependency id="FSharp.Core" version="7.0.0" exclude="Build,Analyzers" />
</group>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi-target nuspec file

Comment on lines 2 to 14
group testGroup1
source https://api.nuget.org/v3/index.json
storage: none
nuget FSharp.Core ~> 4
framework: netstandard2.0
condition: netstandard2_0

group testGroup2
source https://api.nuget.org/v3/index.json
storage: none
nuget FSharp.Core ~> 7
framework: netstandard2.1
condition: netstandard2_1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paket.dependencies file with multi-targeting

@@ -854,7 855,7 @@ type LockFile (fileName:string, groups: Map<GroupName,LockFileGroup>) =
for p in g.Value.NugetPackages do
let k = g.Key,p.Name
if usedPackages.ContainsKey k |> not then
usedPackages.Add(k,p)
usedPackages.Add(k,{p with Settings = lockGroup.Options.Settings})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We we're getting the lock file's framework restrictions here. Let me know if I should use another way to get this and revert this change.

Comment on lines 984 to 997
let targetFramework =
attr "targetFramework" node.ParentNode
|> Option.bind(fun tfm ->
PlatformMatching.forceExtractPlatforms tfm |> fun p -> p.ToTargetProfile true
)
let results =
targetFramework
|> Option.map(fun tfm ->
allFrameworkRestrictions
|> Seq.filter(fun (_, _, fr) -> fr.IsMatch tfm)
|> Seq.toList

)
|> Option.defaultValue []
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code to align the nuspec group's targetFramework with a paket group.

@TheAngryByrd
Copy link
Contributor Author

@forki is there anything I can do to help this along?

@forki forki merged commit 3f71e6c into fsprojects:master Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants