File indexing completed on 2024-05-05 04:40:08
0001 /* 0002 SPDX-FileCopyrightText: 2018 Daniel Mensinger <daniel@mensinger-ka.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "mesonjob.h" 0008 0009 #include "mesonconfig.h" 0010 0011 #include <interfaces/iproject.h> 0012 #include <project/projectmodel.h> 0013 0014 #include <KLocalizedString> 0015 0016 using namespace KDevelop; 0017 0018 MesonJob::MesonJob(const Meson::BuildDir& buildDir, IProject* project, MesonJob::CommandType commandType, 0019 const QStringList& arguments, QObject* parent) 0020 : OutputExecuteJob(parent) 0021 , m_project(project) 0022 , m_commandType(commandType) 0023 , m_arguments(arguments) 0024 { 0025 Q_ASSERT(m_project); 0026 0027 setToolTitle(i18n("Meson")); 0028 setCapabilities(Killable); 0029 setStandardToolView(KDevelop::IOutputView::BuildView); 0030 setBehaviours(KDevelop::IOutputView::AllowUserClose | KDevelop::IOutputView::AutoScroll); 0031 setProperties(NeedWorkingDirectory | PortableMessages | DisplayStdout | DisplayStderr); 0032 0033 *this << buildDir.mesonExecutable.toLocalFile(); 0034 0035 switch (m_commandType) { 0036 case CONFIGURE: 0037 *this << QStringLiteral("setup") << QStringLiteral("--backend") << buildDir.mesonBackend; 0038 break; 0039 case RE_CONFIGURE: 0040 *this << QStringLiteral("setup") << QStringLiteral("--reconfigure"); 0041 break; 0042 case SET_CONFIG: 0043 *this << QStringLiteral("configure"); 0044 break; 0045 } 0046 0047 *this << m_arguments; 0048 0049 for (auto i : buildDir.mesonArgs.split(QLatin1Char(' '))) { 0050 if (!i.isEmpty()) { 0051 *this << i; 0052 } 0053 } 0054 0055 *this << buildDir.buildDir.toLocalFile(); 0056 } 0057 0058 QUrl MesonJob::workingDirectory() const 0059 { 0060 return m_project->path().toUrl(); 0061 } 0062 0063 #include "moc_mesonjob.cpp"