public Target AddTarget(string name) { var target = new Target(name, resource); targets[name] = target; return target; }
private static void ProcessAntFile(GraphBuildContext context, Target target, XElement targetElement) { var calls = targetElement.Descendants("ant"); foreach (var call in calls) { var calledTarget = ResolveTarget(context, ResolveTargetElement(context, SafeAttribute(call, "antfile"), SafeAttribute(call, "target"))); target.AddDependency(calledTarget, ">"); } }
private static void ProcessAntCalls(GraphBuildContext context, Target target, XElement targetElement) { var calls = targetElement.Descendants("antcall"); foreach (var call in calls) { var calledTarget = ResolveTarget(context, targetElement.Document.FindTarget(call.Attribute("target").Value)); target.AddDependency(calledTarget, "+"); } }
private static void ProcessDependencies(GraphBuildContext context, Target target, XElement targetElement) { var dependencies = SafeAttribute(targetElement, "depends"); if (string.IsNullOrWhiteSpace(dependencies)) return; foreach (var dependency in dependencies.Split(',').Select(d => d.Trim())) { context.PushScript(); var targetDependency = context.FindTarget(dependency) ?? ResolveTarget(context, ResolveTargetElement(context, targetElement.Document, dependency)); context.PopScript(); target.AddDependency(targetDependency); } }
public void TestInvalidNamesAreNormalized() { var output = new TestValidationWriter(); var identifierWithDot = "bla.xml"; var identifierWithDash = "t-1"; var visitor = new DotBuilderVisitor(identifierWithDot, output); visitor.PreVisit(new BuildScriptGraph(new[] { new BuildScript(identifierWithDot) })); var target = new Target(identifierWithDash, ""); visitor.PreVisit(target); visitor.Visit(new TargetDependency(target)); output.AssertNotContains(identifierWithDot); output.AssertNotContains(identifierWithDash); }
public void AddDependency(Target target, string type=null) { dependencies.Add(new TargetDependency(target, type)); }
public void PreVisit(Target target) { targetChain.Push(target); }
public void PostVisit(Target target) { targets.Add(targetChain.Pop()); }
public TargetDependency(Target target, string type = null) { Target = target; Type = type ?? string.Empty; }