public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); Cake.DeleteFiles("Tests/**/TestResult*.xml"); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { globalInfo.GetDotnetSolution().Test(); }); Task("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .Does(() => { globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Build") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .Does(() => { globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; var solutionFileName = Cake.Environment.WorkingDirectory.GetDirectoryName() + ".sln"; var projects = Cake.ParseSolution(solutionFileName) .Projects .Where(p => !(p is SolutionFolder) && p.Name != "CodeCakeBuilder"); // We do not generate NuGet packages for /Tests projects for this solution. var projectsToPublish = projects .Where(p => !p.Path.Segments.Contains("Tests") && !p.Path.Segments.Contains("Benchmark") && !p.Path.Segments.Contains("Common") && !p.Path.Segments.Contains("ChartsNite.ReplayOrganizer")); SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); StandardGlobalInfo globalInfo = CreateStandardGlobalInfo(gitInfo) .AddNuGet(projectsToPublish) .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { Cake.CleanDirectories(projects.Select(p => p.Path.GetDirectory().Combine("bin"))); Cake.CleanDirectories(projects.Select(p => p.Path.GetDirectory().Combine("obj"))); Cake.CleanDirectories(globalInfo.ReleasesFolder); Cake.DeleteFiles("Tests/**/TestResult*.xml"); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { StandardSolutionBuild(globalInfo, solutionFileName); }); //Task( "Unit-Testing" ) // .IsDependentOn( "Build" ) // .WithCriteria( () => Cake.InteractiveMode() == InteractiveMode.NoInteraction // || Cake.ReadInteractiveOption( "RunUnitTests", "Run Unit Tests?", 'Y', 'N' ) == 'Y' ) // .Does( () => // { // var testProjects = projects.Where( p => p.Name.EndsWith( ".Tests" ) ); // StandardUnitTests( globalInfo, testProjects ); // } ); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Build") .Does(() => { StandardCreateNuGetPackages(globalInfo); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .Does(() => { globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); StandardGlobalInfo globalInfo = CreateStandardGlobalInfo(gitInfo) .AddDotnet() .SetCIBuildTag(); var nuGetType = globalInfo.ArtifactTypes.OfType <NuGetArtifactType>().Single(); //Because this CCB is our reference for the ApplySettings, we must not modify Build.NuGetArtifactType.GetRemoteFeeds //So here we modify the feed. IList <ArtifactFeed> feeds = nuGetType.GetTargetFeeds(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { globalInfo.GetDotnetSolution().Test(); }); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .Does(() => { // Cheat here for this build.cs to avoid changing the default // // protected override IEnumerable<ArtifactFeed> GetRemoteFeeds() // { // yield return new SignatureVSTSFeed( this, "Signature-Code", "CKEnvTest3" ); // } // // that is targeted by the CK.Env.Plugin.NuGetCodeCakeBuilderFolder.AdaptBuildNugetRepositoryForPushFeeds // method. // globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); StandardGlobalInfo globalInfo = CreateStandardGlobalInfo(gitInfo) .AddDotnet() .SetCIBuildTag(); Setup(context => { context.Information("Executed BEFORE the first task."); }); Teardown(context => { context.Information("Executed AFTER the last task."); }); TaskSetup(setupContext => { setupContext.Information($"TaskSetup for Task: {setupContext.Task.Name}"); }); TaskTeardown(teardownContext => { teardownContext.Information($"TaskTeardown for Task: {teardownContext.Task.Name}"); }); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); Cake.DeleteFiles("Tests/**/TestResult*.xml"); }); // Use N as the first answser: this test takes a looong time (why?) // In -autointeraction mode, this will be skipped (unless explicitly asked from the command line). Task("AutoTests") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunAutoTests", "Run Auto Tests (for Dynamic paths)?", 'N', 'Y') == 'Y') .Does(() => { void ShouldFindAutoTestFolderFromDynamicPaths(bool shouldFind) { string[] paths = Cake.Environment.GetEnvironmentVariable("PATH").Split(new char[] { Cake.Environment.Platform.IsUnix() ? ':' : ';' }, StringSplitOptions.RemoveEmptyEntries); // Cake does not normalize the paths to System.IO.Path.DirectorySeparatorChar. We do it here. string af = Cake.Environment.WorkingDirectory.FullPath + "/CodeCakeBuilder/AutoTests".Replace('\\', '/'); bool autoFolder = paths.Select(p => p.Replace('\\', '/')).Contains(af); if (autoFolder != shouldFind) { throw new Exception(shouldFind ? "AutoTests folder should be found." : "AutoTests folder should not be found."); } } void ShouldFindTestTxtFileFromDynamicPaths(bool shouldFind) { string[] paths = Cake.Environment.GetEnvironmentVariable("PATH").Split(new char[] { Cake.Environment.Platform.IsUnix() ? ':' : ';' }, StringSplitOptions.RemoveEmptyEntries); bool findTestTxtFileInPath = paths.Select(p => System.IO.Path.Combine(p, "Test.txt")).Any(f => System.IO.File.Exists(f)); if (findTestTxtFileInPath != shouldFind) { throw new Exception(shouldFind ? "Should find Text.txt file." : "Should not find Test.txt file."); } } if (System.IO.Directory.Exists("CodeCakeBuilder/AutoTests")) { Cake.DeleteDirectory("CodeCakeBuilder/AutoTests", new DeleteDirectorySettings() { Recursive = true, Force = true }); } ShouldFindAutoTestFolderFromDynamicPaths(false); ShouldFindTestTxtFileFromDynamicPaths(false); Cake.CreateDirectory("CodeCakeBuilder/AutoTests/TestDynamic0"); ShouldFindAutoTestFolderFromDynamicPaths(true); ShouldFindTestTxtFileFromDynamicPaths(false); System.IO.File.WriteAllText("CodeCakeBuilder/AutoTests/TestDynamic0/Test.txt", "c"); ShouldFindAutoTestFolderFromDynamicPaths(true); ShouldFindTestTxtFileFromDynamicPaths(true); Cake.DeleteDirectory("CodeCakeBuilder/AutoTests/TestDynamic0", new DeleteDirectorySettings() { Recursive = true, Force = true }); Cake.CreateDirectory("CodeCakeBuilder/AutoTests/Sub/TestDynamicB"); ShouldFindAutoTestFolderFromDynamicPaths(true); ShouldFindTestTxtFileFromDynamicPaths(false); System.IO.File.WriteAllText("CodeCakeBuilder/AutoTests/Sub/TestDynamicB/Test.txt", "c"); ShouldFindTestTxtFileFromDynamicPaths(true); Cake.DeleteDirectory("CodeCakeBuilder/AutoTests", new DeleteDirectorySettings() { Recursive = true, Force = true }); ShouldFindTestTxtFileFromDynamicPaths(false); ShouldFindAutoTestFolderFromDynamicPaths(false); }); Task("Build") .IsDependentOn("Clean") .IsDependentOn("Check-Repository") .IsDependentOn("AutoTests") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Build") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-NuGet-Packages") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .Does(() => { globalInfo.PushArtifacts(); }); Task("Default").IsDependentOn("Push-NuGet-Packages"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { var testProjects = globalInfo.GetDotnetSolution().Projects.Where(p => p.Name.EndsWith(".Tests") && !p.Path.Segments.Contains("Integration")); globalInfo.GetDotnetSolution().Test(); }); Task("Create-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Create-Packages") .Does(() => { globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Packages"); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; var solutionFileName = Cake.Environment.WorkingDirectory.GetDirectoryName() + ".sln"; var projects = Cake.ParseSolution(solutionFileName) .Projects .Where(p => !(p is SolutionFolder) && p.Name != "CodeCakeBuilder"); // We publish .Tests projects for this solution. var projectsToPublish = projects; StandardGlobalInfo globalInfo = CreateStandardGlobalInfo() .AddDotnet() .SetCIBuildTag(); Task("Check-Repository") .Does(() => { globalInfo.TerminateIfShouldStop(); }); Task("Clean") .IsDependentOn("Check-Repository") .Does(() => { globalInfo.GetDotnetSolution().Clean(); Cake.CleanDirectories(globalInfo.ReleasesFolder); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { globalInfo.GetDotnetSolution().Build(); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { globalInfo.GetDotnetSolution().Test(); }); Task("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .IsDependentOn("Unit-Testing") .Does(() => { globalInfo.GetDotnetSolution().Pack(); }); Task("Push-Artifacts") .IsDependentOn("Create-NuGet-Packages") .WithCriteria(() => globalInfo.IsValid) .Does(() => { globalInfo.PushArtifacts(); }); // The Default task for this script can be set here. Task("Default") .IsDependentOn("Push-Artifacts"); }