From 4e6481d35262333341a80ae6b2b3188940a616fa Mon Sep 17 00:00:00 2001 From: Nicholas Schell Date: Wed, 11 Feb 2026 20:25:41 -0800 Subject: [PATCH 1/8] add new discriminated union type for native versions --- src/Paket.Core/Versioning/FrameworkHandling.fs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Paket.Core/Versioning/FrameworkHandling.fs b/src/Paket.Core/Versioning/FrameworkHandling.fs index 0589a36355..791812ddbb 100644 --- a/src/Paket.Core/Versioning/FrameworkHandling.fs +++ b/src/Paket.Core/Versioning/FrameworkHandling.fs @@ -545,6 +545,11 @@ type DotNetCoreAppVersion = | _ when s = "3.1" -> Some DotNetCoreAppVersion.V3_1 | _ -> None +type NativeVersion = + | NoVersion + | Major of major:int + | MajorMinor of major:int * minor:int + [] /// The Framework version. // Each time a new version is added NuGetPackageCache.CurrentCacheVersion should be bumped. From aa365f769eb8120643b2092f60e450b3b2a84dad Mon Sep 17 00:00:00 2001 From: Nicholas Schell Date: Wed, 11 Feb 2026 20:26:45 -0800 Subject: [PATCH 2/8] function to parse either native, native#, or native#.# --- .../Versioning/FrameworkHandling.fs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Paket.Core/Versioning/FrameworkHandling.fs b/src/Paket.Core/Versioning/FrameworkHandling.fs index 791812ddbb..700f908986 100644 --- a/src/Paket.Core/Versioning/FrameworkHandling.fs +++ b/src/Paket.Core/Versioning/FrameworkHandling.fs @@ -1242,6 +1242,30 @@ module FrameworkDetection = |> Option.bind FrameworkVersion.TryParse else None + let (|MatchNative|_|) (s:string) = + if not (s.StartsWith("native")) then + None + elif s.Length = 6 then + Some NativeVersion.NoVersion + else + let versions = s.Substring 6 // expected # or #.# + let parts = versions.Split('.') + + match parts with + | [| majorPart |] -> + match Int32.TryParse majorPart with + | true, major -> Some (NativeVersion.Major major) + | false, _ -> None + + | [| majorPart; minorPart |] -> + match Int32.TryParse majorPart, Int32.TryParse minorPart with + | (true, major), (true, minor) -> + Some (NativeVersion.MajorMinor (major, minor)) + | _ -> + None + + | _ -> + None let Bind f = (fun _ -> f) let parseWindows tfmStart v = match tfmStart with From 235e52134f4f09ec6acc77ba8d80885e8a1b5056 Mon Sep 17 00:00:00 2001 From: Nicholas Schell Date: Wed, 11 Feb 2026 20:32:56 -0800 Subject: [PATCH 3/8] add NativeVersion as 3rd tuple to Native case change call sites while parsing in FrameworkHandling use NoVersion for all other strings where version was not defined/unknown --- .../Versioning/FrameworkHandling.fs | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Paket.Core/Versioning/FrameworkHandling.fs b/src/Paket.Core/Versioning/FrameworkHandling.fs index 700f908986..189be73eb6 100644 --- a/src/Paket.Core/Versioning/FrameworkHandling.fs +++ b/src/Paket.Core/Versioning/FrameworkHandling.fs @@ -866,7 +866,7 @@ type FrameworkIdentifier = | MonoAndroid of MonoAndroidVersion | MonoTouch | MonoMac - | Native of BuildMode * Platform + | Native of BuildMode * Platform * NativeVersion | XamarinTV | XamarinWatch | XamariniOS @@ -900,8 +900,8 @@ type FrameworkIdentifier = | MonoAndroid v -> "monoandroid" + v.ShortString() | MonoTouch -> "monotouch" | MonoMac -> "monomac" - | Native(BuildMode.NoBuildMode, Platform.NoPlatform) -> "native" - | Native(mode, platform) -> sprintf "native(%s,%s)" mode.AsString platform.AsString + | Native(BuildMode.NoBuildMode, Platform.NoPlatform, _) -> "native" + | Native(mode, platform, _) -> sprintf "native(%s,%s)" mode.AsString platform.AsString | XamarinTV -> "xamarintvos" | XamarinWatch -> "xamarinwatchos" | XamariniOS -> "xamarinios" @@ -1316,15 +1316,15 @@ module FrameworkDetection = | MatchTfm "xamarinwatchos" (allowVersions ["";"1"]) () -> Some XamarinWatch | MatchTfm "xamarintvos" (allowVersions ["";"1"]) () -> Some XamarinTV | MatchTfm "xamarinmac" (allowVersions ["";"1";"2"]) () -> Some XamarinMac - | "native/x86/debug" -> Some(Native(Debug,Win32)) - | "native/x64/debug" -> Some(Native(Debug,X64)) - | "native/arm/debug" -> Some(Native(Debug,Arm)) - | "native/x86/release" -> Some(Native(Release,Win32)) - | "native/x64/release" -> Some(Native(Release,X64)) - | "native/arm/release" -> Some(Native(Release,Arm)) - | "native/address-model-32" -> Some(Native(NoBuildMode,Win32)) - | "native/address-model-64" -> Some(Native(NoBuildMode,X64)) - | "native" -> Some(Native(NoBuildMode,NoPlatform)) + | "native/x86/debug" -> Some(Native(Debug,Win32,NoVersion)) + | "native/x64/debug" -> Some(Native(Debug,X64,NoVersion)) + | "native/arm/debug" -> Some(Native(Debug,Arm,NoVersion)) + | "native/x86/release" -> Some(Native(Release,Win32,NoVersion)) + | "native/x64/release" -> Some(Native(Release,X64,NoVersion)) + | "native/arm/release" -> Some(Native(Release,Arm,NoVersion)) + | "native/address-model-32" -> Some(Native(NoBuildMode,Win32,NoVersion)) + | "native/address-model-64" -> Some(Native(NoBuildMode,X64,NoVersion)) + | MatchNative nv -> Some(Native(NoBuildMode,NoPlatform,nv)) | MatchTfm "sl" SilverlightVersion.TryParse fm -> Some (Silverlight fm) | MatchTfms ["win"; "windows"; "netcore"; "winv"] parseWindows fm -> Some (Windows fm) | "sl4-wp7" | "sl4-wp70" | "sl4-wp7.0" -> Some (WindowsPhone WindowsPhoneVersion.V7) @@ -2018,16 +2018,16 @@ module KnownTargetProfiles = //[SinglePlatform (DNXCore FrameworkVersion.V5_0)] let AllNativeProfiles = - [ Native(NoBuildMode,NoPlatform) - Native(NoBuildMode,Win32) - Native(NoBuildMode,X64) - Native(NoBuildMode,Arm) - Native(Debug,Win32) - Native(Debug,Arm) - Native(Debug,X64) - Native(Release,Win32) - Native(Release,X64) - Native(Release,Arm)] + [ Native(NoBuildMode,NoPlatform,NoVersion) + Native(NoBuildMode,Win32,NoVersion) + Native(NoBuildMode,X64,NoVersion) + Native(NoBuildMode,Arm,NoVersion) + Native(Debug,Win32,NoVersion) + Native(Debug,Arm,NoVersion) + Native(Debug,X64,NoVersion) + Native(Release,Win32,NoVersion) + Native(Release,X64,NoVersion) + Native(Release,Arm,NoVersion)] let isSupportedProfile profile = match profile with From f12aaa9c01118f26ce3a7671b9c628315d4594b6 Mon Sep 17 00:00:00 2001 From: Nicholas Schell Date: Wed, 11 Feb 2026 20:56:07 -0800 Subject: [PATCH 4/8] update Native case constructors with NoVersion so existing usage should be unchanged when matching use discard pattern, so all older usages of Native() should ignore Version --- src/Paket.Core/PaketConfigFiles/InstallModel.fs | 7 +++++-- src/Paket.Core/Versioning/PlatformMatching.fs | 13 ++++++++----- .../Versioning/FrameworkRestrictionTests.fs | 6 +++--- .../Versioning/RestrictionFilterSpecs.fs | 6 +++--- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/Paket.Core/PaketConfigFiles/InstallModel.fs b/src/Paket.Core/PaketConfigFiles/InstallModel.fs index cb4fbc945c..81e09a4d1f 100644 --- a/src/Paket.Core/PaketConfigFiles/InstallModel.fs +++ b/src/Paket.Core/PaketConfigFiles/InstallModel.fs @@ -472,7 +472,10 @@ module InstallModel = // %s because 'native' uses subfolders... (trySscanf "lib/%A{tfm}/%s" p : (Tfm * string) option) |> Option.map (fun (l,path) -> - if l.Name = "native" && l.Platforms = [ FrameworkIdentifier.Native(NoBuildMode,NoPlatform) ] then + if l.Name = "native" && (match l.Platforms with + | [ FrameworkIdentifier.Native(NoBuildMode,NoPlatform,_) ] -> true + | _ -> false) + then // We need some special logic to detect the platform let path = path.ToLowerInvariant() let newPlatform = @@ -486,7 +489,7 @@ module InstallModel = if path.Contains "/release/" then Release else if path.Contains "/debug/" then Debug else NoBuildMode - { Path = { l with Platforms = [ FrameworkIdentifier.Native(newBuildMode,newPlatform) ]}; File = p; Runtime = None } + { Path = { l with Platforms = [ FrameworkIdentifier.Native(newBuildMode,newPlatform,NoVersion) ]}; File = p; Runtime = None } else { Path = l; File = p; Runtime = None }) |> Option.orElseWith (fun _ -> diff --git a/src/Paket.Core/Versioning/PlatformMatching.fs b/src/Paket.Core/Versioning/PlatformMatching.fs index 3dd491677b..ad0ddf5887 100644 --- a/src/Paket.Core/Versioning/PlatformMatching.fs +++ b/src/Paket.Core/Versioning/PlatformMatching.fs @@ -257,9 +257,9 @@ let getTargetCondition (target:TargetProfile) = | XamarinWatch -> "$(TargetFrameworkIdentifier) == 'Xamarin.watchOS'", "" | UAP(version) -> "$(TargetFrameworkIdentifier) == '.NETCore'", sprintf "$(TargetFrameworkVersion) == '%O'" version.NetCoreVersion | XamarinMac -> "$(TargetFrameworkIdentifier) == 'Xamarin.Mac'", "" - | Native(NoBuildMode,NoPlatform) -> "true", "" - | Native(NoBuildMode,bits) -> (sprintf "'$(Platform)'=='%s'" bits.AsString), "" - | Native(profile,bits) -> (sprintf "'$(Configuration)|$(Platform)'=='%s|%s'" profile.AsString bits.AsString), "" + | Native(NoBuildMode,NoPlatform,_) -> "true", "" + | Native(NoBuildMode,bits,_) -> (sprintf "'$(Platform)'=='%s'" bits.AsString), "" + | Native(profile,bits,_) -> (sprintf "'$(Configuration)|$(Platform)'=='%s|%s'" profile.AsString bits.AsString), "" | Tizen version ->"$(TargetFrameworkIdentifier) == 'Tizen'", sprintf "$(TargetFrameworkVersion) == '%O'" version | XCode version ->"$(TargetFrameworkIdentifier) == 'XCode'", sprintf "$(TargetFrameworkVersion) == '%O'" version | Unsupported s -> "", "" @@ -288,12 +288,15 @@ let getCondition (referenceCondition:string option) (targets : TargetProfile Set |> CheckIfFullyInGroupS "WindowsPhone" (function TargetProfile.SinglePlatform (WindowsPhone _) -> true | _ -> false) let conditions = - if targets.Count = 1 && targets |> Set.minElement = TargetProfile.SinglePlatform(Native(NoBuildMode,NoPlatform)) then + if targets.Count = 1 && (match targets |> Set.minElement with + | TargetProfile.SinglePlatform(Native(NoBuildMode,NoPlatform,_)) -> true + | _ -> false) + then targets else targets |> Set.filter (function - | TargetProfile.SinglePlatform(Native(NoBuildMode,NoPlatform)) -> false + | TargetProfile.SinglePlatform(Native(NoBuildMode,NoPlatform,_)) -> false | _ -> true) |> Seq.map getTargetCondition |> Seq.filter (fun (_, v) -> v <> "false") diff --git a/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs b/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs index 1812335c46..1ea145ee0d 100644 --- a/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs +++ b/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs @@ -240,10 +240,10 @@ let ``Simplify <|| (&& (net452) (native)) (native)>`` () = (FrameworkRestriction.Or[ FrameworkRestriction.And[ FrameworkRestriction.Exactly (DotNetFramework FrameworkVersion.V4_5_2) - FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform))] - FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform))]) + FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NoVersion))] + FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NoVersion))]) toSimplify - |> shouldEqual (FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform))) + |> shouldEqual (FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NoVersion))) [] let ``Simplify (>=net20) && (>=net20)``() = diff --git a/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs b/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs index af2bbefc76..91b22bae35 100644 --- a/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs +++ b/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs @@ -116,8 +116,8 @@ let ``should filter >= net20 < net40 and >= net40``() = [] let ``should not filter native, net452``() = - let l1 = ExplicitRestriction (FrameworkRestriction.Or [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5_2)); FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform))]) - let l2 = ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform))) + let l1 = ExplicitRestriction (FrameworkRestriction.Or [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5_2)); FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NoVersion))]) + let l2 = ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NoVersion))) filterRestrictions l1 l2 - |> shouldEqual (ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform)))) + |> shouldEqual (ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NoVersion)))) From 6b042ff7b4ac9d99f0afe762b2d4dde0d30f5460 Mon Sep 17 00:00:00 2001 From: Nicholas Schell Date: Wed, 11 Feb 2026 20:56:27 -0800 Subject: [PATCH 5/8] include native{version} description in markdown documentation --- docs/content/dependencies-file.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/dependencies-file.md b/docs/content/dependencies-file.md index 832d749273..a0a3690743 100644 --- a/docs/content/dependencies-file.md +++ b/docs/content/dependencies-file.md @@ -147,7 +147,7 @@ The supported framework identifiers include: * Mono for Android: `monoandroid{version}` * Mono for Mac: `monomac` * MonoTouch: `monotouch` -* Native: `native` or `native({buildmode},{platform})` +* Native: `native` or `native({buildmode},{platform})` or `native{version}` * Xamarin for Mac: `xamarinmac` * Xamarin for iOS: `xamarinios` * Xamarin for watchOS: `xamarinwatchos` From ed7dc103d9c081026f3e651c579883d6df2423aa Mon Sep 17 00:00:00 2001 From: Nicholas Schell Date: Wed, 11 Feb 2026 21:52:32 -0800 Subject: [PATCH 6/8] require explicit usage of NativeVersion --- .../PaketConfigFiles/InstallModel.fs | 2 +- .../Versioning/FrameworkHandling.fs | 37 ++++++++++--------- .../Versioning/FrameworkRestrictionTests.fs | 6 +-- .../Versioning/RestrictionFilterSpecs.fs | 6 +-- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/Paket.Core/PaketConfigFiles/InstallModel.fs b/src/Paket.Core/PaketConfigFiles/InstallModel.fs index 81e09a4d1f..49b264c2d4 100644 --- a/src/Paket.Core/PaketConfigFiles/InstallModel.fs +++ b/src/Paket.Core/PaketConfigFiles/InstallModel.fs @@ -489,7 +489,7 @@ module InstallModel = if path.Contains "/release/" then Release else if path.Contains "/debug/" then Debug else NoBuildMode - { Path = { l with Platforms = [ FrameworkIdentifier.Native(newBuildMode,newPlatform,NoVersion) ]}; File = p; Runtime = None } + { Path = { l with Platforms = [ FrameworkIdentifier.Native(newBuildMode,newPlatform,NativeVersion.NoVersion) ]}; File = p; Runtime = None } else { Path = l; File = p; Runtime = None }) |> Option.orElseWith (fun _ -> diff --git a/src/Paket.Core/Versioning/FrameworkHandling.fs b/src/Paket.Core/Versioning/FrameworkHandling.fs index 189be73eb6..64a2405c66 100644 --- a/src/Paket.Core/Versioning/FrameworkHandling.fs +++ b/src/Paket.Core/Versioning/FrameworkHandling.fs @@ -545,6 +545,7 @@ type DotNetCoreAppVersion = | _ when s = "3.1" -> Some DotNetCoreAppVersion.V3_1 | _ -> None +[] type NativeVersion = | NoVersion | Major of major:int @@ -1316,14 +1317,14 @@ module FrameworkDetection = | MatchTfm "xamarinwatchos" (allowVersions ["";"1"]) () -> Some XamarinWatch | MatchTfm "xamarintvos" (allowVersions ["";"1"]) () -> Some XamarinTV | MatchTfm "xamarinmac" (allowVersions ["";"1";"2"]) () -> Some XamarinMac - | "native/x86/debug" -> Some(Native(Debug,Win32,NoVersion)) - | "native/x64/debug" -> Some(Native(Debug,X64,NoVersion)) - | "native/arm/debug" -> Some(Native(Debug,Arm,NoVersion)) - | "native/x86/release" -> Some(Native(Release,Win32,NoVersion)) - | "native/x64/release" -> Some(Native(Release,X64,NoVersion)) - | "native/arm/release" -> Some(Native(Release,Arm,NoVersion)) - | "native/address-model-32" -> Some(Native(NoBuildMode,Win32,NoVersion)) - | "native/address-model-64" -> Some(Native(NoBuildMode,X64,NoVersion)) + | "native/x86/debug" -> Some(Native(Debug,Win32,NativeVersion.NoVersion)) + | "native/x64/debug" -> Some(Native(Debug,X64,NativeVersion.NoVersion)) + | "native/arm/debug" -> Some(Native(Debug,Arm,NativeVersion.NoVersion)) + | "native/x86/release" -> Some(Native(Release,Win32,NativeVersion.NoVersion)) + | "native/x64/release" -> Some(Native(Release,X64,NativeVersion.NoVersion)) + | "native/arm/release" -> Some(Native(Release,Arm,NativeVersion.NoVersion)) + | "native/address-model-32" -> Some(Native(NoBuildMode,Win32,NativeVersion.NoVersion)) + | "native/address-model-64" -> Some(Native(NoBuildMode,X64,NativeVersion.NoVersion)) | MatchNative nv -> Some(Native(NoBuildMode,NoPlatform,nv)) | MatchTfm "sl" SilverlightVersion.TryParse fm -> Some (Silverlight fm) | MatchTfms ["win"; "windows"; "netcore"; "winv"] parseWindows fm -> Some (Windows fm) @@ -2018,16 +2019,16 @@ module KnownTargetProfiles = //[SinglePlatform (DNXCore FrameworkVersion.V5_0)] let AllNativeProfiles = - [ Native(NoBuildMode,NoPlatform,NoVersion) - Native(NoBuildMode,Win32,NoVersion) - Native(NoBuildMode,X64,NoVersion) - Native(NoBuildMode,Arm,NoVersion) - Native(Debug,Win32,NoVersion) - Native(Debug,Arm,NoVersion) - Native(Debug,X64,NoVersion) - Native(Release,Win32,NoVersion) - Native(Release,X64,NoVersion) - Native(Release,Arm,NoVersion)] + [ Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion) + Native(NoBuildMode,Win32,NativeVersion.NoVersion) + Native(NoBuildMode,X64,NativeVersion.NoVersion) + Native(NoBuildMode,Arm,NativeVersion.NoVersion) + Native(Debug,Win32,NativeVersion.NoVersion) + Native(Debug,Arm,NativeVersion.NoVersion) + Native(Debug,X64,NativeVersion.NoVersion) + Native(Release,Win32,NativeVersion.NoVersion) + Native(Release,X64,NativeVersion.NoVersion) + Native(Release,Arm,NativeVersion.NoVersion)] let isSupportedProfile profile = match profile with diff --git a/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs b/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs index 1ea145ee0d..d51d16f4aa 100644 --- a/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs +++ b/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs @@ -240,10 +240,10 @@ let ``Simplify <|| (&& (net452) (native)) (native)>`` () = (FrameworkRestriction.Or[ FrameworkRestriction.And[ FrameworkRestriction.Exactly (DotNetFramework FrameworkVersion.V4_5_2) - FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NoVersion))] - FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NoVersion))]) + FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion))] + FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion))]) toSimplify - |> shouldEqual (FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NoVersion))) + |> shouldEqual (FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion))) [] let ``Simplify (>=net20) && (>=net20)``() = diff --git a/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs b/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs index 91b22bae35..a793395a03 100644 --- a/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs +++ b/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs @@ -116,8 +116,8 @@ let ``should filter >= net20 < net40 and >= net40``() = [] let ``should not filter native, net452``() = - let l1 = ExplicitRestriction (FrameworkRestriction.Or [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5_2)); FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NoVersion))]) - let l2 = ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NoVersion))) + let l1 = ExplicitRestriction (FrameworkRestriction.Or [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5_2)); FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion))]) + let l2 = ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion))) filterRestrictions l1 l2 - |> shouldEqual (ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NoVersion)))) + |> shouldEqual (ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion)))) From ae9e250981d0562d82ff37849ef9554b5b407e05 Mon Sep 17 00:00:00 2001 From: Nicholas Schell Date: Wed, 11 Feb 2026 21:59:14 -0800 Subject: [PATCH 7/8] change NoVersion -> None more concise --- .../PaketConfigFiles/InstallModel.fs | 2 +- .../Versioning/FrameworkHandling.fs | 40 +++++++++---------- .../Versioning/FrameworkRestrictionTests.fs | 6 +-- .../Versioning/RestrictionFilterSpecs.fs | 6 +-- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Paket.Core/PaketConfigFiles/InstallModel.fs b/src/Paket.Core/PaketConfigFiles/InstallModel.fs index 49b264c2d4..212d6a3480 100644 --- a/src/Paket.Core/PaketConfigFiles/InstallModel.fs +++ b/src/Paket.Core/PaketConfigFiles/InstallModel.fs @@ -489,7 +489,7 @@ module InstallModel = if path.Contains "/release/" then Release else if path.Contains "/debug/" then Debug else NoBuildMode - { Path = { l with Platforms = [ FrameworkIdentifier.Native(newBuildMode,newPlatform,NativeVersion.NoVersion) ]}; File = p; Runtime = None } + { Path = { l with Platforms = [ FrameworkIdentifier.Native(newBuildMode,newPlatform,NativeVersion.None) ]}; File = p; Runtime = None } else { Path = l; File = p; Runtime = None }) |> Option.orElseWith (fun _ -> diff --git a/src/Paket.Core/Versioning/FrameworkHandling.fs b/src/Paket.Core/Versioning/FrameworkHandling.fs index 64a2405c66..68d6613c62 100644 --- a/src/Paket.Core/Versioning/FrameworkHandling.fs +++ b/src/Paket.Core/Versioning/FrameworkHandling.fs @@ -547,7 +547,7 @@ type DotNetCoreAppVersion = [] type NativeVersion = - | NoVersion + | None | Major of major:int | MajorMinor of major:int * minor:int @@ -1247,7 +1247,7 @@ module FrameworkDetection = if not (s.StartsWith("native")) then None elif s.Length = 6 then - Some NativeVersion.NoVersion + Some NativeVersion.None else let versions = s.Substring 6 // expected # or #.# let parts = versions.Split('.') @@ -1317,14 +1317,14 @@ module FrameworkDetection = | MatchTfm "xamarinwatchos" (allowVersions ["";"1"]) () -> Some XamarinWatch | MatchTfm "xamarintvos" (allowVersions ["";"1"]) () -> Some XamarinTV | MatchTfm "xamarinmac" (allowVersions ["";"1";"2"]) () -> Some XamarinMac - | "native/x86/debug" -> Some(Native(Debug,Win32,NativeVersion.NoVersion)) - | "native/x64/debug" -> Some(Native(Debug,X64,NativeVersion.NoVersion)) - | "native/arm/debug" -> Some(Native(Debug,Arm,NativeVersion.NoVersion)) - | "native/x86/release" -> Some(Native(Release,Win32,NativeVersion.NoVersion)) - | "native/x64/release" -> Some(Native(Release,X64,NativeVersion.NoVersion)) - | "native/arm/release" -> Some(Native(Release,Arm,NativeVersion.NoVersion)) - | "native/address-model-32" -> Some(Native(NoBuildMode,Win32,NativeVersion.NoVersion)) - | "native/address-model-64" -> Some(Native(NoBuildMode,X64,NativeVersion.NoVersion)) + | "native/x86/debug" -> Some(Native(Debug,Win32,NativeVersion.None)) + | "native/x64/debug" -> Some(Native(Debug,X64,NativeVersion.None)) + | "native/arm/debug" -> Some(Native(Debug,Arm,NativeVersion.None)) + | "native/x86/release" -> Some(Native(Release,Win32,NativeVersion.None)) + | "native/x64/release" -> Some(Native(Release,X64,NativeVersion.None)) + | "native/arm/release" -> Some(Native(Release,Arm,NativeVersion.None)) + | "native/address-model-32" -> Some(Native(NoBuildMode,Win32,NativeVersion.None)) + | "native/address-model-64" -> Some(Native(NoBuildMode,X64,NativeVersion.None)) | MatchNative nv -> Some(Native(NoBuildMode,NoPlatform,nv)) | MatchTfm "sl" SilverlightVersion.TryParse fm -> Some (Silverlight fm) | MatchTfms ["win"; "windows"; "netcore"; "winv"] parseWindows fm -> Some (Windows fm) @@ -2019,16 +2019,16 @@ module KnownTargetProfiles = //[SinglePlatform (DNXCore FrameworkVersion.V5_0)] let AllNativeProfiles = - [ Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion) - Native(NoBuildMode,Win32,NativeVersion.NoVersion) - Native(NoBuildMode,X64,NativeVersion.NoVersion) - Native(NoBuildMode,Arm,NativeVersion.NoVersion) - Native(Debug,Win32,NativeVersion.NoVersion) - Native(Debug,Arm,NativeVersion.NoVersion) - Native(Debug,X64,NativeVersion.NoVersion) - Native(Release,Win32,NativeVersion.NoVersion) - Native(Release,X64,NativeVersion.NoVersion) - Native(Release,Arm,NativeVersion.NoVersion)] + [ Native(NoBuildMode,NoPlatform,NativeVersion.None) + Native(NoBuildMode,Win32,NativeVersion.None) + Native(NoBuildMode,X64,NativeVersion.None) + Native(NoBuildMode,Arm,NativeVersion.None) + Native(Debug,Win32,NativeVersion.None) + Native(Debug,Arm,NativeVersion.None) + Native(Debug,X64,NativeVersion.None) + Native(Release,Win32,NativeVersion.None) + Native(Release,X64,NativeVersion.None) + Native(Release,Arm,NativeVersion.None)] let isSupportedProfile profile = match profile with diff --git a/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs b/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs index d51d16f4aa..9069be8b61 100644 --- a/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs +++ b/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs @@ -240,10 +240,10 @@ let ``Simplify <|| (&& (net452) (native)) (native)>`` () = (FrameworkRestriction.Or[ FrameworkRestriction.And[ FrameworkRestriction.Exactly (DotNetFramework FrameworkVersion.V4_5_2) - FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion))] - FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion))]) + FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.None))] + FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.None))]) toSimplify - |> shouldEqual (FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion))) + |> shouldEqual (FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.None))) [] let ``Simplify (>=net20) && (>=net20)``() = diff --git a/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs b/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs index a793395a03..31ecc699ff 100644 --- a/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs +++ b/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs @@ -116,8 +116,8 @@ let ``should filter >= net20 < net40 and >= net40``() = [] let ``should not filter native, net452``() = - let l1 = ExplicitRestriction (FrameworkRestriction.Or [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5_2)); FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion))]) - let l2 = ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion))) + let l1 = ExplicitRestriction (FrameworkRestriction.Or [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5_2)); FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.None))]) + let l2 = ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.None))) filterRestrictions l1 l2 - |> shouldEqual (ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.NoVersion)))) + |> shouldEqual (ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.None)))) From 55147afb8aa319a5a228e6172c3fb309ceb7d720 Mon Sep 17 00:00:00 2001 From: Nicholas Schell Date: Sat, 14 Feb 2026 03:55:13 -0800 Subject: [PATCH 8/8] switch default case name to NoVersion fits better with BuildMode.NoBuildMode and Platform.NoPlatform i think --- .../PaketConfigFiles/InstallModel.fs | 3 +- .../Versioning/FrameworkHandling.fs | 41 +++++++++---------- .../Versioning/FrameworkRestrictionTests.fs | 6 +-- .../Versioning/RestrictionFilterSpecs.fs | 6 +-- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Paket.Core/PaketConfigFiles/InstallModel.fs b/src/Paket.Core/PaketConfigFiles/InstallModel.fs index 212d6a3480..aca141c6e2 100644 --- a/src/Paket.Core/PaketConfigFiles/InstallModel.fs +++ b/src/Paket.Core/PaketConfigFiles/InstallModel.fs @@ -489,7 +489,8 @@ module InstallModel = if path.Contains "/release/" then Release else if path.Contains "/debug/" then Debug else NoBuildMode - { Path = { l with Platforms = [ FrameworkIdentifier.Native(newBuildMode,newPlatform,NativeVersion.None) ]}; File = p; Runtime = None } + let newVersion = NoVersion + { Path = { l with Platforms = [ FrameworkIdentifier.Native(newBuildMode,newPlatform,newVersion) ]}; File = p; Runtime = None } else { Path = l; File = p; Runtime = None }) |> Option.orElseWith (fun _ -> diff --git a/src/Paket.Core/Versioning/FrameworkHandling.fs b/src/Paket.Core/Versioning/FrameworkHandling.fs index 68d6613c62..189be73eb6 100644 --- a/src/Paket.Core/Versioning/FrameworkHandling.fs +++ b/src/Paket.Core/Versioning/FrameworkHandling.fs @@ -545,9 +545,8 @@ type DotNetCoreAppVersion = | _ when s = "3.1" -> Some DotNetCoreAppVersion.V3_1 | _ -> None -[] type NativeVersion = - | None + | NoVersion | Major of major:int | MajorMinor of major:int * minor:int @@ -1247,7 +1246,7 @@ module FrameworkDetection = if not (s.StartsWith("native")) then None elif s.Length = 6 then - Some NativeVersion.None + Some NativeVersion.NoVersion else let versions = s.Substring 6 // expected # or #.# let parts = versions.Split('.') @@ -1317,14 +1316,14 @@ module FrameworkDetection = | MatchTfm "xamarinwatchos" (allowVersions ["";"1"]) () -> Some XamarinWatch | MatchTfm "xamarintvos" (allowVersions ["";"1"]) () -> Some XamarinTV | MatchTfm "xamarinmac" (allowVersions ["";"1";"2"]) () -> Some XamarinMac - | "native/x86/debug" -> Some(Native(Debug,Win32,NativeVersion.None)) - | "native/x64/debug" -> Some(Native(Debug,X64,NativeVersion.None)) - | "native/arm/debug" -> Some(Native(Debug,Arm,NativeVersion.None)) - | "native/x86/release" -> Some(Native(Release,Win32,NativeVersion.None)) - | "native/x64/release" -> Some(Native(Release,X64,NativeVersion.None)) - | "native/arm/release" -> Some(Native(Release,Arm,NativeVersion.None)) - | "native/address-model-32" -> Some(Native(NoBuildMode,Win32,NativeVersion.None)) - | "native/address-model-64" -> Some(Native(NoBuildMode,X64,NativeVersion.None)) + | "native/x86/debug" -> Some(Native(Debug,Win32,NoVersion)) + | "native/x64/debug" -> Some(Native(Debug,X64,NoVersion)) + | "native/arm/debug" -> Some(Native(Debug,Arm,NoVersion)) + | "native/x86/release" -> Some(Native(Release,Win32,NoVersion)) + | "native/x64/release" -> Some(Native(Release,X64,NoVersion)) + | "native/arm/release" -> Some(Native(Release,Arm,NoVersion)) + | "native/address-model-32" -> Some(Native(NoBuildMode,Win32,NoVersion)) + | "native/address-model-64" -> Some(Native(NoBuildMode,X64,NoVersion)) | MatchNative nv -> Some(Native(NoBuildMode,NoPlatform,nv)) | MatchTfm "sl" SilverlightVersion.TryParse fm -> Some (Silverlight fm) | MatchTfms ["win"; "windows"; "netcore"; "winv"] parseWindows fm -> Some (Windows fm) @@ -2019,16 +2018,16 @@ module KnownTargetProfiles = //[SinglePlatform (DNXCore FrameworkVersion.V5_0)] let AllNativeProfiles = - [ Native(NoBuildMode,NoPlatform,NativeVersion.None) - Native(NoBuildMode,Win32,NativeVersion.None) - Native(NoBuildMode,X64,NativeVersion.None) - Native(NoBuildMode,Arm,NativeVersion.None) - Native(Debug,Win32,NativeVersion.None) - Native(Debug,Arm,NativeVersion.None) - Native(Debug,X64,NativeVersion.None) - Native(Release,Win32,NativeVersion.None) - Native(Release,X64,NativeVersion.None) - Native(Release,Arm,NativeVersion.None)] + [ Native(NoBuildMode,NoPlatform,NoVersion) + Native(NoBuildMode,Win32,NoVersion) + Native(NoBuildMode,X64,NoVersion) + Native(NoBuildMode,Arm,NoVersion) + Native(Debug,Win32,NoVersion) + Native(Debug,Arm,NoVersion) + Native(Debug,X64,NoVersion) + Native(Release,Win32,NoVersion) + Native(Release,X64,NoVersion) + Native(Release,Arm,NoVersion)] let isSupportedProfile profile = match profile with diff --git a/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs b/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs index 9069be8b61..1ea145ee0d 100644 --- a/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs +++ b/tests/Paket.Tests/Versioning/FrameworkRestrictionTests.fs @@ -240,10 +240,10 @@ let ``Simplify <|| (&& (net452) (native)) (native)>`` () = (FrameworkRestriction.Or[ FrameworkRestriction.And[ FrameworkRestriction.Exactly (DotNetFramework FrameworkVersion.V4_5_2) - FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.None))] - FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.None))]) + FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NoVersion))] + FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NoVersion))]) toSimplify - |> shouldEqual (FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NativeVersion.None))) + |> shouldEqual (FrameworkRestriction.Exactly (Native(NoBuildMode,NoPlatform,NoVersion))) [] let ``Simplify (>=net20) && (>=net20)``() = diff --git a/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs b/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs index 31ecc699ff..91b22bae35 100644 --- a/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs +++ b/tests/Paket.Tests/Versioning/RestrictionFilterSpecs.fs @@ -116,8 +116,8 @@ let ``should filter >= net20 < net40 and >= net40``() = [] let ``should not filter native, net452``() = - let l1 = ExplicitRestriction (FrameworkRestriction.Or [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5_2)); FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.None))]) - let l2 = ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.None))) + let l1 = ExplicitRestriction (FrameworkRestriction.Or [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5_2)); FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NoVersion))]) + let l2 = ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NoVersion))) filterRestrictions l1 l2 - |> shouldEqual (ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NativeVersion.None)))) + |> shouldEqual (ExplicitRestriction (FrameworkRestriction.Exactly(Native(NoBuildMode,NoPlatform,NoVersion))))