Bullseye is a .NET library that runs a target dependency graph.
Bullseye is primarily designed as a build tool for .NET projects, and is usually used together with SimpleExec, but Bullseye targets can do anything. They are not restricted to building .NET projects.
Platform support: .NET 6.0 and later.
- Quick start
- Sample wrapper scripts
- Enumerable inputs
- Command-line arguments
- Non-static API
- NO_COLOR
- Who's using Bullseye?
-
Next to an existing .NET solution (
.sln
file), add a .NET console app namedtargets
βdotnet new console --name targets
-
Change to the new directory β
cd targets
-
Add a reference to Bullseye β
dotnet add package Bullseye
-
Add a reference to SimpleExec β
dotnet add package SimpleExec
-
Replace the contents of
targets/Program.cs
with:using static Bullseye.Targets; using static SimpleExec.Command; Target("build", () => RunAsync("dotnet", "build --configuration Release --nologo --verbosity quiet")); Target("test", DependsOn("build"), () => RunAsync("dotnet", "test --configuration Release --no-build --nologo --verbosity quiet")); Target("default", DependsOn("test")); await RunTargetsAndExitAsync(args, ex => ex is SimpleExec.ExitCodeException);
-
Change to the solution directory β
cd ..
-
Run the targets project β
dotnet run --project targets
.
VoilΓ ! You've just written and run your first Bullseye build program. You will see output similar to:
For help, run dotnet run --project targets --help
.
-
build
(Linux and macOS)#!/usr/bin/env bash set -euo pipefail dotnet run --project targets -- "$@"
-
build.cmd
(Windows)@echo Off dotnet run --project targets -- %*
For example, you may want to run your test projects one by one, so that the timing of each one and which one, if any, failed, is displayed in the Bullseye build summary:
Target(
"test",
DependsOn("build"),
ForEach("./FooTests.Acceptance", "./FooTests.Performance"),
project => RunAsync($"dotnet", $"test {project} --configuration Release --no-build --nologo --verbosity quiet"));
dotnet run -- test
Generally, all the command-line arguments passed to Program.cs
should be passed along to Bullseye, as shown in the quick start above (RunTargetsAndExitAsync(args);
). This is because Bullseye effectively provides a command-line interface, with options for displaying a list of targets, performing dry runs, suppressing colour, and more. For full details of the command-line options, run your targets project supplying the --help
(-h
/-?
) option:
dotnet run --project targets -- --help
./build --help
./build.cmd --help
You can also handle custom arguments in Program.cs
, but you should ensure that only valid arguments are passed along to Bullseye and that the help text contains both your custom arguments and the arguments supported by Bullseye. A good way to do this is to use a command-line parsing package to define your custom arguments, and to provide translation between the package and Bullseye. For example, see the test projects for:
For most cases, the static API described above is sufficient. For more complex scenarios where a number of target collections are required, the non-static API may be used.
var targets1 = new Targets();
targets1.Add("foo", () => Console.Out.WriteLine("foo1"));
var targets2 = new Targets();
targets2.Add("foo", () => Console.Out.WriteLine("foo2"));
await targets1.RunWithoutExitingAsync(args);
await targets2.RunWithoutExitingAsync(args);
Bullseye supports NO_COLOR.
To name a few:
- AspNetCore.AsyncInitialization
- Config.SqlStreamStore
- ConfigR
- Elastic
- EssentialMVVM
- FakeItEasy
- Fluxzy
- HumanBytes
- Ibento
- IdentityModel
- IdentityServer
- Iso8601DurationHelper
- Linq.Extras
- LittleForker
- LykkeOSS
- Marten
- MinVer
- Particular
- ProxyKit
- PseudoLocalizer
- Radical Framework
- RealWorld
- SelfInitializingFakes
- SendComics
- SqlStreamStore.Locking
- SQLStreamStore
- Statik
- Tasty
- TemplatedConfiguration
- Xenial
Feel free to send a pull request to add your repository or organisation to this list!
Target by Franck Juncker from the Noun Project.