Exemplo n.º 1
0
 private static void DumpGraph(Stream finalStream, AdjacencyGraph <IBuilder, EquatableEdge <IBuilder> > graph)
 {
     using (var writer = new DotWriter(finalStream))
     {
         writer.Rankdir = "RL";
         writer.WriteGraph(graph.Edges);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Dumps the build context to dot files
        /// </summary>
        /// <param name="builderGraphStream">Stream where the builder graph will be dumped</param>
        /// <param name="rootBuilder">The root builder</param>
        public void Dump(Stream builderGraphStream, IBuilder rootBuilder)
        {
            RunTransformations();

            var graph = builders.ToAdjacencyGraph <IBuilder, EquatableEdge <IBuilder> >();

            graph.RemoveEdgeIf(edge => edge.IsSelfEdge <IBuilder, EquatableEdge <IBuilder> >());

            if (rootBuilder != null)
            {
                RemoveIrrelevantBranches(graph, rootBuilder);
            }

            using (var writer = new DotWriter(builderGraphStream))
            {
                writer.Rankdir = "RL";
                writer.WriteGraph(graph.Edges);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Dumps the build context to dot files
        /// </summary>
        /// <param name="builderGraphStream">Stream where the builder graph will be dumped</param>
        /// <param name="rootBuilder">The root builder</param>
        public void Dump(Stream builderGraphStream, IBuilder rootBuilder)
        {
            RunTransformations();

            var graph = builders.ToAdjacencyGraph<IBuilder, EquatableEdge<IBuilder>>();
            graph.RemoveEdgeIf(edge => edge.IsSelfEdge<IBuilder, EquatableEdge<IBuilder>>());

            if (rootBuilder != null)
                RemoveIrrelevantBranches(graph, rootBuilder);

            using (var writer = new DotWriter(builderGraphStream))
            {
                writer.Rankdir = "RL";
                writer.WriteGraph(graph.Edges);
            }
        }
Exemplo n.º 4
0
 private static void DumpGraph(Stream finalStream, AdjacencyGraph<IBuilder, EquatableEdge<IBuilder>> graph)
 {
     using (var writer = new DotWriter(finalStream))
     {
         writer.Rankdir = "RL";
         writer.WriteGraph(graph.Edges);
     }
 }
Exemplo n.º 5
0
        public bool Run(Core.Model.Suite suite, string[] parameters)
        {
            var effectiveLength = parameters.Length;
            var modulesOnly     = false;

            if (effectiveLength > 0)
            {
                modulesOnly = effectiveLength >= 1 && parameters[effectiveLength - 1] == "--module";
            }

            var modules = suite.Modules;
            var target  = "suite";

            if (modulesOnly && effectiveLength > 1 || (!modulesOnly && effectiveLength > 0))
            {
                var product = parameters[0];
                if (suite.HasProduct(product))
                {
                    target  = product;
                    modules = suite.GetProduct(product).Modules;
                }
                else
                {
                    throw new InvalidCommandParameterException("dependecies", "The given project does not exist");
                }
            }

            try
            {
                using (var writer = new DotWriter(targetRoot.CreateBinaryFile("deps." + target + ".dot")))
                {
                    var edges = new HashSet <EquatableEdge <string> >();

                    writer.Rankdir         = "LR";
                    writer.RemoveSelfLoops = true;

                    foreach (var module in modules)
                    {
                        foreach (var project in module.Projects)
                        {
                            foreach (var reference in project.References)
                            {
                                EquatableEdge <string> edge = null;
                                if (modulesOnly)
                                {
                                    edge = GetModuleEdge(reference, project);
                                }
                                else
                                {
                                    edge = GetProjectEdge(reference, project);
                                }

                                if (edge != null)
                                {
                                    edges.Add(edge);
                                }
                            }
                        }
                    }
                    writer.WriteGraph(edges);
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }