Skip to content

Commit 43987e5

Browse files
authored
Merge pull request #243 from xt0rted/dotnet-8
Target .net 8
2 parents 75fe7c9 + b8aba51 commit 43987e5

22 files changed

+110
-118
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Unreleased
44

5-
> [!NOTE]
6-
> This version drops support for .NET Core 3.1 which is no longer supported
7-
5+
- Dropped support for .NET Core 3.1
6+
- Dropped Support for .NET 6
7+
- Added support for .NET 8
88
- Adjusted globbing so `:` acts like a path separator ([#131](https://github.com/xt0rted/dotnet-run-script/pull/131))
99
- `foo:*` will match `foo:bar` but not `foo:bar:baz`
1010
- `foo:*:baz` will match `foo:bar:baz`

Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<Project>
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0</TargetFrameworks>
4+
<TargetFramework>net8.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<IsPackable>false</IsPackable>
9+
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
910
</PropertyGroup>
1011

1112
<PropertyGroup>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Arguments passed after the double dash are passed through to each executing scri
138138
In this example both the `--configuration` and `--framework` options will be passed to each of the four scripts when running them.
139139

140140
```console
141-
dotnet r build test:unit test:integration package -- --configuration Release --framework net6.0
141+
dotnet r build test:unit test:integration package -- --configuration Release --framework net8.0
142142
```
143143

144144
### Globbing or wildcard support

analysis/roslynator.editorconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,6 @@ dotnet_diagnostic.RCS1174.severity = error
559559
# RCS1175: Unused 'this' parameter
560560
dotnet_diagnostic.RCS1175.severity = error
561561

562-
# RCS1176: Use 'var' instead of explicit type (when the type is not obvious)
563-
dotnet_diagnostic.RCS1176.severity = error
564-
565562
# RCS1177: Use 'var' instead of explicit type (in foreach)
566563
dotnet_diagnostic.RCS1177.severity = error
567564

@@ -778,6 +775,9 @@ dotnet_diagnostic.RCS1253.severity = error
778775
# RCS1254: Normalize format of enum flag value
779776
dotnet_diagnostic.RCS1254.severity = error
780777

778+
# RCS1264: Use 'var' or explicit type
779+
dotnet_diagnostic.RCS1264.severity = error
780+
781781
# RCS9001: Use pattern matching
782782
dotnet_diagnostic.RCS9001.severity = error
783783

global.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"sdk": {
3-
"version": "6.0.420"
3+
"version": "8.0.203"
44
},
5-
//"scriptShell": "pwsh",
65
"scripts": {
76
// project scripts
87
"clean": "dotnet r clean:*",
@@ -12,7 +11,6 @@
1211
"build": "dotnet build",
1312

1413
"test": "dotnet test",
15-
"test:6": "dotnet r test -- --framework net6.0",
1614

1715
"test:unit": "dotnet r test -- --filter \"category=unit\"",
1816
"test:int": "dotnet r test -- --filter \"category=integration\"",

src/ArgumentBuilder.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#pragma warning disable IDISP001 // Dispose created
2+
#pragma warning disable IDISP003 // Dispose previous before re-assigning
3+
14
namespace RunScript;
25

36
using System.Runtime.CompilerServices;
@@ -79,13 +82,13 @@ public static string EscapeAndConcatenateCommandAndArgArrayForCmdProcessStart(
7982
}
8083

8184
/// <summary>
82-
/// Concatinates the command and arguments without any escaping.
85+
/// Concatenates the command and arguments without any escaping.
8386
/// This is meant to be used for display only and not for passing to a new process.
8487
/// </summary>
8588
/// <param name="command">The base command.</param>
8689
/// <param name="args">List of optional arguments.</param>
87-
/// <returns>A raw concatination of the <paramref name="command"/> and <paramref name="args"/>.</returns>
88-
public static string ConcatinateCommandAndArgArrayForDisplay(
90+
/// <returns>A raw concatenation of the <paramref name="command"/> and <paramref name="args"/>.</returns>
91+
public static string ConcatenateCommandAndArgArrayForDisplay(
8992
string? command,
9093
string[]? args)
9194
{

src/CommandBuilder.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ namespace RunScript;
22

33
using System.Text.RegularExpressions;
44

5-
internal class CommandBuilder
5+
internal partial class CommandBuilder
66
{
7-
// This is the same regex used by npm's run-script library
8-
public static readonly Regex IsCmdCheck = new("(?:^|\\\\)cmd(?:\\.exe)?$", RegexOptions.IgnoreCase);
9-
107
private readonly IConsoleWriter _writer;
118
private readonly IEnvironment _environment;
129
private readonly Project _project;
@@ -31,6 +28,10 @@ public CommandBuilder(
3128

3229
public ProcessContext? ProcessContext { get; private set; }
3330

31+
// This is the same regex used by npm's run-script library
32+
[GeneratedRegex("(?:^|\\\\)cmd(?:\\.exe)?$", RegexOptions.IgnoreCase)]
33+
public static partial Regex IsCmdCheck();
34+
3435
public void SetUpEnvironment(string? scriptShellOverride)
3536
{
3637
var (scriptShell, isCmd) = GetScriptShell(scriptShellOverride ?? _project.ScriptShell);
@@ -61,7 +62,7 @@ public ICommandGroupRunner CreateGroupRunner(CancellationToken cancellationToken
6162
? _environment.GetEnvironmentVariable("COMSPEC") ?? "cmd"
6263
: "sh";
6364

64-
var isCmd = IsCmdCheck.IsMatch(shell);
65+
var isCmd = IsCmdCheck().IsMatch(shell);
6566

6667
return (shell, isCmd);
6768
}

src/CommandGroupRunner.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ public virtual ICommandRunner BuildCommand()
3636

3737
public async Task<int> RunAsync(string name, string[]? scriptArgs)
3838
{
39-
var scriptNames = ImmutableArray.Create(new[] { "pre" + name, name, "post" + name });
39+
var scriptNames = ImmutableArray.Create([
40+
"pre" + name,
41+
name,
42+
"post" + name,
43+
]);
4044

4145
foreach (var subScript in scriptNames.Where(scriptName => _scripts.ContainsKey(scriptName) || scriptName == "env"))
4246
{

src/CommandRunner.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public async Task<int> RunAsync(string name, string cmd, string[]? args)
2525
{
2626
_cancellationToken.ThrowIfCancellationRequested();
2727

28-
_writer.Banner(name, ArgumentBuilder.ConcatinateCommandAndArgArrayForDisplay(cmd, args));
28+
_writer.Banner(name, ArgumentBuilder.ConcatenateCommandAndArgArrayForDisplay(cmd, args));
2929

3030
using (var process = new Process())
3131
{
@@ -36,6 +36,7 @@ public async Task<int> RunAsync(string name, string cmd, string[]? args)
3636

3737
var outStream = new StreamForwarder();
3838
var errStream = new StreamForwarder();
39+
3940
Task? taskOut = null;
4041
Task? taskErr = null;
4142

src/GlobalCommands.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace RunScript;
33
internal static class GlobalCommands
44
{
55
/// <summary>
6-
/// The help command that lists all the scripts availble in the <g>global.json</g>.
6+
/// The help command that lists all the scripts available in the <g>global.json</g>.
77
/// </summary>
88
/// <param name="writer">The console logger instance to use.</param>
99
/// <param name="scripts">The project's scripts.</param>
@@ -28,7 +28,7 @@ public static void PrintAvailableScripts(IConsoleWriter writer, IDictionary<stri
2828
/// <exception cref="ArgumentNullException"></exception>
2929
public static void PrintEnvironmentVariables(IConsoleWriter writer, IEnvironment environment)
3030
{
31-
if (environment is null) throw new ArgumentNullException(nameof(environment));
31+
ArgumentNullException.ThrowIfNull(environment);
3232

3333
writer.Banner("env");
3434

0 commit comments

Comments
 (0)