Skip to content

Commit 82b092c

Browse files
authored
Update project to support .NET 10 and upgrade dependencies (#1429)
* Update project to support .NET 10 and upgrade dependencies - Updated paket version to 10.0.0-alpha011 in dotnet-tools.json. - Modified GitHub workflows to include .NET 10 builds and tests. - Updated project files to target .NET 10 alongside .NET 8 and 9. - Upgraded FSharp.Compiler.Service and related dependencies to compatible versions. - Removed deprecated LetOrUseBang pattern matching in various files. - Enhanced code generation utilities to accommodate new patterns and attributes. * Refactor parser options and command handling - Updated the AdaptiveServerState.fs to use `let!` instead of `and!` for better readability. - Refactored the Parser.fs to streamline option creation by removing redundant arity setting functions and using a more concise approach. - Changed the way options are added to the root command, improving clarity and consistency. - Simplified the command handling logic by breaking it into smaller functions for better maintainability. - Updated the Parser.fsi to reflect the new `invoke` function signature. - Modified Program.fs to call the new `invoke` function instead of the old parser. - Adjusted test helper to ensure timeout values are correctly converted to float. * Fix tests * Remove unused state directory option from root command action * Fix formatting of type annotations in test cases * Update project file to support multiple target frameworks for .NET 9 and 10 * Remove conditional target frameworks for .NET 9 and 10 from test project file * Revert SDK version and rollForward settings in global.json to previous configuration * Refactor build pipeline to use toolRestore stage and add tests for .NET 8, 9, and 10 * Update Ionide.Analyzers to version 0.14.10 in paket.dependencies and paket.lock
1 parent ab021c3 commit 82b092c

26 files changed

+1038
-945
lines changed

.config/dotnet-tools.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"paket": {
6-
"version": "9.0.2",
6+
"version": "10.0.0-alpha011",
77
"commands": [
88
"paket"
99
],
@@ -38,4 +38,4 @@
3838
"rollForward": false
3939
}
4040
}
41-
}
41+
}

.github/workflows/build.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- windows-latest
2828
- macos-15
2929
- ubuntu-latest
30-
dotnet-version: ["8.0.x", "9.0.x"]
30+
dotnet-version: ["8.x", "9.x", "10.x"]
3131
use-transparent-compiler:
3232
- "TransparentCompiler"
3333
- "BackgroundCompiler"
@@ -38,18 +38,28 @@ jobs:
3838
include:
3939
# latest 8.0
4040
- global-json-file: "global.json"
41-
dotnet-version: "8.0.x"
41+
dotnet-version: "8.x"
4242
include-prerelease: false
4343
label: "8.0"
4444
build_net9: false
45+
build_net10: false
4546
test_tfm: net8.0
4647
# latest 9.0
4748
- global-json-file: "global.json"
48-
dotnet-version: "9.0.x"
49+
dotnet-version: "9.x"
4950
include-prerelease: true
5051
label: "9.0"
5152
build_net9: true
53+
build_net10: false
5254
test_tfm: net9.0
55+
# latest 10.0
56+
- global-json-file: "global.json"
57+
dotnet-version: "10.x"
58+
include-prerelease: true
59+
label: "10.0"
60+
build_net9: false
61+
build_net10: true
62+
test_tfm: net10.0
5363
fail-fast: false # we have timing issues on some OS, so we want them all to run
5464

5565
runs-on: ${{ matrix.os }}
@@ -98,12 +108,14 @@ jobs:
98108
run: dotnet build -c Release
99109
env:
100110
BuildNet9: ${{ matrix.build_net9 }}
111+
BuildNet10: ${{ matrix.build_net10 }}
101112

102113
- name: Run and report tests
103114
run: dotnet test -c Release -f ${{ matrix.test_tfm }} --no-restore --no-build --logger "console;verbosity=normal" --logger GitHubActions /p:AltCover=true /p:AltCoverAssemblyExcludeFilter="System.Reactive|FSharp.Compiler.Service|Ionide.ProjInfo|FSharp.Analyzers|Analyzer|Humanizer|FSharp.Core|FSharp.DependencyManager" -- Expecto.fail-on-focused-tests=true --blame-hang --blame-hang-timeout 1m
104115
working-directory: test/FsAutoComplete.Tests.Lsp
105116
env:
106117
BuildNet9: ${{ matrix.build_net9 }}
118+
BuildNet10: ${{ matrix.build_net10 }}
107119
USE_TRANSPARENT_COMPILER: ${{ matrix.use-transparent-compiler }}
108120
USE_WORKSPACE_LOADER: ${{ matrix.workspace-loader }}
109121

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ jobs:
2323
uses: actions/setup-dotnet@v4
2424
with:
2525
dotnet-version: |
26-
8.0.x
27-
9.0.x
26+
8.x
27+
9.x
28+
10.x
2829
2930
- name: Restore tools
3031
run: dotnet tool restore
@@ -33,6 +34,7 @@ jobs:
3334
run: dotnet pack -c Release -o ./bin
3435
env:
3536
BuildNet9: true
37+
BuildNet10: true
3638

3739
- name: Get Changelog Entry
3840
id: changelog_reader

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
variables,https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-options#opt-in-warnings -->
1313
<NoWarn>$(NoWarn);FS0044</NoWarn> <!-- Ignore deprecations -->
1414
<NoWarn>$(NoWarn);FS3397</NoWarn> <!-- This expression uses unit for an obj-typed argument. This will lead to passing null at runtime -->
15+
<NoWarn>$(NoWarn);NU1510</NoWarn> <!-- PackageReference will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary -->
1516
<WarnOn>$(WarnOn);3390</WarnOn><!-- Malformed XML doc comments -->
1617

1718
<!-- Package Reference with no usable assets -->

benchmarks/benchmarks.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<OutputType>Exe</OutputType>
55
<TargetFrameworks>net8.0</TargetFrameworks>
66
<TargetFrameworks Condition="'$(BuildNet9)' == 'true'">net8.0;net9.0</TargetFrameworks>
7+
<TargetFrameworks Condition="'$(BuildNet10)' == 'true'">net8.0;net9.0;net10.0</TargetFrameworks>
78
</PropertyGroup>
89
<ItemGroup>
910
<Compile Include="SourceTextBenchmarks.fs" />

build.fsx

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
open Fun.Build
77
open Fake.Tools
88

9+
let toolRestore = stage "ToolRestore" { run "dotnet tool restore" }
10+
911
module ScaffoldCodeFix =
1012
open System
1113
open System.IO
@@ -424,11 +426,61 @@ pipeline "Build" {
424426
workingDir __SOURCE_DIRECTORY__
425427

426428
stage "Build" {
427-
run "dotnet tool restore"
429+
toolRestore
428430
run "dotnet build"
429431
}
430432

431-
runIfOnlySpecified false
433+
// runIfOnlySpecified false
434+
}
435+
436+
437+
let (</>) a b = System.IO.Path.Combine(a, b)
438+
439+
440+
let lspTestsPath = (__SOURCE_DIRECTORY__ </> "test" </> "FsAutoComplete.Tests.Lsp")
441+
442+
/// Ionide.ProjInfo loads the current SDK's MsBuild library so we need to ensure we
443+
/// run on the version associated with the SDK we want to test against.
444+
/// https://learn.microsoft.com/en-us/dotnet/core/deploying/?pivots=cli#framework-dependent-deployment
445+
let createGlobalJson sdkVersion =
446+
$"dotnet new globaljson --force --sdk-version %s{sdkVersion} --roll-forward LatestMinor"
447+
448+
let net80Tests =
449+
stage "test:net8.0" {
450+
workingDir lspTestsPath
451+
run (createGlobalJson "8.0.300")
452+
toolRestore
453+
run "dotnet test -c Release -f net8.0"
454+
run (fun _ -> System.IO.File.Delete(lspTestsPath </> "global.json"))
455+
}
456+
457+
let net90Tests =
458+
stage "test:net9.0" {
459+
workingDir lspTestsPath
460+
envVars [ "BuildNet9", "true" ]
461+
run (createGlobalJson "9.0.100")
462+
toolRestore
463+
run "dotnet test -c Release -f net9.0"
464+
run (fun _ -> System.IO.File.Delete(lspTestsPath </> "global.json"))
465+
}
466+
467+
let net100Tests =
468+
stage "test:net10.0" {
469+
workingDir lspTestsPath
470+
envVars [ "BuildNet10", "true" ]
471+
run (createGlobalJson "10.0.100")
472+
toolRestore
473+
run "dotnet test -c Release -f net10.0"
474+
run (fun _ -> System.IO.File.Delete(lspTestsPath </> "global.json"))
475+
}
476+
477+
478+
pipeline "Tests" {
479+
description "Run all tests"
480+
net80Tests
481+
net90Tests
482+
net100Tests
483+
runIfOnlySpecified true
432484
}
433485

434486
tryPrintPipelineCommandHelp ()

paket.dependencies

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
version 7.2.1
22

3-
framework: netstandard2.0, netstandard2.1, net8.0, net9.0
3+
framework: netstandard2.0, netstandard2.1, net8.0, net9.0, net10.0
44

55
source https://api.nuget.org/v3/index.json
66
# this is the FCS nightly feed, re-enable at your own risk!
77
# source: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json
88
# source: ./libs
99
storage: none
10+
lowest_matching:true
11+
strategy: min
1012

1113
nuget BenchmarkDotNet
1214
nuget Fantomas.Client >= 0.9
13-
nuget FSharp.Compiler.Service >= 43.9.300
14-
nuget Ionide.Analyzers 0.14.9
15+
nuget FSharp.Compiler.Service >= 43.10.100
16+
nuget Ionide.Analyzers 0.14.10
1517
nuget FSharp.Analyzers.Build
16-
nuget Ionide.ProjInfo >= 0.72.0
17-
nuget Ionide.ProjInfo.FCS >= 0.72.0
18-
nuget Ionide.ProjInfo.ProjectSystem >= 0.72.0
18+
nuget Ionide.ProjInfo >= 0.73.0
19+
nuget Ionide.ProjInfo.FCS >= 0.73.0
20+
nuget Ionide.ProjInfo.ProjectSystem >= 0.73.0
1921
nuget Microsoft.Build >= 17.2 copy_local:false
2022
nuget Microsoft.Build.Framework >= 17.4 copy_local:false
2123
nuget Microsoft.Build.Utilities.Core >= 17.4 copy_local:false
2224
nuget Microsoft.Build.Tasks.Core >= 17.4 copy_local: false
2325
nuget Nuget.Frameworks >= 6.3 copy_local: false
2426
nuget Microsoft.CodeAnalysis
25-
nuget FSharp.Analyzers.SDK 0.33.1
27+
nuget FSharp.Analyzers.SDK 0.34.1
2628
nuget ICSharpCode.Decompiler
2729
nuget Mono.Cecil >= 0.11.4
2830
nuget FSharpLint.Core
@@ -34,11 +36,12 @@ nuget Serilog.Extensions.Logging
3436
nuget Destructurama.FSharp
3537
nuget FSharp.UMX >= 1.1
3638
nuget FSharp.Formatting >= 14.0
37-
nuget FsToolkit.ErrorHandling.TaskResult >= 4.4 framework: netstandard2.1, net8.0, net9.0
39+
nuget FsToolkit.ErrorHandling < 5
40+
nuget FsToolkit.ErrorHandling.TaskResult < 5
3841
nuget IcedTasks >= 0.11.7
3942
nuget FSharpx.Async >= 1.14
4043
nuget CliWrap >= 3.0
41-
nuget System.CommandLine prerelease
44+
nuget System.CommandLine 2.0
4245
nuget FSharp.Data.Adaptive >= 1.2
4346
nuget Microsoft.NET.Test.Sdk >= 17.4
4447
nuget Dotnet.ReproducibleBuilds copy_local:true

0 commit comments

Comments
 (0)