• Stars
    star
    810
  • Rank 54,143 (Top 2 %)
  • Language
    C#
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎯 A .NET library for running a target dependency graph.

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

  • Next to an existing .NET solution (.sln file), add a .NET console app named targets β€” 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.

Sample wrapper scripts

  • build (Linux and macOS)

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

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

Enumerable inputs

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

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.

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.

More Repositories

1

minver

🏷 Minimalistic versioning using Git tags.
C#
790
star
2

simple-exec

πŸƒ A .NET library that runs external commands.
C#
638
star
3

xbehave.net

βœ– An xUnit.net extension for describing each step in a test with natural language.
C#
382
star
4

liteguard

πŸ”’ The most simple, unambiguous, and lightweight .NET guard clause library.
C#
258
star
5

bau

The C# task runner
C#
151
star
6

scriptcs-nancy

Nancy Script Pack for scriptcs
C#
35
star
7

dude

The portable C# script runner!
C#
20
star
8

simple-targets-csx

βŠ™ A minimalist target runner for C# scripts.
C#
17
star
9

netstandard-deck

A slide deck for "What is .NET Standard?".
JavaScript
7
star
10

bau-msbuild

A Bau plugin for running MSBuild
C#
7
star
11

dotnet-scripting-dialect

Draft proposal for .NET scripting "dialects"
6
star
12

stylecop-msbuild

Adds official StyleCop MSBuild targets to your project for running StyleCop analysis with every build.
5
star
13

blunt

Smoke testing for multi-targetting NuGet packages.
C#
5
star
14

adamralph.github.com

My website
CSS
3
star
15

h5h

An HTML5 highlighter
CSS
3
star
16

code-the-future-now

Code samples for https://sessionize.com/s/adamralph/code_the_future_now/21105
C#
2
star
17

bau-nuget

A Bau plugin for running NuGet commands
C#
2
star
18

cola

The portable LINQPad runner!
C#
2
star
19

domaindrivendesign

A .NET framework for building applications using Domain Driven Design.
C#
2
star
20

racer83

A recreation of one of the masterpieces of my youth
Visual Basic
2
star
21

netstandard-magic

C#
1
star
22

.github

Standard files for my repos
1
star
23

xbehave.github.io

HTML
1
star
24

nancy-deck

Slides for my talk 'Nancy, the super duper happy OSS .NET project'
JavaScript
1
star