File indexing completed on 2024-05-19 08:30:51
0001 /* 0002 SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef IMAKEBUILDER_H 0008 #define IMAKEBUILDER_H 0009 0010 #include <project/interfaces/iprojectbuilder.h> 0011 0012 #include <QVector> 0013 #include <QStringList> 0014 #include <QPair> 0015 0016 class KJob; 0017 0018 /** 0019 @author Andreas Pakulat 0020 */ 0021 0022 /** 0023 * Used to create make variables of the form KEY=VALUE. 0024 */ 0025 using MakeVariables = QVector<QPair<QString, QString>>; 0026 0027 class IMakeBuilder : public KDevelop::IProjectBuilder 0028 { 0029 public: 0030 0031 ~IMakeBuilder() override = default; 0032 0033 /** 0034 * Return a build job for the given target. 0035 * 0036 * E.g. if @a targetnames is \c 'myModule', the returned job 0037 * will execute the command: 0038 * 0039 * \code make myModule \endcode 0040 * 0041 * The command is executed inside the directory of @a item and uses the 0042 * configuration of its project. 0043 * 0044 * @param item Item of the project to build. 0045 * @param targetname Command-line target name to pass to make. 0046 */ 0047 virtual KJob* executeMakeTarget(KDevelop::ProjectBaseItem* item, 0048 const QString& targetname ) = 0; 0049 0050 /** 0051 * Return a build job for the given targets with optional make variables defined. 0052 * 0053 * E.g. if @a targetnames is \code {'all', 'modules'} \endcode and @a variables is 0054 * \code { 'CFLAGS' : '-Wall', 'CC' : 'gcc-3.4' } \endcode, the returned job should 0055 * execute this command: 0056 * 0057 * \code make CFLAGS=-Wall CC=gcc-3.4 all modules \endcode 0058 * 0059 * The command is executed inside the directory of @a item and uses the 0060 * configuration of its project. 0061 * 0062 * @param item Item of the project to build. 0063 * @param targetnames Optional command-line targets names to pass to make. 0064 * @param variables Optional list of command-line variables to pass to make. 0065 */ 0066 virtual KJob* executeMakeTargets(KDevelop::ProjectBaseItem* item, 0067 const QStringList& targetnames = QStringList(), 0068 const MakeVariables& variables = MakeVariables() ) = 0; 0069 0070 Q_SIGNALS: 0071 /** 0072 * Emitted every time a target is finished being built for a project item. 0073 */ 0074 void makeTargetBuilt( KDevelop::ProjectBaseItem* item, const QString& targetname ); 0075 }; 0076 0077 Q_DECLARE_INTERFACE( IMakeBuilder, "org.kdevelop.IMakeBuilder" ) 0078 0079 #endif 0080