private void GenerateProjectFile(object arg) { KeyValuePair <string, List <Project.Configuration> > pair = (KeyValuePair <string, List <Project.Configuration> >)arg; string projectFile = pair.Key; List <Project.Configuration> configurations = pair.Value; Project.Configuration firstConf = configurations.FirstOrDefault(); Project project = firstConf.Project; using (new Util.StopwatchProfiler(ms => { ProfileWriteLine(" |{0,5} ms| generate project file {1}", ms, firstConf.ProjectFileName); })) { GenerationOutput output = new GenerationOutput(); try { DevEnv devEnv = configurations[0].Target.GetFragment <DevEnv>(); for (int i = 0; i < configurations.Count; ++i) { Project.Configuration conf = pair.Value[i]; if (devEnv != conf.Target.GetFragment <DevEnv>()) { throw new Error("Multiple generator cannot output to the same file:" + Environment.NewLine + "\tBoth {0} and {1} try to generate {2}", devEnv, conf.Target.GetFragment <DevEnv>(), projectFile); } } if (project.SourceFilesFilters == null || (project.SourceFilesFiltersCount != 0 && !project.SkipProjectWhenFiltersActive)) { if (project is CSharpProject) { _getGeneratorsManagerCallBack().Generate(this, (CSharpProject)project, configurations, projectFile, output.Generated, output.Skipped); } else if (project is PythonProject) { _getGeneratorsManagerCallBack().Generate(this, (PythonProject)project, configurations, projectFile, output.Generated, output.Skipped); } else { _getGeneratorsManagerCallBack().Generate(this, project, configurations, projectFile, output.Generated, output.Skipped); } } } catch (Exception ex) { output.Exception = ex; } GenerationOutput allOutput = _generationReport.GetOrAdd(project.GetType(), output); if (allOutput != output) { lock (allOutput) allOutput.Merge(output); } } }
public void Merge(GenerationOutput other) { Generated.AddRange(other.Generated); Skipped.AddRange(other.Skipped); if (_exception == null) { _exception = other._exception; } }
private void GenerateSolutionFile(object arg) { var pair = (KeyValuePair <string, List <Solution.Configuration> >)arg; string solutionFile = pair.Key; List <Solution.Configuration> configurations = pair.Value; Solution.Configuration firstConf = configurations.FirstOrDefault(); Solution solution = firstConf.Solution; using (new Util.StopwatchProfiler(ms => { ProfileWriteLine(" |{0,5} ms| generate solution file {1}", ms, firstConf.SolutionFileName); })) { GenerationOutput output = new GenerationOutput(); try { DevEnv devEnv = configurations[0].Target.GetFragment <DevEnv>(); for (int i = 0; i < configurations.Count; ++i) { Solution.Configuration conf = pair.Value[i]; if (devEnv != conf.Target.GetFragment <DevEnv>()) { throw new Error("Multiple generator cannot output to the same file:" + Environment.NewLine + "\t'{0}' and '{1}' try to generate '{2}'", devEnv, conf.Target.GetFragment <DevEnv>(), solutionFile); } } _getGeneratorsManagerCallBack().Generate(this, solution, configurations, solutionFile, output.Generated, output.Skipped); } catch (Exception ex) { output.Exception = ex; } GenerationOutput allOutput = _generationReport.GetOrAdd(solution.GetType(), output); if (allOutput != output) { lock (allOutput) allOutput.Merge(output); } } }
public void ReportGenerated(Type t, GenerationOutput output) { var generationOutput = _generationReport.GetValueOrAdd(t, new GenerationOutput()); generationOutput.Merge(output); }