Ejemplo n.º 1
0
        public Target AddTarget(string name)
        {
            var target = new Target(name, resource);
            targets[name] = target;

            return target;
        }
Ejemplo n.º 2
0
 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, ">");
     }
 }
Ejemplo n.º 3
0
 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, "+");
     }
 }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 public void AddDependency(Target target, string type=null)
 {
     dependencies.Add(new TargetDependency(target, type));
 }
Ejemplo n.º 7
0
 public void PreVisit(Target target)
 {
     targetChain.Push(target);
 }
Ejemplo n.º 8
0
 public void PostVisit(Target target)
 {
     targets.Add(targetChain.Pop());
 }
Ejemplo n.º 9
0
 public TargetDependency(Target target, string type = null)
 {
     Target = target;
     Type = type ?? string.Empty;
 }