Skip to content

Commit 207fcdc

Browse files
authored
Merge pull request #681 from adamralph/update-tfms-sdks
switch from net6 to net9 and update SDKs
2 parents 4a56e60 + 777399b commit 207fcdc

File tree

11 files changed

+16
-67
lines changed

11 files changed

+16
-67
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
- uses: actions/[email protected]
2727
with:
2828
dotnet-version: |
29-
6.0.425
30-
8.0.401
29+
8.0.405
30+
9.0.102
3131
- uses: actions/[email protected]
3232
with:
3333
fetch-depth: 0

.github/workflows/infer-sharp.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- uses: actions/[email protected]
1212
with:
13-
dotnet-version: '8.0.401'
13+
dotnet-version: '9.0.102'
1414
- uses: actions/[email protected]
1515
- run: dotnet build
1616
- run: ls -al

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/[email protected]
1515
with:
16-
dotnet-version: 8.0.401
16+
dotnet-version: 9.0.102
1717
- uses: actions/[email protected]
1818
- run: dotnet build --configuration Release --nologo
1919
- name: push

SimpleExec/Command.cs

-21
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ public static void Run(
5555
.Create(
5656
Resolve(Validate(name)),
5757
args,
58-
#if NET8_0_OR_GREATER
5958
[],
60-
#else
61-
Enumerable.Empty<string>(),
62-
#endif
6359
workingDirectory,
6460
false,
6561
configureEnvironment ?? defaultAction,
@@ -176,11 +172,7 @@ public static Task RunAsync(
176172
.Create(
177173
Resolve(Validate(name)),
178174
args,
179-
#if NET8_0_OR_GREATER
180175
[],
181-
#else
182-
Enumerable.Empty<string>(),
183-
#endif
184176
workingDirectory,
185177
false,
186178
configureEnvironment ?? defaultAction,
@@ -296,11 +288,7 @@ private static async Task RunAsync(
296288
.Create(
297289
Resolve(Validate(name)),
298290
args,
299-
#if NET8_0_OR_GREATER
300291
[],
301-
#else
302-
Enumerable.Empty<string>(),
303-
#endif
304292
workingDirectory,
305293
true,
306294
configureEnvironment ?? defaultAction,
@@ -388,13 +376,8 @@ private static async Task RunAsync(
388376
await process.StandardInput.WriteAsync(standardInput).ConfigureAwait(false);
389377
process.StandardInput.Close();
390378

391-
#if NET8_0_OR_GREATER
392379
readOutput = process.StandardOutput.ReadToEndAsync(cancellationToken);
393380
readError = process.StandardError.ReadToEndAsync(cancellationToken);
394-
#else
395-
readOutput = process.StandardOutput.ReadToEndAsync();
396-
readError = process.StandardError.ReadToEndAsync();
397-
#endif
398381
}
399382
catch (Exception)
400383
{
@@ -443,11 +426,7 @@ private static string Resolve(string name)
443426

444427
var searchFileNames = string.IsNullOrEmpty(extension)
445428
? windowsExecutableExtensions.Select(ex => Path.ChangeExtension(name, ex)).ToList()
446-
#if NET8_0_OR_GREATER
447429
: [name];
448-
#else
449-
: new List<string> { name, };
450-
#endif
451430

452431
var path = GetSearchDirectories().SelectMany(_ => searchFileNames, Path.Combine)
453432
.FirstOrDefault(File.Exists);

SimpleExec/ExitCodeException.cs

-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
namespace SimpleExec;
22

3-
#if NET8_0_OR_GREATER
43
/// <summary>
54
/// The command exited with an unexpected exit code.
65
/// </summary>
@@ -13,25 +12,6 @@ public class ExitCodeException(int exitCode) : Exception
1312
/// Gets the exit code of the command.
1413
/// </summary>
1514
public int ExitCode { get; } = exitCode;
16-
#else
17-
/// <summary>
18-
/// The command exited with an unexpected exit code.
19-
/// </summary>
20-
#pragma warning disable CA1032 // Implement standard exception constructors
21-
public class ExitCodeException : Exception
22-
#pragma warning restore CA1032 // Implement standard exception constructors
23-
{
24-
/// <summary>
25-
/// Constructs an instance of a <see cref="ExitCodeException"/>.
26-
/// </summary>
27-
/// <param name="exitCode">The exit code of the command.</param>
28-
public ExitCodeException(int exitCode) => this.ExitCode = exitCode;
29-
30-
/// <summary>
31-
/// Gets the exit code of the command.
32-
/// </summary>
33-
public int ExitCode { get; }
34-
#endif
3515

3616
/// <inheritdoc/>
3717
public override string Message => $"The command exited with code {this.ExitCode}.";

SimpleExec/SimpleExec.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<PackageReadmeFile>README.md</PackageReadmeFile>
1212
<PackageReleaseNotes>https://github.com/adamralph/simple-exec/blob/main/CHANGELOG.md</PackageReleaseNotes>
1313
<PublishRepositoryUrl>true</PublishRepositoryUrl>
14-
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
14+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
1515
</PropertyGroup>
1616

1717
<ItemGroup>

SimpleExecTester/SimpleExecTester.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<LangVersion>default</LangVersion>
66
<OutputType>Exe</OutputType>
77
<RollForward>major</RollForward>
8-
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
8+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
99
</PropertyGroup>
1010

1111
</Project>

SimpleExecTests/CancellingCommands.cs

-12
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ public static async Task RunningACommandAsync()
3131

3232
// use a cancellation token source to ensure value type equality comparison in assertion is meaningful
3333
var cancellationToken = cancellationTokenSource.Token;
34-
#if NET8_0_OR_GREATER
3534
await cancellationTokenSource.CancelAsync();
36-
#else
37-
cancellationTokenSource.Cancel();
38-
#endif
3935

4036
// act
4137
var exception = await Record.ExceptionAsync(() => Command.RunAsync("dotnet", $"exec {Tester.Path} sleep", cancellationToken: cancellationToken));
@@ -52,11 +48,7 @@ public static async Task ReadingACommandAsync()
5248

5349
// use a cancellation token source to ensure value type equality comparison in assertion is meaningful
5450
var cancellationToken = cancellationTokenSource.Token;
55-
#if NET8_0_OR_GREATER
5651
await cancellationTokenSource.CancelAsync();
57-
#else
58-
cancellationTokenSource.Cancel();
59-
#endif
6052

6153
// act
6254
var exception = await Record.ExceptionAsync(() => Command.ReadAsync("dotnet", $"exec {Tester.Path} sleep", cancellationToken: cancellationToken));
@@ -80,11 +72,7 @@ public static async Task RunningACommandAsyncWithCreateNoWindow(bool createNoWin
8072
"dotnet", $"exec {Tester.Path} sleep", createNoWindow: createNoWindow, cancellationToken: cancellationToken);
8173

8274
// act
83-
#if NET8_0_OR_GREATER
8475
await cancellationTokenSource.CancelAsync();
85-
#else
86-
cancellationTokenSource.Cancel();
87-
#endif
8876

8977
// assert
9078
var exception = await Record.ExceptionAsync(() => command);

SimpleExecTests/Infra/Tester.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ namespace SimpleExecTests.Infra;
33
internal static class Tester
44
{
55
public static string Path =>
6-
#if NET6_0 && DEBUG
7-
"../../../../SimpleExecTester/bin/Debug/net6.0/SimpleExecTester.dll";
8-
#endif
9-
#if NET6_0 && RELEASE
10-
"../../../../SimpleExecTester/bin/Release/net6.0/SimpleExecTester.dll";
11-
#endif
126
#if NET8_0 && DEBUG
137
$"../../../../SimpleExecTester/bin/Debug/net8.0/SimpleExecTester.dll";
148
#endif
159
#if NET8_0 && RELEASE
1610
$"../../../../SimpleExecTester/bin/Release/net8.0/SimpleExecTester.dll";
1711
#endif
12+
#if NET9_0 && DEBUG
13+
"../../../../SimpleExecTester/bin/Debug/net9.0/SimpleExecTester.dll";
14+
#endif
15+
#if NET9_0 && RELEASE
16+
"../../../../SimpleExecTester/bin/Release/net9.0/SimpleExecTester.dll";
17+
#endif
1818
}

SimpleExecTests/SimpleExecTests.csproj

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
<PropertyGroup>
44
<LangVersion>default</LangVersion>
5+
<!-- https://github.com/dotnet/roslyn-analyzers/issues/7192 -->
6+
<NoWarn>$(NoWarn);CA1515</NoWarn>
57
<RollForward>major</RollForward>
6-
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
8+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
79
</PropertyGroup>
810

911
<ItemGroup>

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.100",
3+
"version": "9.0.100",
44
"rollForward": "latestMajor"
55
}
66
}

0 commit comments

Comments
 (0)