Skip to content

Commit 2d7b062

Browse files
committed
scripts/configure.fsx: require dotnet v8
Now that .NETv10 (which is an LTS) has just been released, we can already consider v6 too old (if not, use the stable branch, see [1]), and treat v8 as the oldest version we can still support. [1] #307
1 parent 0b3031f commit 2d7b062

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

scripts/configure.fsx

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,24 @@ if argsToThisFsxScript.Any(fun arg -> arg = "--from-configure") then
2525

2626
let rootDir = DirectoryInfo(Path.Combine(__SOURCE_DIRECTORY__, ".."))
2727
let stableVersionOfMono = Version("6.6")
28+
let stableVersionOfDotNet = Version "8.0"
2829

2930
let buildTool, legacyBuildTool, areGtkLibsAbsentOrDoesNotApply =
3031

31-
let dotnetCmd = Process.ConfigCommandCheck ["dotnet"] false true
32+
let anyDotnetCmd = Process.ConfigCommandCheck ["dotnet"] false true
33+
let dotnet8Cmd =
34+
match anyDotnetCmd with
35+
| None -> None
36+
| Some _ ->
37+
let currentDotNetVersion =
38+
Process.Execute({ Command = "dotnet"; Arguments = "--version" }, Echo.Off).UnwrapDefault().Trim()
39+
|> Version
40+
41+
// NOTE: see what 1 means here: https://learn.microsoft.com/en-us/dotnet/api/system.version.compareto?view=netframework-4.7
42+
if 1 = stableVersionOfDotNet.CompareTo currentDotNetVersion then
43+
None
44+
else
45+
anyDotnetCmd
3246

3347
match Misc.GuessPlatform() with
3448
| Misc.Platform.Windows ->
@@ -42,29 +56,29 @@ let buildTool, legacyBuildTool, areGtkLibsAbsentOrDoesNotApply =
4256
Console.WriteLine "found"
4357
Some msbuildPath
4458

45-
dotnetCmd, msbuildCmd, true
59+
dotnet8Cmd, msbuildCmd, true
4660
| platform (* Unix *) ->
4761
Process.ConfigCommandCheck ["make"] true true |> ignore
4862

4963
match Process.ConfigCommandCheck ["mono"] false true with
5064
| None ->
51-
dotnetCmd, None, true
65+
dotnet8Cmd, None, true
5266
| Some _ ->
5367

5468
match Process.ConfigCommandCheck ["fsharpc"] false true with
5569
| None ->
56-
dotnetCmd, None, true
70+
dotnet8Cmd, None, true
5771
| Some _ ->
5872

5973
if platform = Misc.Platform.Mac then
6074
let msBuildOrXBuild = Process.ConfigCommandCheck [ "msbuild"; "xbuild" ] false true
61-
dotnetCmd, msBuildOrXBuild, true
75+
dotnet8Cmd, msBuildOrXBuild, true
6276
else
6377

6478
let pkgConfig = "pkg-config"
6579

6680
match Process.ConfigCommandCheck [ pkgConfig ] false true with
67-
| None -> dotnetCmd, None, true
81+
| None -> dotnet8Cmd, None, true
6882
| Some _ ->
6983

7084
// yes, msbuild tests for the existence of this file path below (a folder named xbuild, not msbuild),
@@ -109,12 +123,12 @@ let buildTool, legacyBuildTool, areGtkLibsAbsentOrDoesNotApply =
109123
// NOTE: see what 1 means here: https://learn.microsoft.com/en-us/dotnet/api/system.version.compareto?view=netframework-4.7
110124
if 1 = stableVersionOfMono.CompareTo currentMonoVersion then
111125
Console.WriteLine "not found"
112-
dotnetCmd, None, true
126+
dotnet8Cmd, None, true
113127
else
114128
Console.WriteLine "found"
115129

116130
let areGtkLibsAbsentOrDoesNotApply =
117-
match dotnetCmd, maybeMsbuild, maybeXbuild with
131+
match dotnet8Cmd, maybeMsbuild, maybeXbuild with
118132
| None, None, None ->
119133
// well, configure.fsx will not finish in this case anyway
120134
true
@@ -141,19 +155,24 @@ let buildTool, legacyBuildTool, areGtkLibsAbsentOrDoesNotApply =
141155
else
142156
maybeXbuild
143157

144-
dotnetCmd, legacyBuildTool, areGtkLibsAbsentOrDoesNotApply
158+
dotnet8Cmd, legacyBuildTool, areGtkLibsAbsentOrDoesNotApply
145159

146160
if buildTool.IsNone && legacyBuildTool.IsNone then
147161
Console.Out.Flush()
148162
Console.Error.WriteLine "configure: error, package requirements not met:"
149163

150164
match Misc.GuessPlatform() with
151165
| Misc.Platform.Windows ->
152-
Console.Error.WriteLine "Please install 'dotnet' aka .NET (6.0 or newer), and/or .NETFramework 4.x ('msbuild')"
166+
Console.Error.WriteLine (
167+
sprintf
168+
"Please install 'dotnet' aka .NET (v%s or newer), and/or .NETFramework 4.x ('msbuild')"
169+
(stableVersionOfDotNet.ToString())
170+
)
153171
| _ ->
154172
Console.Error.WriteLine (
155173
sprintf
156-
"Please install dotnet v6 (or newer), and/or Mono (msbuild or xbuild needed) v%s (or newer)"
174+
"Please install dotnet v%s (or newer), and/or Mono (msbuild or xbuild needed) v%s (or newer)"
175+
(stableVersionOfDotNet.ToString())
157176
(stableVersionOfMono.ToString())
158177
)
159178

0 commit comments

Comments
 (0)