public static void CreateCompilationDatabase(AsyncPackage package, string compileCommand) { ThreadHelper.ThrowIfNotOnUIThread(); var myOutput = new ExtensionOutput(package, "CLang Output", ExtensionOutput.DefaultOutputWindowGuid); var dteService = package.GetService <EnvDTE.DTE, EnvDTE.DTE>(); var cppSupport = new CppProject(dteService); var project = cppSupport.GetProjectFromSelected(); if (project == null) { return; } cppSupport.Save(project); // ensure that project is saved before we do anything var hierarchy = cppSupport.ToHierarchy(project as EnvDTE.Project); var visitor = new CompilationDatabaseVisitor(myOutput, cppSupport, compileCommand); cppSupport.VisitHierarchy(hierarchy, visitor); var directory = new FileInfo(project.FileName).DirectoryName; var outputFile = GetCompileDatabasePath(directory); string compileDatabase = JsonConvert.SerializeObject(visitor.CompileDatabase); File.WriteAllText(outputFile, compileDatabase); }
public ExecuteShellCommand(ExtensionOutput output, AnalysisOutputParser p) { m_output = output; m_errorProvider = p; }
public CompilationDatabaseVisitor(ExtensionOutput output, CppProject project, string compileCommand) { m_output = output; m_project = project; m_compileCommand = compileCommand; }