forked from qt-creator/qt-creator
Meson: Get rid of MesonInfo, use QVersionNumber directly
Change-Id: I482cfdfe988c10e592b0f2bf106b6ace41cf44ad Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -18,7 +18,6 @@ add_qtc_plugin(MesonProjectManager
|
||||
mesonbuildconfiguration.h
|
||||
mesonbuildsystem.cpp
|
||||
mesonbuildsystem.h
|
||||
mesoninfo.h
|
||||
mesoninfoparser.h
|
||||
mesonoutputparser.cpp
|
||||
mesonoutputparser.h
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
#include "mesoninfo.h"
|
||||
#include "mesonpluginconstants.h"
|
||||
|
||||
#include <QFile>
|
||||
@@ -12,19 +11,18 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QVersionNumber>
|
||||
|
||||
namespace MesonProjectManager::Internal {
|
||||
|
||||
class InfoParser
|
||||
{
|
||||
static inline MesonInfo load_info(const QJsonObject &obj)
|
||||
static inline QVersionNumber load_info(const QJsonObject &obj)
|
||||
{
|
||||
MesonInfo info;
|
||||
auto v = obj["meson_version"].toObject();
|
||||
info.mesonVersion = {v["major"].toInt(), v["minor"].toInt(), v["patch"].toInt()};
|
||||
return info;
|
||||
auto version = obj["meson_version"].toObject();
|
||||
return {version["major"].toInt(), version["minor"].toInt(), version["patch"].toInt()};
|
||||
}
|
||||
MesonInfo m_info;
|
||||
QVersionNumber m_info;
|
||||
|
||||
public:
|
||||
InfoParser(const Utils::FilePath &buildDir)
|
||||
@@ -35,7 +33,7 @@ public:
|
||||
m_info = load_info(*obj);
|
||||
}
|
||||
|
||||
MesonInfo info() { return m_info; }
|
||||
QVersionNumber info() { return m_info; }
|
||||
};
|
||||
|
||||
} // namespace MesonProjectManager::Internal
|
||||
|
||||
@@ -1,17 +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 <QVersionNumber>
|
||||
|
||||
namespace MesonProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
struct MesonInfo
|
||||
{
|
||||
QVersionNumber mesonVersion;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace MesonProjectManager
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "buildoptions.h"
|
||||
#include "buildoptionsparser.h"
|
||||
#include "infoparser.h"
|
||||
#include "mesoninfo.h"
|
||||
#include "target.h"
|
||||
|
||||
#include <utils/filepath.h>
|
||||
@@ -123,7 +122,7 @@ struct Result
|
||||
TargetsList targets;
|
||||
BuildOptionsList buildOptions;
|
||||
Utils::FilePaths buildSystemFiles;
|
||||
std::optional<MesonInfo> mesonInfo;
|
||||
std::optional<QVersionNumber> mesonInfo;
|
||||
};
|
||||
|
||||
inline Result parse(const Utils::FilePath &buildDir)
|
||||
@@ -155,7 +154,7 @@ inline Result parse(QIODevice *introFile)
|
||||
return {};
|
||||
}
|
||||
|
||||
inline std::optional<MesonInfo> mesonInfo(const Utils::FilePath &buildDir)
|
||||
inline std::optional<QVersionNumber> mesonInfo(const Utils::FilePath &buildDir)
|
||||
{
|
||||
return InfoParser{buildDir}.info();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ Project {
|
||||
"mesonactionsmanager.cpp",
|
||||
"mesonactionsmanager.h",
|
||||
"buildoptions.h",
|
||||
"mesoninfo.h",
|
||||
"mesoninfoparser.h",
|
||||
"buildoptionsparser.h",
|
||||
"common.h",
|
||||
|
||||
@@ -311,7 +311,7 @@ bool MesonProjectParser::usesSameMesonVersion(const FilePath &buildPath)
|
||||
{
|
||||
auto info = MesonInfoParser::mesonInfo(buildPath);
|
||||
auto meson = MesonTools::toolById(m_meson, ToolType::Meson);
|
||||
return info && meson && info->mesonVersion == meson->version();
|
||||
return info && meson && *info == meson->version();
|
||||
}
|
||||
|
||||
bool MesonProjectParser::run(const Command &command,
|
||||
|
||||
Reference in New Issue
Block a user