Skip to content

Fixes for #4183 - #4184

Merged
forki merged 1 commit into
fsprojects:masterfrom
TheAngryByrd:4183-multitarget-pack
Nov 18, 2022
Merged

forki merged 1 commit into
fsprojects:masterfrom
TheAngryByrd:4183-multitarget-pack

Conversation

@TheAngryByrd

@TheAngryByrd TheAngryByrd commented Nov 10, 2022 •

Copy link
Copy Markdown
Contributor

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

@TheAngryByrd TheAngryByrd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Left self code review

Comment thread global.json
"sdk": {
"version": "6.0.301"
"version": "6.0.301",
"rollForward": "latestMinor"

Copy link
Copy Markdown
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

Comment thread integrationtests/Paket.IntegrationTests/PackSpecs.fs Outdated
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
Copy Markdown
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
Copy Markdown
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 No newline at end of file

Copy link
Copy Markdown
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

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants