public void BuildProjectWith1TargetWhichDependsOn1TargetWhichErrors() { ProjectDefinition project1 = new ProjectDefinition(FullProjectPath("1.proj")); TargetDefinition target1 = new TargetDefinition("Target1", null, "Target2", project1.ProjectXmlDocument); TargetDefinition target2 = new TargetDefinition("Target2", null, project1.ProjectXmlDocument); TaskDefinition task1 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); TaskDefinition task2 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetStopWithErrorResult()); target1.AddTask(task1); target2.AddTask(task2); project1.AddTarget(target1); project1.AddTarget(target2); RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), "2.0", new string[1] { "Target1" }, null, 100, null, (IBuildComponentHost)_commonTests.Host); test1.ProjectDefinition = project1; test1.SubmitBuildRequest(); task2.WaitForTaskToComplete(); test1.WaitForResults(); test1.ValidateNonPrimaryTargetEndResult("Target2", TargetResultCode.Failure, null); test1.ValidateTargetEndResult("Target1", TargetResultCode.Failure, null); }
public void BuildDependentTargetWithFalseCondition() { ProjectDefinition project1 = new ProjectDefinition(FullProjectPath("1.proj")); TargetDefinition target1 = new TargetDefinition("Target1", null, "Target2", project1.ProjectXmlDocument); TargetDefinition target2 = new TargetDefinition("Target2", @"'1' == '2'", project1.ProjectXmlDocument); TaskDefinition task1 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); TaskDefinition task2 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); target1.AddTask(task1); target2.AddTask(task2); project1.AddTarget(target1); project1.AddTarget(target2); RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), "2.0", new string[1] { "Target1" }, null, 100, null, (IBuildComponentHost)this.commonTests.Host); test1.ProjectDefinition = project1; test1.SubmitBuildRequest(); task1.WaitForTaskToComplete(); test1.WaitForResults(); test1.ValidateTargetBuilt("Target1"); test1.ValidateNonPrimaryTargetEndResult("Target2", TargetResultCode.Skipped, null); test1.ValidateTargetEndResult("Target1", TargetResultCode.Success, null); }
public void TasksContinueToExecuteAfterContinueOnError() { ProjectDefinition project1 = new ProjectDefinition(FullProjectPath("1.proj")); TargetDefinition target1 = new TargetDefinition("Target1", null, "Target2", project1.ProjectXmlDocument); TargetDefinition target2 = new TargetDefinition("Target2", null, project1.ProjectXmlDocument); TaskDefinition task1 = new TaskDefinition("t1-1", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); TaskDefinition task2 = new TaskDefinition("t2-1", null, false, project1.ProjectXmlDocument, TestUtilities.GetContinueWithErrorResult()); TaskDefinition task3 = new TaskDefinition("t2-2", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); target1.AddTask(task1); target2.AddTask(task2); target2.AddTask(task3); project1.AddTarget(target1); project1.AddTarget(target2); RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), "2.0", new string[1] { "Target1" }, null, 100, null, (IBuildComponentHost)_commonTests.Host); test1.ProjectDefinition = project1; test1.SubmitBuildRequest(); task2.WaitForTaskToComplete(); task1.WaitForTaskToComplete(); test1.WaitForResults(); test1.ValidateNonPrimaryTargetEndResult("Target2", TargetResultCode.Success, null); test1.ValidateTargetEndResult("Target1", TargetResultCode.Success, null); }
public void Build1ProjectWith2TargetAnd1TaskEach() { RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), "2.0", new string[2] { "Target1", "Target2" }, null, 100, null, (IBuildComponentHost)_commonTests.Host); ProjectDefinition project1 = test1.ProjectDefinition; TargetDefinition target1 = new TargetDefinition("Target1", project1.ProjectXmlDocument); TargetDefinition target2 = new TargetDefinition("Target2", project1.ProjectXmlDocument); TaskDefinition task1 = new TaskDefinition("Task1", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); TaskDefinition task2 = new TaskDefinition("Task2", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); target1.AddTask(task1); target1.AddTask(task2); project1.AddTarget(target1); project1.AddTarget(target2); test1.SubmitBuildRequest(); task1.WaitForTaskToComplete(); task2.WaitForTaskToComplete(); test1.WaitForResults(); test1.ValidateTargetBuilt("Target1"); test1.ValidateTargetBuilt("Target2"); test1.ValidateTargetEndResult("Target1", TargetResultCode.Success, null); test1.ValidateTargetEndResult("Target2", TargetResultCode.Success, null); }
public void Build1ProjectWith1TargetAnd2Task() { RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), (IBuildComponentHost)_commonTests.Host); ProjectDefinition project1 = test1.ProjectDefinition; TargetDefinition target1 = new TargetDefinition(RequestDefinition.defaultTargetName, project1.ProjectXmlDocument); TaskDefinition task1 = new TaskDefinition("task1", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); TaskDefinition task2 = new TaskDefinition("task2", null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); target1.AddTask(task1); target1.AddTask(task2); project1.AddTarget(target1); test1.SubmitBuildRequest(); task1.WaitForTaskToComplete(); task2.WaitForTaskToComplete(); test1.WaitForResults(); test1.ValidateTargetBuilt(RequestDefinition.defaultTargetName); test1.ValidateTargetEndResult(RequestDefinition.defaultTargetName, TargetResultCode.Success, null); }
public void TargetDependencyChain2() { ProjectDefinition project1 = new ProjectDefinition(FullProjectPath("1.proj")); TargetDefinition target1 = new TargetDefinition("Target1", null, "Target2;Target3", project1.ProjectXmlDocument); TargetDefinition target2 = new TargetDefinition("Target2", null, null, project1.ProjectXmlDocument); TargetDefinition target3 = new TargetDefinition("Target3", null, "Target4", project1.ProjectXmlDocument); TargetDefinition target4 = new TargetDefinition("Target4", null, null, project1.ProjectXmlDocument); TaskDefinition task1 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); TaskDefinition task2 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); TaskDefinition task3 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); TaskDefinition task4 = new TaskDefinition(RequestDefinition.defaultTaskName, null, false, project1.ProjectXmlDocument, TestUtilities.GetSuccessResult()); RequestDefinition test1 = new RequestDefinition(FullProjectPath("1.proj"), "2.0", new string[1] { "Target1" }, null, 100, null, (IBuildComponentHost)_commonTests.Host); target1.AddTask(task1); target2.AddTask(task2); target3.AddTask(task3); target4.AddTask(task4); project1.AddTarget(target1); project1.AddTarget(target2); project1.AddTarget(target3); project1.AddTarget(target4); test1.ProjectDefinition = project1; test1.SubmitBuildRequest(); task2.WaitForTaskToComplete(); task4.WaitForTaskToComplete(); task3.WaitForTaskToComplete(); task1.WaitForTaskToComplete(); test1.WaitForResults(); test1.ValidateTargetEndResult("Target1", TargetResultCode.Success, null); test1.ValidateNonPrimaryTargetEndResult("Target2", TargetResultCode.Success, null); test1.ValidateNonPrimaryTargetEndResult("Target3", TargetResultCode.Success, null); test1.ValidateNonPrimaryTargetEndResult("Target4", TargetResultCode.Success, null); }