forked from qt-creator/qt-creator
ProjectManager: Return FilePaths from ProjectImporter::importCandidates
Proliferates FilePath use a bit further. Actual changes to the individual importers are left for further patches. Change-Id: Ie7c6b2e3f4ac7d0eca6d2f56d30fb23354bb404b Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -25,15 +25,13 @@
|
||||
#include <utils/temporarydirectory.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace QtSupport;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
static Q_LOGGING_CATEGORY(cmInputLog, "qtc.cmake.import", QtWarningMsg);
|
||||
|
||||
@@ -104,7 +102,7 @@ CMakeProjectImporter::CMakeProjectImporter(const FilePath &path, const PresetsDa
|
||||
|
||||
}
|
||||
|
||||
QStringList CMakeProjectImporter::importCandidates()
|
||||
FilePaths CMakeProjectImporter::importCandidates()
|
||||
{
|
||||
FilePaths candidates;
|
||||
|
||||
@@ -131,7 +129,7 @@ QStringList CMakeProjectImporter::importCandidates()
|
||||
|
||||
const FilePaths finalists = Utils::filteredUnique(candidates);
|
||||
qCInfo(cmInputLog) << "import candidates:" << finalists;
|
||||
return finalists;
|
||||
return Utils::transform(finalists, &FilePath::fromString);
|
||||
}
|
||||
|
||||
static CMakeConfig configurationFromPresetProbe(
|
||||
@@ -685,8 +683,7 @@ void CMakeProjectImporter::persistTemporaryCMake(Kit *k, const QVariantList &vl)
|
||||
qCDebug(cmInputLog) << "Temporary CMake tool made persistent.";
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
|
@@ -21,7 +21,7 @@ class CMakeProjectImporter : public QtSupport::QtProjectImporter
|
||||
public:
|
||||
CMakeProjectImporter(const Utils::FilePath &path, const Internal::PresetsData &presetsData);
|
||||
|
||||
QStringList importCandidates() final;
|
||||
Utils::FilePaths importCandidates() final;
|
||||
|
||||
private:
|
||||
QList<void *> examineDirectory(const Utils::FilePath &importPath,
|
||||
|
@@ -16,7 +16,7 @@ MesonProjectImporter::MesonProjectImporter(const Utils::FilePath &path)
|
||||
: QtSupport::QtProjectImporter{path}
|
||||
{}
|
||||
|
||||
QStringList MesonProjectImporter::importCandidates()
|
||||
Utils::FilePaths MesonProjectImporter::importCandidates()
|
||||
{
|
||||
//TODO, this can be done later
|
||||
return {};
|
||||
|
@@ -3,21 +3,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "exewrappers/mesonwrapper.h"
|
||||
|
||||
#include <projectexplorer/buildinfo.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
|
||||
#include <qtsupport/qtprojectimporter.h>
|
||||
|
||||
namespace MesonProjectManager {
|
||||
namespace Internal {
|
||||
namespace MesonProjectManager::Internal {
|
||||
|
||||
class MesonProjectImporter final : public QtSupport::QtProjectImporter
|
||||
{
|
||||
public:
|
||||
MesonProjectImporter(const Utils::FilePath &path);
|
||||
QStringList importCandidates() final;
|
||||
Utils::FilePaths importCandidates() final;
|
||||
|
||||
private:
|
||||
// importPath is an existing directory at this point!
|
||||
@@ -32,5 +29,4 @@ private:
|
||||
void deleteDirectoryData(void *directoryData) const final;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace MesonProjectManager
|
||||
} // MesonProjectManager::Internal
|
||||
|
@@ -34,7 +34,7 @@ public:
|
||||
const Utils::FilePath projectDirectory() const { return m_projectPath.parentDir(); }
|
||||
|
||||
virtual const QList<BuildInfo> import(const Utils::FilePath &importPath, bool silent = false);
|
||||
virtual QStringList importCandidates() = 0;
|
||||
virtual Utils::FilePaths importCandidates() = 0;
|
||||
virtual Target *preferredTarget(const QList<Target *> &possibleTargets);
|
||||
|
||||
bool isUpdating() const { return m_isUpdating; }
|
||||
|
@@ -334,9 +334,9 @@ void TargetSetupPage::setupImports()
|
||||
if (!m_importer || m_projectPath.isEmpty())
|
||||
return;
|
||||
|
||||
const QStringList toImport = m_importer->importCandidates();
|
||||
for (const QString &path : toImport)
|
||||
import(FilePath::fromString(path), true);
|
||||
const FilePaths toImport = m_importer->importCandidates();
|
||||
for (const FilePath &path : toImport)
|
||||
import(path, true);
|
||||
}
|
||||
|
||||
void TargetSetupPage::handleKitAddition(Kit *k)
|
||||
|
@@ -24,8 +24,7 @@
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
namespace QbsProjectManager::Internal {
|
||||
|
||||
struct BuildGraphData
|
||||
{
|
||||
@@ -88,7 +87,7 @@ static QStringList candidatesForDirectory(const QString &dir)
|
||||
return candidates;
|
||||
}
|
||||
|
||||
QStringList QbsProjectImporter::importCandidates()
|
||||
FilePaths QbsProjectImporter::importCandidates()
|
||||
{
|
||||
const QString projectDir = projectFilePath().toFileInfo().absolutePath();
|
||||
QStringList candidates = candidatesForDirectory(projectDir);
|
||||
@@ -105,7 +104,7 @@ QStringList QbsProjectImporter::importCandidates()
|
||||
}
|
||||
}
|
||||
qCDebug(qbsPmLog) << "build directory candidates:" << candidates;
|
||||
return candidates;
|
||||
return Utils::transform(candidates, &FilePath::fromString);
|
||||
}
|
||||
|
||||
QList<void *> QbsProjectImporter::examineDirectory(const FilePath &importPath,
|
||||
@@ -212,5 +211,4 @@ void QbsProjectImporter::deleteDirectoryData(void *directoryData) const
|
||||
delete static_cast<BuildGraphData *>(directoryData);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
} // QbsProjectManager::Internal
|
||||
|
@@ -5,8 +5,7 @@
|
||||
|
||||
#include <qtsupport/qtprojectimporter.h>
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
namespace QbsProjectManager::Internal {
|
||||
|
||||
class QbsProjectImporter final : public QtSupport::QtProjectImporter
|
||||
{
|
||||
@@ -16,7 +15,7 @@ public:
|
||||
QbsProjectImporter(const Utils::FilePath &path);
|
||||
|
||||
private:
|
||||
QStringList importCandidates() override;
|
||||
Utils::FilePaths importCandidates() override;
|
||||
QList<void *> examineDirectory(const Utils::FilePath &importPath, QString *warningMessage) const override;
|
||||
bool matchKit(void *directoryData, const ProjectExplorer::Kit *k) const override;
|
||||
ProjectExplorer::Kit *createKit(void *directoryData) const override;
|
||||
@@ -24,5 +23,4 @@ private:
|
||||
void deleteDirectoryData(void *directoryData) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
} // QbsProjectManager::Internal
|
||||
|
@@ -54,8 +54,7 @@ struct DirectoryData
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace QmakeProjectManager::Internal {
|
||||
|
||||
const Utils::Id QT_IS_TEMPORARY("Qmake.TempQt");
|
||||
const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios"; // ugly
|
||||
@@ -64,7 +63,7 @@ QmakeProjectImporter::QmakeProjectImporter(const FilePath &path) :
|
||||
QtProjectImporter(path)
|
||||
{ }
|
||||
|
||||
QStringList QmakeProjectImporter::importCandidates()
|
||||
FilePaths QmakeProjectImporter::importCandidates()
|
||||
{
|
||||
QStringList candidates;
|
||||
|
||||
@@ -84,7 +83,7 @@ QStringList QmakeProjectImporter::importCandidates()
|
||||
candidates << path;
|
||||
}
|
||||
}
|
||||
return candidates;
|
||||
return Utils::transform(candidates, &FilePath::fromString);
|
||||
}
|
||||
|
||||
QList<void *> QmakeProjectImporter::examineDirectory(const FilePath &importPath,
|
||||
@@ -255,5 +254,4 @@ Kit *QmakeProjectImporter::createTemporaryKit(const QtProjectImporter::QtVersion
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
||||
} // QmakeProjectManager::Internal
|
||||
|
@@ -7,8 +7,7 @@
|
||||
|
||||
#include <qtsupport/qtprojectimporter.h>
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace QmakeProjectManager::Internal {
|
||||
|
||||
// Documentation inside.
|
||||
class QmakeProjectImporter : public QtSupport::QtProjectImporter
|
||||
@@ -16,7 +15,7 @@ class QmakeProjectImporter : public QtSupport::QtProjectImporter
|
||||
public:
|
||||
QmakeProjectImporter(const Utils::FilePath &path);
|
||||
|
||||
QStringList importCandidates() final;
|
||||
Utils::FilePaths importCandidates() final;
|
||||
|
||||
private:
|
||||
QList<void *> examineDirectory(const Utils::FilePath &importPath, QString *warningMessage) const final;
|
||||
@@ -31,5 +30,4 @@ private:
|
||||
const QMakeStepConfig::OsType &osType) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
||||
} // QmakeProjectManager::Internal
|
||||
|
@@ -16,7 +16,6 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QList>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
@@ -153,7 +152,7 @@ public:
|
||||
m_testData(testData)
|
||||
{ }
|
||||
|
||||
QStringList importCandidates() override;
|
||||
FilePaths importCandidates() override { return {}; }
|
||||
|
||||
bool allDeleted() const { return m_deletedTestData.count() == m_testData.count();}
|
||||
|
||||
@@ -173,11 +172,6 @@ private:
|
||||
QList<Kit *> m_deletedKits;
|
||||
};
|
||||
|
||||
QStringList TestQtProjectImporter::importCandidates()
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QList<void *> TestQtProjectImporter::examineDirectory(const Utils::FilePath &importPath,
|
||||
QString *warningMessage) const
|
||||
{
|
||||
|
Reference in New Issue
Block a user