Skip to content
Open
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
35 changes: 34 additions & 1 deletion src/Paket.Core/Versioning/FrameworkHandling.fs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ type Net8WindowsVersion =
| _ -> None

type Net9WindowsVersion = Net8WindowsVersion
type Net10WindowsVersion = Net9WindowsVersion

[<RequireQualifiedAccess>]
type Net5Os =
Expand Down Expand Up @@ -253,7 +254,8 @@ type Net8Os =
|> Seq.tryFind(fun (k,_) -> s.StartsWith k)
|> Option.map snd

type Net9Os = Net8Os
type Net9Os = Net8Os
type Net10Os = Net9Os

[<RequireQualifiedAccess>]
/// The Framework version.
Expand Down Expand Up @@ -284,6 +286,7 @@ type FrameworkVersion =
| V7
| V8
| V9
| V10
override this.ToString() =
match this with
| V1 -> "v1.0"
Expand Down Expand Up @@ -311,6 +314,7 @@ type FrameworkVersion =
| V7 -> "v7.0"
| V8 -> "v8.0"
| V9 -> "v9.0"
| V10 -> "v10.0"

member this.ShortString() =
match this with
Expand Down Expand Up @@ -339,6 +343,7 @@ type FrameworkVersion =
| FrameworkVersion.V7 -> "7.0"
| FrameworkVersion.V8 -> "8.0"
| FrameworkVersion.V9 -> "9.0"
| FrameworkVersion.V10 -> "10.0"

static member TryParse s =
match s with
Expand Down Expand Up @@ -367,6 +372,7 @@ type FrameworkVersion =
| "7" -> Some FrameworkVersion.V7
| "8" -> Some FrameworkVersion.V8
| "9" -> Some FrameworkVersion.V9
| "10" -> Some FrameworkVersion.V10
| _ -> None

[<RequireQualifiedAccess>]
Expand Down Expand Up @@ -808,6 +814,8 @@ type FrameworkIdentifier =
| DotNet8Windows of Net8WindowsVersion
| DotNet9WithOs of Net9Os
| DotNet9Windows of Net9WindowsVersion
| DotNet10WithOs of Net10Os
| DotNet10Windows of Net10WindowsVersion
| UAP of UAPVersion
| DotNetStandard of DotNetStandardVersion
| DotNetCoreApp of DotNetCoreAppVersion
Expand All @@ -831,6 +839,8 @@ type FrameworkIdentifier =
override x.ToString() =
match x with
| DotNetFramework v -> "net" + v.ShortString()
| DotNet10WithOs o -> "net10.0-" + o.ToString()
| DotNet10Windows v -> "net10.0-windows" + v.ToString()
| DotNet9WithOs o -> "net9.0-" + o.ToString()
| DotNet9Windows v -> "net9.0-windows" + v.ToString()
| DotNet8WithOs o -> "net8.0-" + o.ToString()
Expand Down Expand Up @@ -946,6 +956,7 @@ type FrameworkIdentifier =
| DotNetFramework FrameworkVersion.V7 -> [ DotNetFramework FrameworkVersion.V6 ]
| DotNetFramework FrameworkVersion.V8 -> [ DotNetFramework FrameworkVersion.V7 ]
| DotNetFramework FrameworkVersion.V9 -> [ DotNetFramework FrameworkVersion.V8 ]
| DotNetFramework FrameworkVersion.V10 -> [ DotNetFramework FrameworkVersion.V9 ]
| DotNet5WithOs Net5Os.Android -> [ DotNetFramework FrameworkVersion.V5; MonoAndroid MonoAndroidVersion.V12 ]
| DotNet5WithOs Net5Os.IOs -> [ DotNetFramework FrameworkVersion.V5; XamariniOS ]
| DotNet5WithOs Net5Os.MacOs -> [ DotNetFramework FrameworkVersion.V5; XamarinMac ]
Expand Down Expand Up @@ -977,6 +988,11 @@ type FrameworkIdentifier =
| DotNet9WithOs Net8Os.MacOs -> [ DotNetFramework FrameworkVersion.V9; XamarinMac ]
| DotNet9WithOs Net8Os.TvOs -> [ DotNetFramework FrameworkVersion.V9; XamarinTV ]
| DotNet9WithOs Net8Os.WatchOs -> [ DotNetFramework FrameworkVersion.V9; XamarinWatch ]
| DotNet10WithOs Net8Os.Android -> [ DotNetFramework FrameworkVersion.V10; MonoAndroid MonoAndroidVersion.V12 ]
| DotNet10WithOs Net8Os.IOs -> [ DotNetFramework FrameworkVersion.V10; XamariniOS ]
| DotNet10WithOs Net8Os.MacOs -> [ DotNetFramework FrameworkVersion.V10; XamarinMac ]
| DotNet10WithOs Net8Os.TvOs -> [ DotNetFramework FrameworkVersion.V10; XamarinTV ]
| DotNet10WithOs Net8Os.WatchOs -> [ DotNetFramework FrameworkVersion.V10; XamarinWatch ]
| DotNet6Windows Net6WindowsVersion.V7_0 -> [ DotNetFramework FrameworkVersion.V6 ]
| DotNet6Windows Net6WindowsVersion.V8_0 -> [ DotNetFramework FrameworkVersion.V6; DotNet6Windows Net6WindowsVersion.V7_0 ]
| DotNet6Windows Net6WindowsVersion.V10_0_17763_0 -> [ DotNetFramework FrameworkVersion.V6; DotNet6Windows Net6WindowsVersion.V8_0 ]
Expand All @@ -998,6 +1014,11 @@ type FrameworkIdentifier =
| DotNet9Windows Net8WindowsVersion.V10_0_17763_0 -> [ DotNetFramework FrameworkVersion.V8; DotNet9Windows Net8WindowsVersion.V8_0]
| DotNet9Windows Net8WindowsVersion.V10_0_18362_0 -> [ DotNetFramework FrameworkVersion.V8; DotNet9Windows Net8WindowsVersion.V10_0_17763_0 ]
| DotNet9Windows Net8WindowsVersion.V10_0_19041_0 -> [ DotNetFramework FrameworkVersion.V8; DotNet9Windows Net8WindowsVersion.V10_0_18362_0 ]
| DotNet10Windows Net8WindowsVersion.V7_0 -> [ DotNetFramework FrameworkVersion.V8; ]
| DotNet10Windows Net8WindowsVersion.V8_0 -> [ DotNetFramework FrameworkVersion.V8; DotNet10Windows Net8WindowsVersion.V7_0]
| DotNet10Windows Net8WindowsVersion.V10_0_17763_0 -> [ DotNetFramework FrameworkVersion.V8; DotNet10Windows Net8WindowsVersion.V8_0]
| DotNet10Windows Net8WindowsVersion.V10_0_18362_0 -> [ DotNetFramework FrameworkVersion.V8; DotNet10Windows Net8WindowsVersion.V10_0_17763_0 ]
| DotNet10Windows Net8WindowsVersion.V10_0_19041_0 -> [ DotNetFramework FrameworkVersion.V8; DotNet10Windows Net8WindowsVersion.V10_0_18362_0 ]
| DotNetStandard DotNetStandardVersion.V1_0 -> [ ]
| DotNetStandard DotNetStandardVersion.V1_1 -> [ DotNetStandard DotNetStandardVersion.V1_0 ]
| DotNetStandard DotNetStandardVersion.V1_2 -> [ DotNetStandard DotNetStandardVersion.V1_1 ]
Expand Down Expand Up @@ -1115,6 +1136,7 @@ module FrameworkDetection =
| Some "7" when dotnetVersionX = 7 -> tryParseSecondPart parts.[1]
| Some "8" when dotnetVersionX = 8 -> tryParseSecondPart parts.[1]
| Some "9" when dotnetVersionX = 9 -> tryParseSecondPart parts.[1]
| Some "10" when dotnetVersionX = 10 -> tryParseSecondPart parts.[1]
| _ -> None
else
None
Expand All @@ -1130,6 +1152,7 @@ module FrameworkDetection =
| Some "7" when dotnetVersionX = 7 -> tryParseVersion winVersionPart
| Some "8" when dotnetVersionX = 8 -> tryParseVersion winVersionPart
| Some "9" when dotnetVersionX = 9 -> tryParseVersion winVersionPart
| Some "10" when dotnetVersionX = 10 -> tryParseVersion winVersionPart
| _ -> None
else
None
Expand Down Expand Up @@ -1169,11 +1192,13 @@ module FrameworkDetection =
// http://nugettoolsdev.azurewebsites.net/4.0.0/parse-framework?framework=.NETPortable%2CVersion%3Dv0.0%2CProfile%3DProfile2
let result =
match path with
| MatchNetXDashWindows 10 Net10WindowsVersion.TryParse fm -> Some (DotNet10Windows fm)
| MatchNetXDashWindows 9 Net9WindowsVersion.TryParse fm -> Some (DotNet9Windows fm)
| MatchNetXDashWindows 8 Net8WindowsVersion.TryParse fm -> Some (DotNet8Windows fm)
| MatchNetXDashWindows 7 Net7WindowsVersion.TryParse fm -> Some (DotNet7Windows fm)
| MatchNetXDashWindows 6 Net6WindowsVersion.TryParse fm -> Some (DotNet6Windows fm)
| MatchNetXDashWindows 5 Net5WindowsVersion.TryParse fm -> Some (DotNet5Windows fm)
| MatchNetXDashOs 10 Net10Os.TryParse fm -> Some (DotNet10WithOs fm)
| MatchNetXDashOs 9 Net9Os.TryParse fm -> Some (DotNet9WithOs fm)
| MatchNetXDashOs 8 Net8Os.TryParse fm -> Some (DotNet8WithOs fm)
| MatchNetXDashOs 7 Net7Os.TryParse fm -> Some (DotNet7WithOs fm)
Expand Down Expand Up @@ -1560,6 +1585,7 @@ module KnownTargetProfiles =
FrameworkVersion.V7
FrameworkVersion.V8
FrameworkVersion.V9
FrameworkVersion.V10
]

let DotNetFrameworkIdentifiers =
Expand Down Expand Up @@ -1669,6 +1695,11 @@ module KnownTargetProfiles =
let DotNet9WindowsVersions = DotNet8WindowsVersions
let DotNet9WindowsProfiles = DotNet8WindowsProfiles

let DotNet10OperatingSystems = DotNet9OperatingSystems
let DotNet10WithOsProfiles = DotNet9WithOsProfiles
let DotNet10WindowsVersions = DotNet9WindowsVersions
let DotNet10WindowsProfiles = DotNet9WindowsProfiles

let DotNetStandardVersions = [
DotNetStandardVersion.V1_0
DotNetStandardVersion.V1_1
Expand Down Expand Up @@ -1840,6 +1871,8 @@ module KnownTargetProfiles =

let AllDotNetProfiles =
DotNetFrameworkProfiles @
DotNet10WithOsProfiles @
DotNet10WindowsProfiles @
DotNet9WithOsProfiles @
DotNet9WindowsProfiles @
DotNet8WithOsProfiles @
Expand Down
3 changes: 3 additions & 0 deletions src/Paket.Core/Versioning/PlatformMatching.fs
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,15 @@ let getTargetCondition (target:TargetProfile) =
match target with
| TargetProfile.SinglePlatform(platform) ->
match platform with
| DotNetFramework(FrameworkVersion.V10) ->"$(TargetFrameworkIdentifier) == '.NETCoreApp'", "$(TargetFrameworkVersion) == 'v10.0'"
| DotNetFramework(FrameworkVersion.V9) ->"$(TargetFrameworkIdentifier) == '.NETCoreApp'", "$(TargetFrameworkVersion) == 'v9.0'"
| DotNetFramework(FrameworkVersion.V8) ->"$(TargetFrameworkIdentifier) == '.NETCoreApp'", "$(TargetFrameworkVersion) == 'v8.0'"
| DotNetFramework(FrameworkVersion.V7) ->"$(TargetFrameworkIdentifier) == '.NETCoreApp'", "$(TargetFrameworkVersion) == 'v7.0'"
| DotNetFramework(FrameworkVersion.V6) ->"$(TargetFrameworkIdentifier) == '.NETCoreApp'", "$(TargetFrameworkVersion) == 'v6.0'"
| DotNetFramework(FrameworkVersion.V5) ->"$(TargetFrameworkIdentifier) == '.NETCoreApp'", "$(TargetFrameworkVersion) == 'v5.0'"
| DotNetFramework(version) ->"$(TargetFrameworkIdentifier) == '.NETFramework'", sprintf "$(TargetFrameworkVersion) == '%O'" version
| DotNet10WithOs(os) ->"$(TargetFrameworkIdentifier) == '.NETCoreApp'", sprintf "($(TargetFrameworkVersion) == 'v10.0' And '$(TargetPlatformIdentifier)' == '%O')" os
| DotNet10Windows(version) ->"$(TargetFrameworkIdentifier) == '.NETCoreApp'", sprintf "($(TargetFrameworkVersion) == 'v10.0' And '$(TargetPlatformIdentifier)' == 'Windows' And '$(TargetPlatformVersion)' == '%O')" version
| DotNet9WithOs(os) ->"$(TargetFrameworkIdentifier) == '.NETCoreApp'", sprintf "($(TargetFrameworkVersion) == 'v9.0' And '$(TargetPlatformIdentifier)' == '%O')" os
| DotNet9Windows(version) ->"$(TargetFrameworkIdentifier) == '.NETCoreApp'", sprintf "($(TargetFrameworkVersion) == 'v9.0' And '$(TargetPlatformIdentifier)' == 'Windows' And '$(TargetPlatformVersion)' == '%O')" version
| DotNet8WithOs(os) ->"$(TargetFrameworkIdentifier) == '.NETCoreApp'", sprintf "($(TargetFrameworkVersion) == 'v8.0' And '$(TargetPlatformIdentifier)' == '%O')" os
Expand Down
15 changes: 15 additions & 0 deletions tests/Paket.Tests/DependenciesFile/ParserSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,21 @@ let ``should read config with .NET 9 target framework``() =
|> getExplicitRestriction
|> shouldEqual (FrameworkRestriction.AtLeast(FrameworkIdentifier.DotNetFramework(FrameworkVersion.V9)))

let configNET10TargetFramework = """source https://www.nuget.org/api/v2

framework: >= net10.0

nuget System.Data.SQLite 1.0.98.1 content: none
"""

[<Test>]
let ``should read config with .NET 10 target framework``() =
let cfg = DependenciesFile.FromSource(configNET10TargetFramework)

cfg.Groups.[Constants.MainDependencyGroup].Options.Settings.FrameworkRestrictions
|> getExplicitRestriction
|> shouldEqual (FrameworkRestriction.AtLeast(FrameworkIdentifier.DotNetFramework(FrameworkVersion.V10)))

let validFrameworks =
let net40 = DotNetFramework(FrameworkVersion.V4)
let net45 = DotNetFramework(FrameworkVersion.V4_5)
Expand Down
Loading