Bullseye 4.1.0-alpha.2

Bullseye

Bullseye

NuGet version

Build status CodeQL analysis Lint Spell check

AppVeyor smoke test status CircleCI smoke test status Cirrus CI smoke test status GitLab CI/CD smoke test status

Bullseye is a .NET library that runs a target dependency graph.

Bullseye targets can do anything. They are not restricted to building .NET projects.

Platform support: .NET Standard 2.1 and later.

Quick start

  • Create a .NET console app named targets and add a reference to Bullseye.

  • Replace the contents of Program.cs with:

    using static Bullseye.Targets;
    
    class Program
    {
        static async Task Main(string[] args)
        {
            Target("default", () => System.Console.WriteLine("Hello, world!"));
            await RunTargetsAndExitAsync(args);
        }
    }
    
  • Run the app. E.g. dotnet run or F5 in Visual Studio:

VoilĂ ! You've just written and run your first Bullseye program. You will see output similar to:

For help, run dotnet run -- --help.

Also see the async quick start.

Defining dependencies

Target("make-tea", () => Console.WriteLine("Tea made."));
Target("drink-tea", DependsOn("make-tea"), () => Console.WriteLine("Ahh... lovely!"));
Target("walk-dog", () => Console.WriteLine("Walkies!"));
Target("default", DependsOn("drink-tea", "walk-dog"));

Enumerable inputs

Target(
    "eat-biscuits",
    ForEach("digestives", "chocolate hobnobs"),
    biscuits => Console.WriteLine($"Mmm...{biscuits}! Nom nom."));
dotnet run -- eat-biscuits

Sample wrapper scripts

  • build

    #!/usr/bin/env bash
    set -euo pipefail
    dotnet run --project targets -- "$@"
    
  • build.cmd

    @echo Off
    dotnet run --project targets -- %*
    

Command-line arguments

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:

Non-static API

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);

NO_COLOR

Bullseye supports NO_COLOR.

FAQ

Can I force a pause before exiting when debugging in Visual Studio 2017 (or earlier)?

Yes! Add the following line anywhere before calling RunTargetsAndExitAsync:

AppDomain.CurrentDomain.ProcessExit += (s, e) => Console.ReadKey();

Note that the common way to do this for .NET console apps is to add a line such as the following before the end of the Program.Main method:

Console.ReadKey();

This does not work after calling RunTargetsAndExitAsync because that is the final statement that will be executed.

In Visual Studio 2019 and later, .NET console apps pause before exiting by default, so none of this is required.

Who's using Bullseye?

To name a few:

Feel free to send a pull request to add your repository or organisation to this list!


Target by Franck Juncker from the Noun Project.

No packages depend on Bullseye.

https://github.com/adamralph/bullseye/blob/main/CHANGELOG.md

.NET Standard 2.1

  • No dependencies.

Version Downloads Last updated
5.0.0 2 12/26/2024
5.0.0-rc.1 0 12/21/2023
5.0.0-alpha.2 2 12/26/2024
5.0.0-alpha.1 2 12/26/2024
4.2.1 0 01/24/2023
4.2.1-rc.1 0 12/03/2022
4.2.0 2 12/26/2024
4.2.0-beta.1 2 12/26/2024
4.1.1 1 12/26/2024
4.1.0 2 12/26/2024
4.1.0-rc.1 1 12/26/2024
4.1.0-alpha.2 2 12/26/2024
4.1.0-alpha.1 1 12/26/2024
4.0.0 3 12/26/2024
4.0.0-rc.3 2 12/26/2024
4.0.0-rc.2 1 12/26/2024
4.0.0-rc.1 1 12/26/2024
4.0.0-beta.1 2 12/26/2024
4.0.0-alpha.2 1 12/26/2024
4.0.0-alpha.1 1 12/26/2024
3.8.0 0 08/20/2021
3.8.0-rc.1 0 08/03/2021
3.8.0-beta.1 0 07/28/2021
3.8.0-alpha.2 2 12/26/2024
3.8.0-alpha.1 2 12/26/2024
3.7.1 2 12/26/2024
3.7.0 1 12/26/2024
3.7.0-alpha.1 1 12/26/2024
3.6.0 1 12/26/2024
3.6.0-rc.1 0 12/22/2020
3.6.0-beta.1 1 12/26/2024
3.5.0 2 12/26/2024
3.5.0-rc.1 1 12/26/2024
3.4.0 1 12/26/2024
3.4.0-alpha.1 1 12/26/2024
3.3.0 4 11/28/2024
3.3.0-beta.1 1 12/26/2024
3.2.0 2 12/26/2024
3.2.0-rc.1 0 02/09/2020
3.2.0-alpha.2 1 12/26/2024
3.2.0-alpha.1 1 12/26/2024
3.1.0 1 12/26/2024
3.1.0-rc.1 0 11/13/2019
3.1.0-alpha.1 2 12/26/2024
3.0.0 3 12/26/2024
3.0.0-rc.1 0 09/08/2019
3.0.0-beta.3 1 12/26/2024
3.0.0-beta.2 2 12/26/2024
3.0.0-beta.1 1 12/26/2024
3.0.0-alpha.1 2 12/26/2024
2.4.0 1 12/26/2024
2.4.0-rc.2 2 12/26/2024
2.4.0-rc.1 0 07/15/2019
2.4.0-beta.1 0 06/28/2019
2.4.0-alpha.1 1 12/26/2024
2.3.0 2 12/26/2024
2.3.0-rc.1 0 12/14/2018
2.3.0-beta.6 2 12/26/2024
2.3.0-beta.5 2 12/26/2024
2.3.0-beta.4 1 12/26/2024
2.3.0-beta.3 2 12/26/2024
2.3.0-beta.2 3 12/26/2024
2.3.0-beta.1 1 12/26/2024
2.3.0-alpha.1 2 12/26/2024
2.2.0 1 12/26/2024
2.2.0-rc.2 2 12/26/2024
2.2.0-rc.1 0 10/13/2018
2.2.0-beta.2 1 12/26/2024
2.2.0-beta.1 1 12/26/2024
2.1.0 2 12/26/2024
2.1.0-beta.1 1 12/26/2024
2.0.0 1 12/26/2024
2.0.0-rc.3 0 09/30/2018
2.0.0-rc.2 3 12/26/2024
2.0.0-rc.1 0 09/26/2018
1.3.0 1 12/26/2024
1.2.0 0 09/03/2018
1.2.0-rc.2 0 09/02/2018
1.2.0-rc.1 0 09/02/2018
1.1.0 0 08/23/2018
1.1.0-rc.2 1 12/26/2024
1.1.0-rc.1 0 08/12/2018
1.0.1 0 08/02/2018
1.0.0 1 12/26/2024
1.0.0-rc.5 2 12/26/2024
1.0.0-rc.4 2 12/26/2024
1.0.0-rc.3 0 06/26/2018
1.0.0-rc.2 1 12/26/2024
1.0.0-rc.1 0 05/06/2018
1.0.0-alpha0002 2 12/26/2024
1.0.0-alpha0001 0 11/17/2017