コード例 #1
0
ファイル: DependencyTracker.cs プロジェクト: Vazquinhos/EXON
        public void AddDependency(
            DependencyType dependencyType,
            Project projectFrom,
            Project.Configuration configFrom,
            IEnumerable <KeyValuePair <Type, ITarget> > dependencies,
            IDictionary <KeyValuePair <Type, ITarget>, DependencySetting> dependenciesSetting
            )
        {
            lock (this)
            {
                foreach (KeyValuePair <Type, ITarget> pair in dependencies)
                {
                    TrackedConfiguration confFrom = FindConfiguration(projectFrom, configFrom);
                    TrackedConfiguration confTo   = FindConfiguration(pair.Key, pair.Value);

                    DependencySetting dependencySetting;
                    if (!dependenciesSetting.TryGetValue(pair, out dependencySetting))
                    {
                        dependencySetting = DependencySetting.Default;
                    }

                    confFrom.AddDependency(confTo, dependencyType, dependencySetting);
                }
            }
        }
コード例 #2
0
ファイル: DependencyTracker.cs プロジェクト: Vazquinhos/EXON
        private void WriteGraph(StreamWriter stream, TrackedConfiguration root, string externStructName, bool verboseEdges, bool verboseNodes, ResetVisitDelegate ResetVisit)
        {
            try
            {
                ResetVisit();
                root.WriteNodeDescription(stream, false, verboseNodes, "");

                ResetVisit();
                root.WriteNodeDescription(stream, true, verboseNodes, "");

                stream.WriteLine();

                ResetVisit();
                root.WriteDependencies(stream, verboseEdges, "");
                stream.WriteLine();
            }
            catch (Exception e)
            {
                System.Diagnostics.Trace.WriteLine(e);
            }
        }
コード例 #3
0
ファイル: DependencyTracker.cs プロジェクト: Vazquinhos/EXON
        public void DumpGraphs(IDictionary <Type, GenerationOutput> outputs)
        {
            lock (this)
            {
                var dependencyOutput = outputs.GetValueOrAdd(typeof(DependencyTracker), new GenerationOutput());
                foreach (KeyValuePair <string, TrackedProject> pair in _projects)
                {
                    TrackedProject p = pair.Value;
                    foreach (KeyValuePair <string, TrackedConfiguration> confPair in p.Configurations)
                    {
                        TrackedConfiguration c = confPair.Value;
                        if (!c.DumpDependencyGraph())
                        {
                            continue;
                        }

                        string fileName = @"Dependencies ("
                                          + c.GetDisplayedName(false)
                                          + ", "
                                          + c.GetConfigName()
                                          + (DependencyTracker.ShowDependenciesFromExtern ? "" : " [excl from Extern]")
                                          + (DependencyTracker.ShowDependenciesToExtern ? "" : " [excl to Extern]")
                                          + ").gv";
                        // Open the stream and read it back.

                        MemoryStream memoryStream = new MemoryStream();
                        StreamWriter writer       = new StreamWriter(memoryStream);

                        writer.WriteLine("digraph g");
                        writer.WriteLine("{");

                        writer.WriteLine("graph [rankdir = \"TD\" bgcolor = \"lightblue:black\" style=\"filled\" gradientangle = 270 splines=true];");

                        WriteGraph(writer, c, "extStruct", false, false, () =>
                        {
                            foreach (KeyValuePair <string, TrackedProject> proj in _projects)
                            {
                                proj.Value.ResetVisit();
                            }
                        }
                                   );

                        if (GraphWriteLegend)
                        {
                            WriteLegend(writer);
                        }

                        writer.WriteLine("}");
                        writer.Flush();

                        var  outputFileInfo = new FileInfo(fileName);
                        bool written        = Builder.Instance.Context.WriteGeneratedFile(typeof(DependencyTracker), outputFileInfo, memoryStream);
                        if (written)
                        {
                            dependencyOutput.Generated.Add(outputFileInfo.FullName);
                        }
                        else
                        {
                            dependencyOutput.Skipped.Add(outputFileInfo.FullName);
                        }
                    }
                }
            }
        }