예제 #1
0
        private static void AppendAntFileNodes(Target target, List<XObject> targetDescendants)
        {
            var regex = new Regex(AntFileSpliter, RegexOptions.Compiled);

            var antFileRefs = target.Dependencies.Where(t => regex.IsMatch(t)).Select(t =>
            {
                var match = regex.Match(t);

                return new
                {
                    Resource = match.Groups["importedfile"].Value,
                    Target = match.Groups["target"].Value
                };
            });

            foreach (var antFileRef in antFileRefs)
            {
                var antElement = new XElement("ant", new XAttribute("antfile", antFileRef.Resource));
                if (!string.IsNullOrWhiteSpace(antFileRef.Target))
                {
                    antElement.Add(new XAttribute("target", antFileRef.Target));
                }
                targetDescendants.Add(antElement);
            }
        }
예제 #2
0
 private static void AppendAntCallNodes(Target target, List<XObject> targetDescendants)
 {
     var callees = target.Dependencies.Where( t => t.StartsWith(AntCalMarker) ).Select( t => t.Substring(1) );
     foreach (var callee in callees)
     {
         targetDescendants.Add(new XElement("antcall", new XAttribute("target", callee)));
     }
 }
예제 #3
0
        private static XObject[] CollectDependencies(Target target, List<XObject> targetDescendants)
        {
            AppendAntCallNodes(target, targetDescendants);
            AppendAntFileNodes(target, targetDescendants);

            return targetDescendants.ToArray();
        }
예제 #4
0
        private static XAttribute DependsAttribute(Target t, IFormater formater)
        {
            var referencedByDependsAttr = t.Dependencies.Where(IsExplicitDepencency).Select( d => d.StartsWith("*") ? d.Substring(1) :d );
            if (referencedByDependsAttr.Count() == 0) return null;

            return new XAttribute("depends", string.Join(",", referencedByDependsAttr.Select(d => TargetNameFromFullQualifiedDependency(d)).Select( n => formater.FormatTargetName(n))) );
        }
예제 #5
0
        private static List<XObject> AttributesFor(Target target, IFormater formater)
        {
            List<XObject> attributes = new List<XObject>();

            attributes.Add(new XAttribute("name", target.Name));

            var dependencies = DependsAttribute(target, formater);
            if (dependencies != null)
            {
                attributes.Add(dependencies);
            }

            return attributes;
        }