Skip to content

Commit 623c778

Browse files
committed
switch build script to Bullseye
1 parent 9d7bb56 commit 623c778

File tree

8 files changed

+72
-22
lines changed

8 files changed

+72
-22
lines changed

SimpleExec.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<Project Path="SimpleExec/SimpleExec.csproj" />
33
<Project Path="SimpleExecTester/SimpleExecTester.csproj" />
44
<Project Path="SimpleExecTests/SimpleExecTests.csproj" />
5+
<Project Path="targets/Targets.csproj" />
56
</Solution>

build

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
3-
4-
echo "${0##*/}": Formatting...
5-
dotnet format --verify-no-changes
6-
7-
echo "${0##*/}": Building...
8-
dotnet build --configuration Release --nologo
9-
10-
echo "${0##*/}": Testing...
11-
dotnet test --configuration Release --no-build
3+
dotnet run --project targets --no-launch-profile -- "$@"

build.cmd

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,2 @@
11
@echo Off
2-
3-
echo %~nx0: Formatting...
4-
dotnet format --verify-no-changes || goto :error
5-
6-
echo %~nx0: Building...
7-
dotnet build --configuration Release --nologo || goto :error
8-
9-
echo %~nx0: Testing...
10-
dotnet test --configuration Release --no-build || goto :error
11-
12-
goto :EOF
13-
:error
14-
exit /b %errorlevel%
2+
dotnet run --project targets --no-launch-profile -- %*

targets/.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[*.cs]
2+
3+
# CA2007: Consider calling ConfigureAwait on the awaited task
4+
dotnet_diagnostic.CA2007.severity = none

targets/Command.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Reflection;
2+
using CliWrap;
3+
4+
namespace Targets;
5+
6+
internal static class Command
7+
{
8+
private static readonly string EchoPrefix = Assembly.GetExecutingAssembly().GetName().Name!;
9+
10+
internal static async Task RunAsync(string name, string args)
11+
{
12+
await Console.Error.WriteLineAsync($"{EchoPrefix}: {name} {args}");
13+
await using var standardOutput = Console.OpenStandardOutput();
14+
await using var standardError = Console.OpenStandardError();
15+
var cmd = Cli.Wrap(name).WithArguments(args) | (standardOutput, standardError);
16+
_ = await cmd.ExecuteAsync();
17+
}
18+
19+
internal static readonly Type ExitCodeExceptionType = typeof(CliWrap.Exceptions.CommandExecutionException);
20+
}

targets/Program.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using static Bullseye.Targets;
2+
using static Targets.Command;
3+
4+
Target("format", () => RunAsync("dotnet", "format --verify-no-changes"));
5+
6+
Target("build", () => RunAsync("dotnet", "build --configuration Release --nologo"));
7+
8+
Target("test", dependsOn: ["build",], () => RunAsync("dotnet", "test --configuration Release --no-build"));
9+
10+
Target("default", dependsOn: ["format", "test",]);
11+
12+
await RunTargetsAndExitAsync(args, ex => ex.GetType() == ExitCodeExceptionType);

targets/Targets.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<IsPackable>false</IsPackable>
5+
<OutputType>Exe</OutputType>
6+
<TargetFramework>net10.0</TargetFramework>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Bullseye" Version="6.1.0-rc.1" />
11+
<PackageReference Include="CliWrap" Version="3.10.0" />
12+
</ItemGroup>
13+
14+
</Project>

targets/packages.lock.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": 1,
3+
"dependencies": {
4+
"net10.0": {
5+
"Bullseye": {
6+
"type": "Direct",
7+
"requested": "[6.1.0-rc.1, )",
8+
"resolved": "6.1.0-rc.1",
9+
"contentHash": "Z22Lk114juFYdNisDA5Av1pFJd//daef80o+/OmcGWteBs1HUQyu+o3n49eqxzvhO8orOXEE7bwhAWmwTd6eBw=="
10+
},
11+
"CliWrap": {
12+
"type": "Direct",
13+
"requested": "[3.10.0, )",
14+
"resolved": "3.10.0",
15+
"contentHash": "Igph39WNImUFqQrpTeBDPafcCnM1u/8IooZHqMRF/5JdV5H78p+AbZkeYY1Nkz1WlbI/Gt2Hq/3rYh55jxRF9Q=="
16+
}
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)