public static CreateTree ( ITarget target ) : IList |
||
target | ITarget | |
return | IList |
public string CreateConstructor() { var sb = new StringBuilder(); sb.AppendLine("\t\tpublic Default()"); sb.AppendLine("\t\t{"); foreach (var property in _project.Properties) { sb.AppendFormat("\t\t\t{0}{1}", CreatePropertySetter(property.Value), Environment.NewLine); } sb.AppendLine(); sb.Append( "\t\t\t//TODO: Correct Order. The task order is generated in the order they are found in the file (which is probably not the order they need to be run in)"); sb.AppendLine(); var defaultTarget = _project.Targets.Select(x => x).Where(x => x.Name == _project.DefaultTarget).First(); foreach (var target in TargetTreeBuilder.CreateTree(defaultTarget)) { sb.AppendFormat("\t\t\tAddTask({0});{1}", target.Name.ToVariableString(), Environment.NewLine); } sb.AppendLine("\t\t}"); return(sb.ToString()); }
public void TwoDepencanciesOnCleanShouldWork() { //default needs clean and compile //compile also needs clean var defaultTarget = new Target() { Name = "BuildAll" }; var compileTarget = new Target() { Name = "Compile" }; var cleanTarget = new Target() { Name = "Clean" }; compileTarget.DependsOn.Add(cleanTarget); defaultTarget.DependsOn.Add(cleanTarget); defaultTarget.DependsOn.Add(compileTarget); var targets = TargetTreeBuilder.CreateTree(defaultTarget); Assert.That(targets[0].Name, Is.EqualTo(cleanTarget.Name)); Assert.That(targets[1].Name, Is.EqualTo(compileTarget.Name)); Assert.That(targets[2].Name, Is.EqualTo(defaultTarget.Name)); }
public void NestedDepencanciesShouldWork() { //default needs compile which needs clean var defaultTarget = new Target() { Name = "BuildAll" }; var compileTarget = new Target() { Name = "Compile" }; var cleanTarget = new Target() { Name = "Clean" }; compileTarget.DependsOn.Add(cleanTarget); defaultTarget.DependsOn.Add(compileTarget); var targets = TargetTreeBuilder.CreateTree(defaultTarget); Assert.That(targets[0], Is.EqualTo(cleanTarget)); Assert.That(targets[1], Is.EqualTo(compileTarget)); Assert.That(targets[2], Is.EqualTo(defaultTarget)); }
public void TestSimpleDependancy() { var defaultTarget = new Target() { Name = "BuildAll" }; var cleanTarget = new Target() { Name = "Clean" }; defaultTarget.DependsOn.Add(cleanTarget); var targets = TargetTreeBuilder.CreateTree(defaultTarget); Assert.That(targets[0], Is.EqualTo(cleanTarget)); Assert.That(targets[1], Is.EqualTo(defaultTarget)); }