Exemplo n.º 1
0
        public IDictionary <Type, GenerationOutput> Generate()
        {
            Link();

            if (Context.WriteLog)
            {
                WriteLogs();
            }

            LogWriteLine("  generating projects and solutions...");
            using (new Util.StopwatchProfiler(ms => { LogWriteLine("    generation done in {0:0.0} sec", ms / 1000.0f); }))
            {
                var projects  = new List <Project>(_projects.Values);
                var solutions = new List <Solution>(_solutions.Values);

                // Append generated projects, if any
                projects.AddRange(_generatedProjects);

                // Pre event
                if (EventPreGeneration != null)
                {
                    using (new Util.StopwatchProfiler(ms => { LogWriteLine("    pre-generation steps took {0:0.0} sec", ms / 1000.0f); }, minThresholdMs: 100))
                        EventPreGeneration.Invoke(projects, solutions);
                }

                // start with huge solutions to balance task with small one at the end.
                solutions.Sort((s0, s1) => s1.Configurations.Count.CompareTo(s0.Configurations.Count));
                foreach (Solution solution in solutions)
                {
                    Generate(solution);
                }

                DetermineUsedProjectConfigurations(solutions);

                // start with huge projects to balance task with small one at the end.
                projects.Sort((p0, p1) => p1.ProjectFilesMapping.Count.CompareTo(p0.ProjectFilesMapping.Count));
                foreach (Project project in projects)
                {
                    Generate(project);
                }

                if (_multithreaded)
                {
                    _tasks.Wait();
                }

                // Post events
                if (EventPostGeneration != null || EventPostGenerationReport != null)
                {
                    using (new Util.StopwatchProfiler(ms => { LogWriteLine("    post-generation steps took {0:0.0} sec", ms / 1000.0f); }, minThresholdMs: 100))
                    {
                        EventPostGeneration?.Invoke(projects, solutions);
                        EventPostGenerationReport?.Invoke(projects, solutions, _generationReport);
                    }
                }

                return(_generationReport);
            }
        }
Exemplo n.º 2
0
        public IDictionary <Type, GenerationOutput> Generate()
        {
            Link();

            if (Context.WriteLog)
            {
                WriteLogs();
            }

            LogWriteLine("  generating projects and solutions...");
            using (new Util.StopwatchProfiler(ms => { LogWriteLine("    generation done done in {0:0.0} sec", ms / 1000.0f); }))
            {
                var projects  = new List <Project>(_projects.Values);
                var solutions = new List <Solution>(_solutions.Values);

                // Pre event
                EventPreGeneration?.Invoke(projects, solutions);

                // start with huge solutions to balance task with small one at the end.
                solutions.Sort((s0, s1) => s1.Configurations.Count.CompareTo(s0.Configurations.Count));
                foreach (Solution solution in solutions)
                {
                    Generate(solution);
                }

                // start with huge projects to balance task with small one at the end.
                projects.Sort((p0, p1) => p1.ProjectFilesMapping.Count.CompareTo(p0.ProjectFilesMapping.Count));
                foreach (Project project in projects)
                {
                    Generate(project);
                }

                if (_multithreaded)
                {
                    _tasks.Wait();
                }

                // Post events
                EventPostGeneration?.Invoke(projects, solutions);
                EventPostGenerationReport?.Invoke(projects, solutions, _generationReport);

                return(_generationReport);
            }
        }