File indexing completed on 2024-04-28 04:38:58

0001 /*
0002     SPDX-FileCopyrightText: 2004 Roberto Raggi <roberto@kdevelop.org>
0003     SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de>
0004     SPDX-FileCopyrightText: 2007 Dukju Ahn <dukjuahn@gmail.com>
0005     SPDX-FileCopyrightText: 2008 Hamish Rodda <rodda@kde.org>
0006     SPDX-FileCopyrightText: 2012 Ivan Shapovalov <intelfx100@gmail.com>
0007 
0008     SPDX-License-Identifier: LGPL-2.0-or-later
0009 */
0010 
0011 #ifndef MAKEJOB_H
0012 #define MAKEJOB_H
0013 
0014 #include <outputview/outputexecutejob.h>
0015 
0016 #include <QString>
0017 
0018 #include "imakebuilder.h"
0019 
0020 namespace KDevelop {
0021 class ProjectBaseItem;
0022 }
0023 
0024 class QUrl;
0025 
0026 class MakeJob: public KDevelop::OutputExecuteJob
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     enum CommandType
0032     {
0033         BuildCommand,
0034         CleanCommand,
0035         CustomTargetCommand,
0036         InstallCommand
0037     };
0038 
0039     enum ErrorTypes
0040     {
0041         IncorrectItemError = UserDefinedError,
0042         ItemNoLongerValidError,
0043         BuildCommandError,
0044         FailedError = FailedShownError
0045     };
0046 
0047     MakeJob( QObject* parent, KDevelop::ProjectBaseItem* item,
0048              CommandType command, const QStringList& overrideTargets = QStringList(),
0049              const MakeVariables& variables = MakeVariables() );
0050     ~MakeJob() override;
0051 
0052     void start() override;
0053 
0054     KDevelop::ProjectBaseItem* item() const;
0055     CommandType commandType() const;
0056     QStringList customTargets() const;
0057 
0058 
0059     // This returns the build directory for registered item.
0060     QUrl workingDirectory() const override;
0061 
0062     // This returns the "make" command line.
0063     QStringList commandLine() const override;
0064 
0065     // This returns the configured privileged execution command (if specified by user).
0066     QStringList privilegedExecutionCommand() const override;
0067 
0068     // This returns the configured global environment profile.
0069     QString environmentProfile() const override;
0070 
0071 private:
0072     static bool isNMake(const QString& makeBin);
0073     
0074     QPersistentModelIndex m_idx;
0075     CommandType m_command;
0076     QStringList m_overrideTargets;
0077     MakeVariables m_variables;
0078 };
0079 
0080 #endif // MAKEJOB_H
0081