-
Notifications
You must be signed in to change notification settings - Fork 525
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
Fixes for #4183 #4184
Conversation
2441975
to
ecd66b3
Compare
ecd66b3
to
3f71e6c
Compare
There was a problem hiding this 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" |
There was a problem hiding this comment.
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
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 |
There was a problem hiding this comment.
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
<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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multi-target nuspec file
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 |
There was a problem hiding this comment.
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}) |
There was a problem hiding this comment.
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.
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 [] |
There was a problem hiding this comment.
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.
@forki is there anything I can do to help this along? |
Fixes for #4183
cc @baronfel