Skip to content

Instantly share code, notes, and snippets.

@huanlin
Created April 16, 2020 11:49
Show Gist options
  • Select an option

  • Save huanlin/c8629bfa38aa570364da8b2e03d88afb to your computer and use it in GitHub Desktop.

Select an option

Save huanlin/c8629bfa38aa570364da8b2e03d88afb to your computer and use it in GitHub Desktop.
More build scripts for testing
public class DefaultTestScript : DefaultBuildScript
{
protected override void ConfigureTargets(ITaskContext context)
{
var doExample = context.CreateTarget("DoExample")
.Do(t => { throw new Exception("error on purpose."); });
var doExample2 = context.CreateTarget("DoExample2")
.Do(t => { Console.WriteLine("from doExample2"); });
var test = context.CreateTarget("test")
.Do(t => { Console.WriteLine("from test"); });
context.CreateTarget("Rebuild")
.SetAsDefault()
.AddTask(t => t.Do(x => { Console.WriteLine("from rebuild"); }))
.DependsOnAsync(doExample, doExample2)
.DependsOn(test);
}
}
/*
Expected result:
Target Duration Status
----------------------------------
DoExample 00:00:00 Failed
DoExample2 00:00:00 Finished
Test 00:00:00 NotRan
Rebuild 00:00:00 Failed
BUILD FAILED
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment