Skip to content

Commit f716393

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 f716393

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

scripts/configure.fsx

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@ 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+
Console.WriteLine "(too old)"
44+
None
45+
else
46+
anyDotnetCmd
3247

3348
match Misc.GuessPlatform() with
3449
| Misc.Platform.Windows ->
@@ -42,29 +57,29 @@ let buildTool, legacyBuildTool, areGtkLibsAbsentOrDoesNotApply =
4257
Console.WriteLine "found"
4358
Some msbuildPath
4459

45-
dotnetCmd, msbuildCmd, true
60+
dotnet8Cmd, msbuildCmd, true
4661
| platform (* Unix *) ->
4762
Process.ConfigCommandCheck ["make"] true true |> ignore
4863

4964
match Process.ConfigCommandCheck ["mono"] false true with
5065
| None ->
51-
dotnetCmd, None, true
66+
dotnet8Cmd, None, true
5267
| Some _ ->
5368

5469
match Process.ConfigCommandCheck ["fsharpc"] false true with
5570
| None ->
56-
dotnetCmd, None, true
71+
dotnet8Cmd, None, true
5772
| Some _ ->
5873

5974
if platform = Misc.Platform.Mac then
6075
let msBuildOrXBuild = Process.ConfigCommandCheck [ "msbuild"; "xbuild" ] false true
61-
dotnetCmd, msBuildOrXBuild, true
76+
dotnet8Cmd, msBuildOrXBuild, true
6277
else
6378

6479
let pkgConfig = "pkg-config"
6580

6681
match Process.ConfigCommandCheck [ pkgConfig ] false true with
67-
| None -> dotnetCmd, None, true
82+
| None -> dotnet8Cmd, None, true
6883
| Some _ ->
6984

7085
// yes, msbuild tests for the existence of this file path below (a folder named xbuild, not msbuild),
@@ -109,12 +124,12 @@ let buildTool, legacyBuildTool, areGtkLibsAbsentOrDoesNotApply =
109124
// NOTE: see what 1 means here: https://learn.microsoft.com/en-us/dotnet/api/system.version.compareto?view=netframework-4.7
110125
if 1 = stableVersionOfMono.CompareTo currentMonoVersion then
111126
Console.WriteLine "not found"
112-
dotnetCmd, None, true
127+
dotnet8Cmd, None, true
113128
else
114129
Console.WriteLine "found"
115130

116131
let areGtkLibsAbsentOrDoesNotApply =
117-
match dotnetCmd, maybeMsbuild, maybeXbuild with
132+
match dotnet8Cmd, maybeMsbuild, maybeXbuild with
118133
| None, None, None ->
119134
// well, configure.fsx will not finish in this case anyway
120135
true
@@ -141,7 +156,7 @@ let buildTool, legacyBuildTool, areGtkLibsAbsentOrDoesNotApply =
141156
else
142157
maybeXbuild
143158

144-
dotnetCmd, legacyBuildTool, areGtkLibsAbsentOrDoesNotApply
159+
dotnet8Cmd, legacyBuildTool, areGtkLibsAbsentOrDoesNotApply
145160

146161
if buildTool.IsNone && legacyBuildTool.IsNone then
147162
Console.Out.Flush()

0 commit comments

Comments
 (0)