forked from qt-creator/qt-creator
Meson: Merge the tool wrapper files
Change-Id: I055006e29ee8c2067275e64043c7a7ffcc460390 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -37,13 +37,10 @@ add_qtc_plugin(MesonProjectManager
|
||||
mesonrunconfiguration.h
|
||||
mesontools.cpp
|
||||
mesontools.h
|
||||
mesonwrapper.cpp
|
||||
mesonwrapper.h
|
||||
ninjabuildstep.cpp
|
||||
ninjabuildstep.h
|
||||
ninjaparser.cpp
|
||||
ninjaparser.h
|
||||
ninjawrapper.h
|
||||
projecttree.cpp
|
||||
projecttree.h
|
||||
resources_meson.qrc
|
||||
@@ -84,9 +81,6 @@ add_qtc_test(tst_mesonwrapper
|
||||
TEST_RELATIVE_LIBEXEC_PATH="${TEST_RELATIVE_LIBEXEC_PATH}"
|
||||
SOURCES
|
||||
tests/testmesonwrapper.cpp
|
||||
mesonwrapper.cpp
|
||||
mesonwrapper.h
|
||||
ninjawrapper.h
|
||||
toolwrapper.h
|
||||
toolwrapper.cpp
|
||||
mesontools.h
|
||||
@@ -105,9 +99,6 @@ add_qtc_test(tst_mesoninfoparser
|
||||
TEST_RELATIVE_LIBEXEC_PATH="${TEST_RELATIVE_LIBEXEC_PATH}"
|
||||
SOURCES
|
||||
tests/testmesoninfoparser.cpp
|
||||
mesonwrapper.cpp
|
||||
mesonwrapper.h
|
||||
ninjawrapper.h
|
||||
toolwrapper.h
|
||||
toolwrapper.cpp
|
||||
mesontools.h
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "mesonbuildsystem.h"
|
||||
#include "mesonpluginconstants.h"
|
||||
#include "mesonprojectmanagertr.h"
|
||||
#include "mesonwrapper.h"
|
||||
#include "ninjabuildstep.h"
|
||||
|
||||
#include <coreplugin/find/itemviewfind.h>
|
||||
|
||||
@@ -20,9 +20,6 @@ Project {
|
||||
files: [
|
||||
"mesontools.cpp",
|
||||
"mesontools.h",
|
||||
"mesonwrapper.cpp",
|
||||
"mesonwrapper.h",
|
||||
"ninjawrapper.h",
|
||||
"toolwrapper.cpp",
|
||||
"toolwrapper.h",
|
||||
"kitdata.h",
|
||||
@@ -94,9 +91,6 @@ Project {
|
||||
cpp.includePaths: "."
|
||||
|
||||
files: [
|
||||
"mesonwrapper.cpp",
|
||||
"mesonwrapper.h",
|
||||
"ninjawrapper.h",
|
||||
"toolwrapper.h",
|
||||
"toolwrapper.cpp",
|
||||
"mesontools.h",
|
||||
@@ -114,9 +108,6 @@ Project {
|
||||
cpp.includePaths: "."
|
||||
|
||||
files: [
|
||||
"mesonwrapper.cpp",
|
||||
"mesonwrapper.h",
|
||||
"ninjawrapper.h",
|
||||
"toolwrapper.h",
|
||||
"toolwrapper.cpp",
|
||||
"mesontools.h",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "mesoninfoparser.h"
|
||||
#include "mesonoutputparser.h"
|
||||
#include "mesonprojectnodes.h"
|
||||
#include "mesonwrapper.h"
|
||||
#include "toolwrapper.h"
|
||||
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mesonwrapper.h"
|
||||
#include "ninjawrapper.h"
|
||||
#include "toolwrapper.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
// Copyright (C) 2020 Alexis Jeandet.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "mesonwrapper.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
namespace {
|
||||
template<typename First>
|
||||
void impl_option_cat(QStringList &list, const First &first)
|
||||
{
|
||||
list.append(first);
|
||||
}
|
||||
|
||||
template<typename First, typename... T>
|
||||
void impl_option_cat(QStringList &list, const First &first, const T &...args)
|
||||
{
|
||||
impl_option_cat(list, first);
|
||||
impl_option_cat(list, args...);
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
QStringList options_cat(const T &...args)
|
||||
{
|
||||
QStringList result;
|
||||
impl_option_cat(result, args...);
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
namespace MesonProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
Command MesonWrapper::setup(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory,
|
||||
const QStringList &options) const
|
||||
{
|
||||
return {m_exe,
|
||||
sourceDirectory,
|
||||
options_cat("setup", options, sourceDirectory.toString(), buildDirectory.toString())};
|
||||
}
|
||||
|
||||
Command MesonWrapper::configure(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory,
|
||||
const QStringList &options) const
|
||||
{
|
||||
if (!isSetup(buildDirectory))
|
||||
return setup(sourceDirectory, buildDirectory, options);
|
||||
return {m_exe, buildDirectory, options_cat("configure", options, buildDirectory.toString())};
|
||||
}
|
||||
|
||||
Command MesonWrapper::regenerate(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory) const
|
||||
{
|
||||
return {m_exe,
|
||||
buildDirectory,
|
||||
options_cat("--internal",
|
||||
"regenerate",
|
||||
sourceDirectory.toString(),
|
||||
buildDirectory.toString(),
|
||||
"--backend",
|
||||
"ninja")};
|
||||
}
|
||||
|
||||
Command MesonWrapper::introspect(const Utils::FilePath &sourceDirectory) const
|
||||
{
|
||||
return {m_exe,
|
||||
sourceDirectory,
|
||||
{"introspect", "--all", QString("%1/meson.build").arg(sourceDirectory.toString())}};
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace MesonProjectManager
|
||||
@@ -1,110 +0,0 @@
|
||||
// Copyright (C) 2020 Alexis Jeandet.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mesonpluginconstants.h"
|
||||
#include "toolwrapper.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/id.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QTemporaryFile>
|
||||
|
||||
#include <optional>
|
||||
#include <tuple>
|
||||
|
||||
namespace MesonProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
template<typename File_t>
|
||||
bool containsFiles(const QString &path, const File_t &file)
|
||||
{
|
||||
return QFileInfo::exists(QString("%1/%2").arg(path).arg(file));
|
||||
}
|
||||
|
||||
template<typename File_t, typename... T>
|
||||
bool containsFiles(const QString &path, const File_t &file, const T &...files)
|
||||
{
|
||||
return containsFiles(path, file) && containsFiles(path, files...);
|
||||
}
|
||||
|
||||
inline bool run_meson(const Command &command, QIODevice *output = nullptr)
|
||||
{
|
||||
Utils::Process process;
|
||||
process.setWorkingDirectory(command.workDir());
|
||||
process.setCommand(command.cmdLine());
|
||||
process.start();
|
||||
if (!process.waitForFinished())
|
||||
return false;
|
||||
if (output) {
|
||||
output->write(process.rawStdOut());
|
||||
}
|
||||
return process.exitCode() == 0;
|
||||
}
|
||||
|
||||
inline bool isSetup(const Utils::FilePath &buildPath)
|
||||
{
|
||||
using namespace Utils;
|
||||
return containsFiles(buildPath.pathAppended(Constants::MESON_INFO_DIR).toString(),
|
||||
Constants::MESON_INTRO_TESTS,
|
||||
Constants::MESON_INTRO_TARGETS,
|
||||
Constants::MESON_INTRO_INSTALLED,
|
||||
Constants::MESON_INTRO_BENCHMARKS,
|
||||
Constants::MESON_INTRO_BUIDOPTIONS,
|
||||
Constants::MESON_INTRO_PROJECTINFO,
|
||||
Constants::MESON_INTRO_DEPENDENCIES,
|
||||
Constants::MESON_INTRO_BUILDSYSTEM_FILES);
|
||||
}
|
||||
|
||||
class MesonWrapper final : public ToolWrapper
|
||||
{
|
||||
public:
|
||||
using ToolWrapper::ToolWrapper;
|
||||
|
||||
Command setup(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory,
|
||||
const QStringList &options = {}) const;
|
||||
Command configure(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory,
|
||||
const QStringList &options = {}) const;
|
||||
|
||||
Command regenerate(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory) const;
|
||||
|
||||
Command introspect(const Utils::FilePath &sourceDirectory) const;
|
||||
|
||||
static std::optional<Utils::FilePath> find()
|
||||
{
|
||||
return ToolWrapper::findTool({"meson.py", "meson"});
|
||||
}
|
||||
|
||||
static QString toolName() { return {"Meson"}; }
|
||||
};
|
||||
|
||||
template<>
|
||||
inline Utils::Store toVariantMap<MesonWrapper>(const MesonWrapper &meson)
|
||||
{
|
||||
Utils::Store data;
|
||||
data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name);
|
||||
data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toSettings());
|
||||
data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected);
|
||||
data.insert(Constants::ToolsSettings::ID_KEY, meson.m_id.toSetting());
|
||||
data.insert(Constants::ToolsSettings::TOOL_TYPE_KEY, Constants::ToolsSettings::TOOL_TYPE_MESON);
|
||||
return data;
|
||||
}
|
||||
template<>
|
||||
inline MesonWrapper *fromVariantMap<MesonWrapper *>(const Utils::Store &data)
|
||||
{
|
||||
return new MesonWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(),
|
||||
Utils::FilePath::fromSettings(data[Constants::ToolsSettings::EXE_KEY]),
|
||||
Utils::Id::fromSetting(data[Constants::ToolsSettings::ID_KEY]),
|
||||
data[Constants::ToolsSettings::AUTO_DETECTED_KEY].toBool());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace MesonProjectManager
|
||||
@@ -1,45 +0,0 @@
|
||||
// Copyright (C) 2020 Alexis Jeandet.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mesonpluginconstants.h"
|
||||
#include "toolwrapper.h"
|
||||
|
||||
namespace MesonProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class NinjaWrapper final : public ToolWrapper
|
||||
{
|
||||
public:
|
||||
using ToolWrapper::ToolWrapper;
|
||||
|
||||
static std::optional<Utils::FilePath> find()
|
||||
{
|
||||
return ToolWrapper::findTool({"ninja", "ninja-build"});
|
||||
}
|
||||
static QString toolName() { return {"Ninja"}; }
|
||||
};
|
||||
|
||||
template<>
|
||||
inline Utils::Store toVariantMap<NinjaWrapper>(const NinjaWrapper &meson)
|
||||
{
|
||||
Utils::Store data;
|
||||
data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name);
|
||||
data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toSettings());
|
||||
data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected);
|
||||
data.insert(Constants::ToolsSettings::ID_KEY, meson.m_id.toSetting());
|
||||
data.insert(Constants::ToolsSettings::TOOL_TYPE_KEY, Constants::ToolsSettings::TOOL_TYPE_NINJA);
|
||||
return data;
|
||||
}
|
||||
template<>
|
||||
inline NinjaWrapper *fromVariantMap<NinjaWrapper *>(const Utils::Store &data)
|
||||
{
|
||||
return new NinjaWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(),
|
||||
Utils::FilePath::fromSettings(data[Constants::ToolsSettings::EXE_KEY]),
|
||||
Utils::Id::fromSetting(data[Constants::ToolsSettings::ID_KEY]),
|
||||
data[Constants::ToolsSettings::AUTO_DETECTED_KEY].toBool());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace MesonProjectManager
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (C) 2020 Alexis Jeandet.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "mesonwrapper.h"
|
||||
#include "toolwrapper.h"
|
||||
#include "mesoninfoparser.h"
|
||||
|
||||
#include <utils/launcherinterface.h>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (C) 2020 Alexis Jeandet.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "../mesonwrapper.h"
|
||||
#include "../toolwrapper.h"
|
||||
|
||||
#include <utils/launcherinterface.h>
|
||||
#include <utils/singleton.h>
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mesonwrapper.h"
|
||||
#include "ninjawrapper.h"
|
||||
#include "toolwrapper.h"
|
||||
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
|
||||
@@ -3,11 +3,22 @@
|
||||
|
||||
#include "toolwrapper.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QTemporaryFile>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace MesonProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
// ToolWrapper base
|
||||
|
||||
ToolWrapper::ToolWrapper(const QString &name, const Utils::FilePath &path, bool autoDetected)
|
||||
: m_version(read_version(path))
|
||||
, m_isValid{path.exists() && m_version.isValid}
|
||||
@@ -49,9 +60,8 @@ Version ToolWrapper::read_version(const Utils::FilePath &toolPath)
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<Utils::FilePath> ToolWrapper::findTool(const QStringList &exeNames)
|
||||
static std::optional<FilePath> findTool(const QStringList &exeNames)
|
||||
{
|
||||
using namespace Utils;
|
||||
Environment systemEnvironment = Environment::systemEnvironment();
|
||||
for (const auto &exe : exeNames) {
|
||||
const FilePath exe_path = systemEnvironment.searchInPath(exe);
|
||||
@@ -61,5 +71,118 @@ std::optional<Utils::FilePath> ToolWrapper::findTool(const QStringList &exeNames
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// MesonWrapper
|
||||
|
||||
template<typename First>
|
||||
void impl_option_cat(QStringList &list, const First &first)
|
||||
{
|
||||
list.append(first);
|
||||
}
|
||||
|
||||
template<typename First, typename... T>
|
||||
void impl_option_cat(QStringList &list, const First &first, const T &...args)
|
||||
{
|
||||
impl_option_cat(list, first);
|
||||
impl_option_cat(list, args...);
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
QStringList options_cat(const T &...args)
|
||||
{
|
||||
QStringList result;
|
||||
impl_option_cat(result, args...);
|
||||
return result;
|
||||
}
|
||||
|
||||
Command MesonWrapper::setup(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory,
|
||||
const QStringList &options) const
|
||||
{
|
||||
return {m_exe,
|
||||
sourceDirectory,
|
||||
options_cat("setup", options, sourceDirectory.toString(), buildDirectory.toString())};
|
||||
}
|
||||
|
||||
Command MesonWrapper::configure(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory,
|
||||
const QStringList &options) const
|
||||
{
|
||||
if (!isSetup(buildDirectory))
|
||||
return setup(sourceDirectory, buildDirectory, options);
|
||||
return {m_exe, buildDirectory, options_cat("configure", options, buildDirectory.toString())};
|
||||
}
|
||||
|
||||
Command MesonWrapper::regenerate(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory) const
|
||||
{
|
||||
return {m_exe,
|
||||
buildDirectory,
|
||||
options_cat("--internal",
|
||||
"regenerate",
|
||||
sourceDirectory.toString(),
|
||||
buildDirectory.toString(),
|
||||
"--backend",
|
||||
"ninja")};
|
||||
}
|
||||
|
||||
Command MesonWrapper::introspect(const Utils::FilePath &sourceDirectory) const
|
||||
{
|
||||
return {m_exe,
|
||||
sourceDirectory,
|
||||
{"introspect", "--all", QString("%1/meson.build").arg(sourceDirectory.toString())}};
|
||||
}
|
||||
|
||||
std::optional<FilePath> MesonWrapper::find()
|
||||
{
|
||||
return findTool({"meson.py", "meson"});
|
||||
}
|
||||
|
||||
template<typename File_t>
|
||||
bool containsFiles(const QString &path, const File_t &file)
|
||||
{
|
||||
return QFileInfo::exists(QString("%1/%2").arg(path).arg(file));
|
||||
}
|
||||
|
||||
template<typename File_t, typename... T>
|
||||
bool containsFiles(const QString &path, const File_t &file, const T &...files)
|
||||
{
|
||||
return containsFiles(path, file) && containsFiles(path, files...);
|
||||
}
|
||||
|
||||
bool run_meson(const Command &command, QIODevice *output)
|
||||
{
|
||||
Utils::Process process;
|
||||
process.setWorkingDirectory(command.workDir());
|
||||
process.setCommand(command.cmdLine());
|
||||
process.start();
|
||||
if (!process.waitForFinished())
|
||||
return false;
|
||||
if (output) {
|
||||
output->write(process.rawStdOut());
|
||||
}
|
||||
return process.exitCode() == 0;
|
||||
}
|
||||
|
||||
bool isSetup(const Utils::FilePath &buildPath)
|
||||
{
|
||||
using namespace Utils;
|
||||
return containsFiles(buildPath.pathAppended(Constants::MESON_INFO_DIR).toString(),
|
||||
Constants::MESON_INTRO_TESTS,
|
||||
Constants::MESON_INTRO_TARGETS,
|
||||
Constants::MESON_INTRO_INSTALLED,
|
||||
Constants::MESON_INTRO_BENCHMARKS,
|
||||
Constants::MESON_INTRO_BUIDOPTIONS,
|
||||
Constants::MESON_INTRO_PROJECTINFO,
|
||||
Constants::MESON_INTRO_DEPENDENCIES,
|
||||
Constants::MESON_INTRO_BUILDSYSTEM_FILES);
|
||||
}
|
||||
|
||||
// NinjaWrapper
|
||||
|
||||
std::optional<FilePath> NinjaWrapper::find()
|
||||
{
|
||||
return findTool({"ninja", "ninja-build"});
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace MesonProjectManager
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mesonpluginconstants.h"
|
||||
#include "versionhelper.h"
|
||||
|
||||
#include <utils/commandline.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/id.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/store.h>
|
||||
|
||||
#include <optional>
|
||||
@@ -61,8 +63,6 @@ public:
|
||||
|
||||
static Version read_version(const Utils::FilePath &toolPath);
|
||||
|
||||
static std::optional<Utils::FilePath> findTool(const QStringList &exeNames);
|
||||
|
||||
template<typename T>
|
||||
friend Utils::Store toVariantMap(const T &);
|
||||
template<typename T>
|
||||
@@ -82,5 +82,80 @@ Utils::Store toVariantMap(const T &);
|
||||
template<typename T>
|
||||
T fromVariantMap(const Utils::Store &);
|
||||
|
||||
bool run_meson(const Command &command, QIODevice *output = nullptr);
|
||||
|
||||
bool isSetup(const Utils::FilePath &buildPath);
|
||||
|
||||
class MesonWrapper final : public ToolWrapper
|
||||
{
|
||||
public:
|
||||
using ToolWrapper::ToolWrapper;
|
||||
|
||||
Command setup(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory,
|
||||
const QStringList &options = {}) const;
|
||||
Command configure(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory,
|
||||
const QStringList &options = {}) const;
|
||||
|
||||
Command regenerate(const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory) const;
|
||||
|
||||
Command introspect(const Utils::FilePath &sourceDirectory) const;
|
||||
|
||||
static std::optional<Utils::FilePath> find();
|
||||
|
||||
static QString toolName() { return {"Meson"}; }
|
||||
};
|
||||
|
||||
template<>
|
||||
inline Utils::Store toVariantMap<MesonWrapper>(const MesonWrapper &meson)
|
||||
{
|
||||
Utils::Store data;
|
||||
data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name);
|
||||
data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toSettings());
|
||||
data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected);
|
||||
data.insert(Constants::ToolsSettings::ID_KEY, meson.m_id.toSetting());
|
||||
data.insert(Constants::ToolsSettings::TOOL_TYPE_KEY, Constants::ToolsSettings::TOOL_TYPE_MESON);
|
||||
return data;
|
||||
}
|
||||
template<>
|
||||
inline MesonWrapper *fromVariantMap<MesonWrapper *>(const Utils::Store &data)
|
||||
{
|
||||
return new MesonWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(),
|
||||
Utils::FilePath::fromSettings(data[Constants::ToolsSettings::EXE_KEY]),
|
||||
Utils::Id::fromSetting(data[Constants::ToolsSettings::ID_KEY]),
|
||||
data[Constants::ToolsSettings::AUTO_DETECTED_KEY].toBool());
|
||||
}
|
||||
|
||||
class NinjaWrapper final : public ToolWrapper
|
||||
{
|
||||
public:
|
||||
using ToolWrapper::ToolWrapper;
|
||||
|
||||
static std::optional<Utils::FilePath> find();
|
||||
static QString toolName() { return {"Ninja"}; }
|
||||
};
|
||||
|
||||
template<>
|
||||
inline Utils::Store toVariantMap<NinjaWrapper>(const NinjaWrapper &meson)
|
||||
{
|
||||
Utils::Store data;
|
||||
data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name);
|
||||
data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toSettings());
|
||||
data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected);
|
||||
data.insert(Constants::ToolsSettings::ID_KEY, meson.m_id.toSetting());
|
||||
data.insert(Constants::ToolsSettings::TOOL_TYPE_KEY, Constants::ToolsSettings::TOOL_TYPE_NINJA);
|
||||
return data;
|
||||
}
|
||||
template<>
|
||||
inline NinjaWrapper *fromVariantMap<NinjaWrapper *>(const Utils::Store &data)
|
||||
{
|
||||
return new NinjaWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(),
|
||||
Utils::FilePath::fromSettings(data[Constants::ToolsSettings::EXE_KEY]),
|
||||
Utils::Id::fromSetting(data[Constants::ToolsSettings::ID_KEY]),
|
||||
data[Constants::ToolsSettings::AUTO_DETECTED_KEY].toBool());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace MesonProjectManager
|
||||
|
||||
Reference in New Issue
Block a user