private static void ConstructTargets(TargetTree targetTree) { targetTree.AddTarget("rebuild") .SetDescription("Builds the product, packages it, deploys and tests it on a local instance") .DependsOn("compile", "dupfinder", "tests").SetAsDefault(); targetTree.AddTarget("release") .SetDescription("Builds the library, runs tests on it and publishes it on the NuGet server") .DependsOn("rebuild", "nuget"); targetTree.GetTarget("fetch.build.version").Do(TargetFetchBuildVersion); targetTree.AddTarget("tests") .SetDescription("Runs tests on the project").Do(TargetRunTests).DependsOn("load.solution"); targetTree.AddTarget("dupfinder") .SetDescription("Runs R# dupfinder to find code duplicates").Do(TargetDupFinder); targetTree.AddTarget("nuget") .SetDescription("Produces NuGet packages for the library and publishes them to the NuGet server") .Do(c => { TargetNuGet(c, "Freude"); }).DependsOn("fetch.build.version"); }
protected override void ConfigureTargets(TargetTree targetTree, ICollection <string> args) { targetTree.AddTarget("unit.tests") .SetDescription("Runs unit tests on the project") .Do(x => TargetRunTests(x, "Flubu.Tests")).DependsOn("load.solution"); targetTree.AddTarget("rebuild") .SetDescription("Rebuilds the project, runs tests and packages the build products.") .SetAsDefault() .DependsOn("compile", "unit.tests", "il.merge"); targetTree.AddTarget("rebuild.server") .SetDescription( "Rebuilds the project, runs tests, packages the build products and publishes it on the NuGet server.") .DependsOn("rebuild", "nuget"); targetTree.GetTarget("fetch.build.version") .Do(TargetFetchBuildVersion); targetTree.AddTarget("nuget") .SetDescription("Produces NuGet packages for reusable components and publishes them to the NuGet server") .Do(c => TargetNuGet(c, "Flubu")).DependsOn("fetch.build.version"); targetTree.AddTarget("il.merge") .DependsOn("load.solution") .Do(TargetIlMerge); }
protected override void ConfigureTargets(TargetTree targetTree, ICollection <string> args) { //Add custom targets to build and dependencies to default target if needed. targetTree.AddTarget("rebuild") .SetDescription("Rebuilds the project.") .SetAsDefault() .DependsOn("compile"); targetTree.GetTarget("fetch.build.version") .Do(TargetFetchBuildVersion); }
protected override void ConfigureTargets(TargetTree targetTree, ICollection <string> args) { targetTree.AddTarget("clean.output.debug") .DependsOn("load.solution") .Do(c => { c.Properties.Set(BuildProps.BuildConfiguration, "Debug"); targetTree.GetTarget("clean.output").Execute(c); }); targetTree.AddTarget("rebuild") .SetAsDefault() .SetDescription("Builds the library and runs tests on it") .DependsOn("compile", "dupfinder", "tests"); targetTree.AddTarget("release") .SetDescription("Builds the library, runs tests on it and publishes it on the NuGet server") .DependsOn("setup.iis", "rebuild", "nuget"); targetTree.GetTarget("fetch.build.version") .Do(TargetFetchBuildVersion); targetTree.AddTarget("setup.iis") .SetDescription("Sets up a test web application in IIS") .Do(TargetSetupIis); targetTree.AddTarget("dupfinder") .SetDescription("Runs R# dupfinder to find code duplicates") .Do(TargetDupFinder); targetTree.AddTarget("tests") .SetDescription("Runs tests on the project") .Do(TargetRunTests).DependsOn("load.solution"); targetTree.AddTarget("nuget") .SetDescription("Produces NuGet packages for the library and publishes them to the NuGet server") .Do(c => { TargetNuGet(c, "Syborg"); }).DependsOn("prepare.build.dir", "fetch.build.version"); }
public void Test() { TargetTree targetTree = new TargetTree(); targetTree.AddTarget("compile") .SetDescription("Compiles the VS solution and runs FxCop analysis on it") .Do(TargetCompile).DependsOn("load.solution"); ITarget target = targetTree.GetTarget("compile"); using (ITaskSession session = new TaskSession(new SimpleTaskContextProperties(), new string[0])) { session.Start(OnBuildFinished); NotifyUserTask task = new NotifyUserTask("message"); task.Execute(session); } }
protected override void ConfigureTargets(TargetTree targetTree, ICollection <string> args) { targetTree.AddTarget("rebuild") .SetAsDefault() .SetDescription("Builds the library and runs tests on it") .DependsOn("compile-4.0", "dupfinder", "tests-4.0"); targetTree.AddTarget("release") .SetDescription("Builds the library, runs tests on it and publishes it on the NuGet server") .DependsOn("rebuild", "nuget"); targetTree.GetTarget("fetch.build.version") .Do(TargetFetchBuildVersion); targetTree.AddTarget("compile-4.0") .SetAsHidden() .DependsOn("load.solution", "generate.commonassinfo") .Do(TargetCompile40); targetTree.AddTarget("dupfinder") .SetDescription("Runs R# dupfinder to find code duplicates") .Do(TargetDupFinder); targetTree.AddTarget("tests-4.0") .SetDescription("Runs tests on the .NET 4.0-targeted assemblies (+ measuring code coverage)") .Do(r => { TargetRun40TestsWithCoverage(r, "LibroLib.Tests"); }).DependsOn("load.solution"); targetTree.AddTarget("nuget") .SetDescription("Produces NuGet packages for the library and publishes them to the NuGet server") .Do(c => { TargetNuGet(c, "LibroLib.Common"); TargetNuGet(c, "LibroLib.WebUtils"); }).DependsOn("fetch.build.version"); }
public static int Main(string[] args) { TargetTree targetTree = new TargetTree(); BuildTargets.FillBuildTargets(targetTree); targetTree.GetTarget("fetch.build.version") .Do(TargetFetchBuildVersion); targetTree.AddTarget("rebuild") .SetDescription("Compiles the code and runs tests.") .SetAsDefault().DependsOn("compile", "fxcop", "unit.tests", "package"); targetTree.AddTarget("tests") .SetDescription("Runs tests on the project") .Do(r => { int testCounter = 0; BuildTargets.TargetRunTests(r, "GroundTruth.Tests", null, ref testCounter); }).DependsOn("load.solution"); targetTree.AddTarget("package") .SetDescription("Packages all the build products into ZIP files.") .Do(TargetPackage) .SetAsDefault().DependsOn("load.solution"); //runner.AddTarget ("package.source") // .SetDescription ("Packages the souce code into ZIP file") // .Do (TargetPackageSource).DependsOn ("load.solution"); using (TaskSession session = new TaskSession(new SimpleTaskContextProperties(), args, targetTree)) { BuildTargets.FillDefaultProperties(session); session.Start(BuildTargets.OnBuildFinished); session.AddLogger(new MulticoloredConsoleLogger(Console.Out)); session.Properties.Set(BuildProps.CompanyName, "igorbrejc.net"); session.Properties.Set(BuildProps.CompanyCopyright, "Copyright (C) 2008-2012 Igor Brejc."); session.Properties.Set(BuildProps.ProductId, "GroundTruth"); session.Properties.Set(BuildProps.ProductName, "GroundTruth"); session.Properties.Set(BuildProps.SolutionFileName, "GroundTruth.sln"); session.Properties.Set(BuildProps.VersionControlSystem, VersionControlSystem.Mercurial); try { // actual run if (args.Length == 0) { targetTree.RunTarget(session, targetTree.DefaultTarget.TargetName); } else { string targetName = args[0]; if (false == targetTree.HasTarget(targetName)) { session.WriteError("ERROR: The target '{0}' does not exist", targetName); targetTree.RunTarget(session, "help"); return(2); } targetTree.RunTarget(session, args[0]); } session.Complete(); return(0); } catch (TaskExecutionException) { return(1); } catch (Exception ex) { Console.WriteLine(ex); return(1); } } }
public static int Main(string[] args) { TargetTree targetTree = new TargetTree(); BuildTargets.FillBuildTargets(targetTree); int testsRunCounter = 0; targetTree.AddTarget("rebuild") .SetAsDefault() .SetDescription("Rebuilds the whole project") .DependsOn("compile", "fxcop", "tests", "package"); targetTree.GetTarget("fetch.build.version") .Do(TargetFetchBuildVersion); targetTree.AddTarget("tests") .SetDescription("Runs unit tests") .Do(r => { BuildTargets.TargetRunTests(r, "Detergent.Tests", null, ref testsRunCounter); }).DependsOn("load.solution"); targetTree.AddTarget("package") .SetDescription("Packages the build") .Do(TargetPackage).DependsOn("load.solution", "fetch.build.version"); targetTree.AddTarget("nuget") .SetDescription("Produces NuGet packages for reusable components and publishes them to the NuGet server") .Do(c => { TargetNuGet(c, "Detergent"); }).DependsOn("fetch.build.version"); using (TaskSession session = new TaskSession(new SimpleTaskContextProperties(), args, targetTree)) { BuildTargets.FillDefaultProperties(session); session.Start(BuildTargets.OnBuildFinished); session.AddLogger(new MulticoloredConsoleLogger(Console.Out)); //session.Properties.Set(BuildProps.TargetDotNetVersion, "v4.0.30319"); //session.Properties.Set(BuildProps.TargetDotNetVersionForGallio, "v4.0.30319"); session.Properties.Set(BuildProps.CompanyName, CompanyName); session.Properties.Set(BuildProps.CompanyCopyright, CompanyCopyright); session.Properties.Set(BuildProps.GallioEchoPath, "lib/Gallio-3.2.750/bin/Gallio.Echo.exe"); session.Properties.Set(BuildProps.ProductId, "Detergent"); session.Properties.Set(BuildProps.ProductName, "Detergent"); session.Properties.Set(BuildProps.SolutionFileName, "Detergent.2010.sln"); session.Properties.Set(BuildProps.VersionControlSystem, VersionControlSystem.Subversion); try { // actual run if (args.Length == 0) targetTree.RunTarget(session, targetTree.DefaultTarget.TargetName); else { string targetName = args[0]; if (false == targetTree.HasTarget(targetName)) { session.WriteError("ERROR: The target '{0}' does not exist", targetName); targetTree.RunTarget(session, "help"); return 2; } targetTree.RunTarget(session, args[0]); } session.Complete(); return 0; } catch (TaskExecutionException) { return 1; } catch (Exception ex) { Console.WriteLine(ex); return 1; } } }
public static int Main(string[] args) { TargetTree targetTree = new TargetTree(); BuildTargets.FillBuildTargets(targetTree); int testsRunCounter = 0; targetTree.AddTarget("rebuild") .SetAsDefault() .SetDescription("Rebuilds the whole project") .DependsOn("compile", "fxcop", "tests", "package"); targetTree.GetTarget("fetch.build.version") .Do(TargetFetchBuildVersion); targetTree.AddTarget("tests") .SetDescription("Runs unit tests") .Do(r => { BuildTargets.TargetRunTests(r, "Detergent.Tests", null, ref testsRunCounter); }).DependsOn("load.solution"); targetTree.AddTarget("package") .SetDescription("Packages the build") .Do(TargetPackage).DependsOn("load.solution", "fetch.build.version"); targetTree.AddTarget("nuget") .SetDescription("Produces NuGet packages for reusable components and publishes them to the NuGet server") .Do(c => { TargetNuGet(c, "Detergent"); }).DependsOn("fetch.build.version"); using (TaskSession session = new TaskSession(new SimpleTaskContextProperties(), args, targetTree)) { BuildTargets.FillDefaultProperties(session); session.Start(BuildTargets.OnBuildFinished); session.AddLogger(new MulticoloredConsoleLogger(Console.Out)); //session.Properties.Set(BuildProps.TargetDotNetVersion, "v4.0.30319"); //session.Properties.Set(BuildProps.TargetDotNetVersionForGallio, "v4.0.30319"); session.Properties.Set(BuildProps.CompanyName, CompanyName); session.Properties.Set(BuildProps.CompanyCopyright, CompanyCopyright); session.Properties.Set(BuildProps.GallioEchoPath, "lib/Gallio-3.2.750/bin/Gallio.Echo.exe"); session.Properties.Set(BuildProps.ProductId, "Detergent"); session.Properties.Set(BuildProps.ProductName, "Detergent"); session.Properties.Set(BuildProps.SolutionFileName, "Detergent.2010.sln"); session.Properties.Set(BuildProps.VersionControlSystem, VersionControlSystem.Subversion); try { // actual run if (args.Length == 0) { targetTree.RunTarget(session, targetTree.DefaultTarget.TargetName); } else { string targetName = args[0]; if (false == targetTree.HasTarget(targetName)) { session.WriteError("ERROR: The target '{0}' does not exist", targetName); targetTree.RunTarget(session, "help"); return(2); } targetTree.RunTarget(session, args[0]); } session.Complete(); return(0); } catch (TaskExecutionException) { return(1); } catch (Exception ex) { Console.WriteLine(ex); return(1); } } }