Commit 8f0697e3 authored by Tobias Hunger's avatar Tobias Hunger Committed by Tim Jenssen

qmake: Unify TargetInformation and TargetParserInformation again

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