forked from qt-creator/qt-creator
qmake: Unify TargetInformation and TargetParserInformation again
Change-Id: I00fc6e99e55684e67e5240c539002b13f4541286 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
d69ebea479
commit
8f0697e33d
@@ -230,7 +230,7 @@ FileName IosRunConfiguration::bundleDirectory() const
|
|||||||
if (node) {
|
if (node) {
|
||||||
TargetInformation ti = node->targetInformation();
|
TargetInformation ti = node->targetInformation();
|
||||||
if (ti.valid)
|
if (ti.valid)
|
||||||
res = FileName::fromString(ti.buildDir);
|
res = ti.buildDir;
|
||||||
}
|
}
|
||||||
if (res.isEmpty())
|
if (res.isEmpty())
|
||||||
res = bc->buildDirectory();
|
res = bc->buildDirectory();
|
||||||
|
|||||||
@@ -55,11 +55,11 @@ QStringList QmakeAndroidSupport::soLibSearchPath(const ProjectExplorer::Target *
|
|||||||
|
|
||||||
foreach (QmakeProFileNode *node, project->allProFiles()) {
|
foreach (QmakeProFileNode *node, project->allProFiles()) {
|
||||||
TargetInformation info = node->targetInformation();
|
TargetInformation info = node->targetInformation();
|
||||||
res << info.buildDir;
|
res << info.buildDir.toString();
|
||||||
QString destDir = info.destDir;
|
QString destDir = info.destDir.toString();
|
||||||
if (!destDir.isEmpty()) {
|
if (!destDir.isEmpty()) {
|
||||||
if (QFileInfo(destDir).isRelative())
|
if (QFileInfo(destDir).isRelative())
|
||||||
destDir = QDir::cleanPath(info.buildDir + QLatin1Char('/') + destDir);
|
destDir = QDir::cleanPath(info.buildDir.toString() + '/' + destDir);
|
||||||
res << destDir;
|
res << destDir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -474,22 +474,22 @@ QPair<QString, QString> DesktopQmakeRunConfiguration::extractWorkingDirAndExecut
|
|||||||
|
|
||||||
const QStringList &config = node->variableValue(Variable::Config);
|
const QStringList &config = node->variableValue(Variable::Config);
|
||||||
|
|
||||||
QString destDir = ti.destDir;
|
QString destDir = ti.destDir.toString();
|
||||||
QString workingDir;
|
QString workingDir;
|
||||||
if (!destDir.isEmpty()) {
|
if (!destDir.isEmpty()) {
|
||||||
bool workingDirIsBaseDir = false;
|
bool workingDirIsBaseDir = false;
|
||||||
if (destDir == ti.buildTarget)
|
if (destDir == ti.buildTarget)
|
||||||
workingDirIsBaseDir = true;
|
workingDirIsBaseDir = true;
|
||||||
if (QDir::isRelativePath(destDir))
|
if (QDir::isRelativePath(destDir))
|
||||||
destDir = QDir::cleanPath(ti.buildDir + QLatin1Char('/') + destDir);
|
destDir = QDir::cleanPath(ti.buildDir.toString() + '/' + destDir);
|
||||||
|
|
||||||
if (workingDirIsBaseDir)
|
if (workingDirIsBaseDir)
|
||||||
workingDir = ti.buildDir;
|
workingDir = ti.buildDir.toString();
|
||||||
else
|
else
|
||||||
workingDir = destDir;
|
workingDir = destDir;
|
||||||
} else {
|
} else {
|
||||||
destDir = ti.buildDir;
|
destDir = ti.buildDir.toString();
|
||||||
workingDir = ti.buildDir;
|
workingDir = ti.buildDir.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HostOsInfo::isMacHost() && config.contains(QLatin1String("app_bundle"))) {
|
if (HostOsInfo::isMacHost() && config.contains(QLatin1String("app_bundle"))) {
|
||||||
|
|||||||
@@ -1096,7 +1096,7 @@ QString InternalLibraryDetailsController::snippet() const
|
|||||||
QmakeProFileNode *proFileNode = m_proFileNodes.at(currentIndex);
|
QmakeProFileNode *proFileNode = m_proFileNodes.at(currentIndex);
|
||||||
TargetInformation targetInfo = proFileNode->targetInformation();
|
TargetInformation targetInfo = proFileNode->targetInformation();
|
||||||
|
|
||||||
const QString targetRelativePath = appendSeparator(projectBuildDir.relativeFilePath(targetInfo.buildDir));
|
const QString targetRelativePath = appendSeparator(projectBuildDir.relativeFilePath(targetInfo.buildDir.toString()));
|
||||||
const QString includeRelativePath = projectSrcDir.relativeFilePath(libraryDetailsWidget()->includePathChooser->path());
|
const QString includeRelativePath = projectSrcDir.relativeFilePath(libraryDetailsWidget()->includePathChooser->path());
|
||||||
|
|
||||||
const bool useSubfolders = libraryDetailsWidget()->useSubfoldersCheckBox->isChecked();
|
const bool useSubfolders = libraryDetailsWidget()->useSubfoldersCheckBox->isChecked();
|
||||||
|
|||||||
@@ -2166,10 +2166,10 @@ TargetInformation QmakeProFileNode::targetInformation(QtSupport::ProFileReader *
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BUILD DIR
|
// BUILD DIR
|
||||||
result.buildDir = buildDir;
|
result.buildDir = FileName::fromString(buildDir);
|
||||||
|
|
||||||
if (readerBuildPass->contains(QLatin1String("DESTDIR")))
|
if (readerBuildPass->contains(QLatin1String("DESTDIR")))
|
||||||
result.destDir = readerBuildPass->value(QLatin1String("DESTDIR"));
|
result.destDir = FileName::fromString(readerBuildPass->value(QLatin1String("DESTDIR")));
|
||||||
|
|
||||||
// Target
|
// Target
|
||||||
result.target = readerBuildPass->value(QLatin1String("TARGET"));
|
result.target = readerBuildPass->value(QLatin1String("TARGET"));
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class EvalResult;
|
|||||||
class PriFileEvalResult;
|
class PriFileEvalResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct InstallsList;
|
class InstallsList;
|
||||||
|
|
||||||
// Implements ProjectNode for qmake .pri files
|
// Implements ProjectNode for qmake .pri files
|
||||||
class QMAKEPROJECTMANAGER_EXPORT QmakePriFileNode : public ProjectExplorer::ProjectNode
|
class QMAKEPROJECTMANAGER_EXPORT QmakePriFileNode : public ProjectExplorer::ProjectNode
|
||||||
@@ -172,47 +172,6 @@ private:
|
|||||||
friend struct Internal::InternalNode;
|
friend struct Internal::InternalNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMAKEPROJECTMANAGER_EXPORT TargetInformation
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bool valid = false;
|
|
||||||
QString target;
|
|
||||||
QString destDir;
|
|
||||||
QString buildDir;
|
|
||||||
QString buildTarget;
|
|
||||||
bool operator==(const TargetInformation &other) const
|
|
||||||
{
|
|
||||||
return target == other.target
|
|
||||||
&& valid == other.valid
|
|
||||||
&& destDir == other.destDir
|
|
||||||
&& buildDir == other.buildDir
|
|
||||||
&& buildTarget == other.buildTarget;
|
|
||||||
}
|
|
||||||
bool operator!=(const TargetInformation &other) const
|
|
||||||
{
|
|
||||||
return !(*this == other);
|
|
||||||
}
|
|
||||||
|
|
||||||
TargetInformation() = default;
|
|
||||||
|
|
||||||
TargetInformation(const TargetInformation &other) = default;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct QMAKEPROJECTMANAGER_EXPORT InstallsItem {
|
|
||||||
InstallsItem() = default;
|
|
||||||
InstallsItem(QString p, QVector<ProFileEvaluator::SourceFile> f, bool a)
|
|
||||||
: path(p), files(f), active(a) {}
|
|
||||||
QString path;
|
|
||||||
QVector<ProFileEvaluator::SourceFile> files;
|
|
||||||
bool active = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct QMAKEPROJECTMANAGER_EXPORT InstallsList {
|
|
||||||
void clear() { targetPath.clear(); items.clear(); }
|
|
||||||
QString targetPath;
|
|
||||||
QVector<InstallsItem> items;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Implements ProjectNode for qmake .pro files
|
// Implements ProjectNode for qmake .pro files
|
||||||
class QMAKEPROJECTMANAGER_EXPORT QmakeProFileNode : public QmakePriFileNode
|
class QMAKEPROJECTMANAGER_EXPORT QmakeProFileNode : public QmakePriFileNode
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -147,8 +147,8 @@ public:
|
|||||||
QStringList subProjectsNotToDeploy;
|
QStringList subProjectsNotToDeploy;
|
||||||
QSet<FileName> exactSubdirs;
|
QSet<FileName> exactSubdirs;
|
||||||
QmakeIncludedPriFile includedFiles;
|
QmakeIncludedPriFile includedFiles;
|
||||||
TargetParserInformation targetInformation;
|
TargetInformation targetInformation;
|
||||||
InstallsParserList installsList;
|
InstallsList installsList;
|
||||||
QHash<Variable, QStringList> newVarValues;
|
QHash<Variable, QStringList> newVarValues;
|
||||||
QStringList errors;
|
QStringList errors;
|
||||||
};
|
};
|
||||||
@@ -303,9 +303,9 @@ void QmakePriFile::extractSources(
|
|||||||
|
|
||||||
void QmakePriFile::extractInstalls(
|
void QmakePriFile::extractInstalls(
|
||||||
QHash<const ProFile *, QmakePriFileEvalResult *> proToResult, QmakePriFileEvalResult *fallback,
|
QHash<const ProFile *, QmakePriFileEvalResult *> proToResult, QmakePriFileEvalResult *fallback,
|
||||||
const InstallsParserList &installList)
|
const InstallsList &installList)
|
||||||
{
|
{
|
||||||
for (const InstallsParserItem &item : installList.items) {
|
for (const InstallsItem &item : installList.items) {
|
||||||
for (const ProFileEvaluator::SourceFile &source : item.files) {
|
for (const ProFileEvaluator::SourceFile &source : item.files) {
|
||||||
auto *result = proToResult.value(source.proFile);
|
auto *result = proToResult.value(source.proFile);
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -1765,12 +1765,12 @@ FileNameList QmakeProFile::subDirsPaths(QtSupport::ProFileReader *reader,
|
|||||||
return Utils::filteredUnique(subProjectPaths);
|
return Utils::filteredUnique(subProjectPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetParserInformation QmakeProFile::targetInformation(QtSupport::ProFileReader *reader,
|
TargetInformation QmakeProFile::targetInformation(QtSupport::ProFileReader *reader,
|
||||||
QtSupport::ProFileReader *readerBuildPass,
|
QtSupport::ProFileReader *readerBuildPass,
|
||||||
const FileName &buildDir,
|
const FileName &buildDir,
|
||||||
const FileName &projectFilePath)
|
const FileName &projectFilePath)
|
||||||
{
|
{
|
||||||
TargetParserInformation result;
|
TargetInformation result;
|
||||||
if (!reader || !readerBuildPass)
|
if (!reader || !readerBuildPass)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
@@ -1796,15 +1796,15 @@ TargetParserInformation QmakeProFile::targetInformation(QtSupport::ProFileReader
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetParserInformation QmakeProFile::targetInformation() const
|
TargetInformation QmakeProFile::targetInformation() const
|
||||||
{
|
{
|
||||||
return m_qmakeTargetInformation;
|
return m_qmakeTargetInformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
InstallsParserList QmakeProFile::installsList(const QtSupport::ProFileReader *reader, const QString &projectFilePath,
|
InstallsList QmakeProFile::installsList(const QtSupport::ProFileReader *reader, const QString &projectFilePath,
|
||||||
const QString &projectDir, const QString &buildDir)
|
const QString &projectDir, const QString &buildDir)
|
||||||
{
|
{
|
||||||
InstallsParserList result;
|
InstallsList result;
|
||||||
if (!reader)
|
if (!reader)
|
||||||
return result;
|
return result;
|
||||||
const QStringList &itemList = reader->values(QLatin1String("INSTALLS"));
|
const QStringList &itemList = reader->values(QLatin1String("INSTALLS"));
|
||||||
@@ -1847,13 +1847,13 @@ InstallsParserList QmakeProFile::installsList(const QtSupport::ProFileReader *re
|
|||||||
} else {
|
} else {
|
||||||
const auto &itemFiles = reader->fixifiedValues(
|
const auto &itemFiles = reader->fixifiedValues(
|
||||||
item + QLatin1String(".files"), projectDir, buildDir);
|
item + QLatin1String(".files"), projectDir, buildDir);
|
||||||
result.items << InstallsParserItem(itemPath, itemFiles, active);
|
result.items << InstallsItem(itemPath, itemFiles, active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
InstallsParserList QmakeProFile::installsList() const
|
InstallsList QmakeProFile::installsList() const
|
||||||
{
|
{
|
||||||
return m_installsList;
|
return m_installsList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class QmakeEvalResult;
|
|||||||
class QmakePriFileEvalResult;
|
class QmakePriFileEvalResult;
|
||||||
} // namespace Internal;
|
} // namespace Internal;
|
||||||
|
|
||||||
class InstallsParserList;
|
class InstallsList;
|
||||||
|
|
||||||
// Implements ProjectNode for qmake .pri files
|
// Implements ProjectNode for qmake .pri files
|
||||||
class QMAKEPROJECTMANAGER_EXPORT QmakePriFile
|
class QMAKEPROJECTMANAGER_EXPORT QmakePriFile
|
||||||
@@ -206,7 +206,7 @@ private:
|
|||||||
static void extractInstalls(
|
static void extractInstalls(
|
||||||
QHash<const ProFile *, Internal::QmakePriFileEvalResult *> proToResult,
|
QHash<const ProFile *, Internal::QmakePriFileEvalResult *> proToResult,
|
||||||
Internal::QmakePriFileEvalResult *fallback,
|
Internal::QmakePriFileEvalResult *fallback,
|
||||||
const InstallsParserList &installList);
|
const InstallsList &installList);
|
||||||
static void processValues(Internal::QmakePriFileEvalResult &result);
|
static void processValues(Internal::QmakePriFileEvalResult &result);
|
||||||
void watchFolders(const QSet<QString> &folders);
|
void watchFolders(const QSet<QString> &folders);
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ private:
|
|||||||
friend class QmakeProjectManager::QmakeProFile;
|
friend class QmakeProjectManager::QmakeProFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMAKEPROJECTMANAGER_EXPORT TargetParserInformation
|
class QMAKEPROJECTMANAGER_EXPORT TargetInformation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
@@ -235,7 +235,7 @@ public:
|
|||||||
Utils::FileName destDir;
|
Utils::FileName destDir;
|
||||||
Utils::FileName buildDir;
|
Utils::FileName buildDir;
|
||||||
QString buildTarget;
|
QString buildTarget;
|
||||||
bool operator==(const TargetParserInformation &other) const
|
bool operator==(const TargetInformation &other) const
|
||||||
{
|
{
|
||||||
return target == other.target
|
return target == other.target
|
||||||
&& valid == other.valid
|
&& valid == other.valid
|
||||||
@@ -243,30 +243,30 @@ public:
|
|||||||
&& buildDir == other.buildDir
|
&& buildDir == other.buildDir
|
||||||
&& buildTarget == other.buildTarget;
|
&& buildTarget == other.buildTarget;
|
||||||
}
|
}
|
||||||
bool operator!=(const TargetParserInformation &other) const
|
bool operator!=(const TargetInformation &other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetParserInformation() = default;
|
TargetInformation() = default;
|
||||||
TargetParserInformation(const TargetParserInformation &other) = default;
|
TargetInformation(const TargetInformation &other) = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMAKEPROJECTMANAGER_EXPORT InstallsParserItem {
|
class QMAKEPROJECTMANAGER_EXPORT InstallsItem {
|
||||||
public:
|
public:
|
||||||
InstallsParserItem() = default;
|
InstallsItem() = default;
|
||||||
InstallsParserItem(QString p, QVector<ProFileEvaluator::SourceFile> f, bool a)
|
InstallsItem(QString p, QVector<ProFileEvaluator::SourceFile> f, bool a)
|
||||||
: path(p), files(f), active(a) {}
|
: path(p), files(f), active(a) {}
|
||||||
QString path;
|
QString path;
|
||||||
QVector<ProFileEvaluator::SourceFile> files;
|
QVector<ProFileEvaluator::SourceFile> files;
|
||||||
bool active = false;
|
bool active = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMAKEPROJECTMANAGER_EXPORT InstallsParserList {
|
class QMAKEPROJECTMANAGER_EXPORT InstallsList {
|
||||||
public:
|
public:
|
||||||
void clear() { targetPath.clear(); items.clear(); }
|
void clear() { targetPath.clear(); items.clear(); }
|
||||||
QString targetPath;
|
QString targetPath;
|
||||||
QVector<InstallsParserItem> items;
|
QVector<InstallsItem> items;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements ProjectNode for qmake .pro files
|
// Implements ProjectNode for qmake .pro files
|
||||||
@@ -298,9 +298,8 @@ public:
|
|||||||
const Utils::FileName &sourceFile) const;
|
const Utils::FileName &sourceFile) const;
|
||||||
QList<ProjectExplorer::ExtraCompiler *> extraCompilers() const;
|
QList<ProjectExplorer::ExtraCompiler *> extraCompilers() const;
|
||||||
|
|
||||||
TargetParserInformation targetInformation() const;
|
TargetInformation targetInformation() const;
|
||||||
|
InstallsList installsList() const;
|
||||||
InstallsParserList installsList() const;
|
|
||||||
|
|
||||||
QString makefile() const;
|
QString makefile() const;
|
||||||
QString objectExtension() const;
|
QString objectExtension() const;
|
||||||
@@ -345,8 +344,8 @@ private:
|
|||||||
static QStringList libDirectories(QtSupport::ProFileReader *reader);
|
static QStringList libDirectories(QtSupport::ProFileReader *reader);
|
||||||
static Utils::FileNameList subDirsPaths(QtSupport::ProFileReader *reader, const QString &projectDir, QStringList *subProjectsNotToDeploy, QStringList *errors);
|
static Utils::FileNameList subDirsPaths(QtSupport::ProFileReader *reader, const QString &projectDir, QStringList *subProjectsNotToDeploy, QStringList *errors);
|
||||||
|
|
||||||
static TargetParserInformation targetInformation(QtSupport::ProFileReader *reader, QtSupport::ProFileReader *readerBuildPass, const Utils::FileName &buildDir, const Utils::FileName &projectFilePath);
|
static TargetInformation targetInformation(QtSupport::ProFileReader *reader, QtSupport::ProFileReader *readerBuildPass, const Utils::FileName &buildDir, const Utils::FileName &projectFilePath);
|
||||||
static InstallsParserList installsList(const QtSupport::ProFileReader *reader, const QString &projectFilePath, const QString &projectDir, const QString &buildDir);
|
static InstallsList installsList(const QtSupport::ProFileReader *reader, const QString &projectFilePath, const QString &projectDir, const QString &buildDir);
|
||||||
|
|
||||||
bool m_validParse = false;
|
bool m_validParse = false;
|
||||||
bool m_parseInProgress = false;
|
bool m_parseInProgress = false;
|
||||||
@@ -359,9 +358,9 @@ private:
|
|||||||
|
|
||||||
QList<ProjectExplorer::ExtraCompiler *> m_extraCompilers;
|
QList<ProjectExplorer::ExtraCompiler *> m_extraCompilers;
|
||||||
|
|
||||||
TargetParserInformation m_qmakeTargetInformation;
|
TargetInformation m_qmakeTargetInformation;
|
||||||
Utils::FileNameList m_subProjectsNotToDeploy;
|
Utils::FileNameList m_subProjectsNotToDeploy;
|
||||||
InstallsParserList m_installsList;
|
InstallsList m_installsList;
|
||||||
|
|
||||||
// Async stuff
|
// Async stuff
|
||||||
QFutureWatcher<Internal::QmakeEvalResult *> m_parseFutureWatcher;
|
QFutureWatcher<Internal::QmakeEvalResult *> m_parseFutureWatcher;
|
||||||
|
|||||||
@@ -1278,10 +1278,10 @@ void QmakeProject::collectApplicationData(const QmakeProFileNode *node, Deployme
|
|||||||
static QString destDirFor(const TargetInformation &ti)
|
static QString destDirFor(const TargetInformation &ti)
|
||||||
{
|
{
|
||||||
if (ti.destDir.isEmpty())
|
if (ti.destDir.isEmpty())
|
||||||
return ti.buildDir;
|
return ti.buildDir.toString();
|
||||||
if (QDir::isRelativePath(ti.destDir))
|
if (QDir::isRelativePath(ti.destDir.toString()))
|
||||||
return QDir::cleanPath(ti.buildDir + QLatin1Char('/') + ti.destDir);
|
return QDir::cleanPath(ti.buildDir.toString() + '/' + ti.destDir.toString());
|
||||||
return ti.destDir;
|
return ti.destDir.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentData &deploymentData)
|
void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentData &deploymentData)
|
||||||
|
|||||||
Reference in New Issue
Block a user