File indexing completed on 2024-05-05 04:39:27
0001 /* 0002 SPDX-FileCopyrightText: 2020 Friedrich W. H. Kossebau <kossebau@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef COMPILEANALYZER_COMPILEANALYZEJOB_H 0008 #define COMPILEANALYZER_COMPILEANALYZEJOB_H 0009 0010 // lib 0011 #include <compileanalyzercommonexport.h> 0012 // KDevPlatform 0013 #include <interfaces/iproblem.h> 0014 #include <outputview/outputexecutejob.h> 0015 // Qt 0016 #include <QRegularExpression> 0017 0018 namespace KDevelop 0019 { 0020 0021 class KDEVCOMPILEANALYZERCOMMON_EXPORT CompileAnalyzeJob : public KDevelop::OutputExecuteJob 0022 { 0023 Q_OBJECT 0024 0025 protected: // API to implement 0026 static QString spaceEscapedString(const QString& s); 0027 0028 public: 0029 explicit CompileAnalyzeJob(QObject* parent = nullptr); 0030 ~CompileAnalyzeJob() override; 0031 0032 public: // KJob API 0033 void start() override; 0034 0035 public: 0036 void setParallelJobCount(int parallelJobCount); 0037 void setBuildDirectoryRoot(const QString& buildDir); 0038 void setCommand(const QString& commandcommand, bool verboseOutput = true); 0039 void setToolDisplayName(const QString& toolDisplayName); 0040 void setSources(const QStringList& sources); 0041 0042 Q_SIGNALS: 0043 void problemsDetected(const QVector<KDevelop::IProblem::Ptr>& problems); 0044 0045 protected Q_SLOTS: 0046 void postProcessStdout(const QStringList& lines) override; 0047 void childProcessExited(int exitCode, QProcess::ExitStatus exitStatus) override; 0048 0049 protected: 0050 void parseProgress(const QStringList& lines); 0051 0052 private: 0053 void generateMakefile(); 0054 0055 private: 0056 QString m_makeFilePath; 0057 QString m_buildDir; 0058 QString m_command; 0059 QString m_toolDisplayName; 0060 QStringList m_sources; 0061 int m_parallelJobCount = 1; 0062 bool m_verboseOutput = true; 0063 0064 int m_finishedCount = 0; 0065 int m_totalCount = 0; 0066 0067 QRegularExpression m_fileStartedRegex; 0068 QRegularExpression m_fileFinishedRegex; 0069 }; 0070 0071 } 0072 0073 #endif