forked from qt-creator/qt-creator
Qmake: Move some data accessors from QmakeProFile to QmakeProFileNode
These are not used during parsing but when operating on the items in the project tree. This loosens the ties between the qmake related parser and project nodes. Change-Id: I077356fcde240df56b466c71c902c821c4885f6d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -254,7 +254,8 @@ bool QmakeBuildConfiguration::isShadowBuild() const
|
|||||||
|
|
||||||
QString QmakeBuildConfiguration::makefile() const
|
QString QmakeBuildConfiguration::makefile() const
|
||||||
{
|
{
|
||||||
return static_cast<QmakeProject *>(target()->project())->rootProFile()->makefile();
|
auto rootNode = dynamic_cast<QmakeProFileNode *>(target()->project()->rootProjectNode());
|
||||||
|
return rootNode ? rootNode->makefile() : QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseQtVersion::QmakeBuildConfigs QmakeBuildConfiguration::qmakeBuildConfiguration() const
|
BaseQtVersion::QmakeBuildConfigs QmakeBuildConfiguration::qmakeBuildConfiguration() const
|
||||||
|
|||||||
@@ -99,8 +99,7 @@ bool QmakeMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
|
|
||||||
QString args;
|
QString args;
|
||||||
|
|
||||||
QmakeProjectManager::QmakeProFileNode *subNode = bc->subNodeBuild();
|
QmakeProjectManager::QmakeProFileNode *subProFile = bc->subNodeBuild();
|
||||||
QmakeProjectManager::QmakeProFile *subProFile = subNode ? subNode->proFile() : nullptr;
|
|
||||||
if (subProFile) {
|
if (subProFile) {
|
||||||
QString makefile = subProFile->makefile();
|
QString makefile = subProFile->makefile();
|
||||||
if (makefile.isEmpty())
|
if (makefile.isEmpty())
|
||||||
|
|||||||
@@ -228,6 +228,28 @@ QmakeProFile *QmakeProFileNode::proFile() const
|
|||||||
return static_cast<QmakeProFile*>(QmakePriFileNode::priFile());
|
return static_cast<QmakeProFile*>(QmakePriFileNode::priFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QmakeProFileNode::makefile() const
|
||||||
|
{
|
||||||
|
return singleVariableValue(Variable::Makefile);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QmakeProFileNode::objectsDirectory() const
|
||||||
|
{
|
||||||
|
return singleVariableValue(Variable::ObjectsDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QmakeProFileNode::isDebugAndRelease() const
|
||||||
|
{
|
||||||
|
const QStringList configValues = variableValue(Variable::Config);
|
||||||
|
return configValues.contains(QLatin1String("debug_and_release"));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QmakeProFileNode::isQtcRunnable() const
|
||||||
|
{
|
||||||
|
const QStringList configValues = variableValue(Variable::Config);
|
||||||
|
return configValues.contains(QLatin1String("qtc_runnable"));
|
||||||
|
}
|
||||||
|
|
||||||
FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const
|
FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(files)
|
Q_UNUSED(files)
|
||||||
@@ -271,4 +293,18 @@ QString QmakeProFileNode::buildDir() const
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileName QmakeProFileNode::buildDir(QmakeBuildConfiguration *bc) const
|
||||||
|
{
|
||||||
|
const QmakeProFile *pro = proFile();
|
||||||
|
return pro ? pro->buildDir(bc) : FileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QmakeProFileNode::objectExtension() const
|
||||||
|
{
|
||||||
|
QStringList exts = variableValue(Variable::ObjectExt);
|
||||||
|
if (exts.isEmpty())
|
||||||
|
return HostOsInfo::isWindowsHost() ? QLatin1String(".obj") : QLatin1String(".o");
|
||||||
|
return exts.first();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QmakeProjectManager
|
} // namespace QmakeProjectManager
|
||||||
|
|||||||
@@ -82,12 +82,20 @@ public:
|
|||||||
|
|
||||||
QmakeProFile *proFile() const;
|
QmakeProFile *proFile() const;
|
||||||
|
|
||||||
|
QString makefile() const;
|
||||||
|
QString objectsDirectory() const;
|
||||||
|
QString objectExtension() const;
|
||||||
|
|
||||||
|
bool isDebugAndRelease() const;
|
||||||
|
bool isQtcRunnable() const;
|
||||||
|
|
||||||
bool showInSimpleTree() const override;
|
bool showInSimpleTree() const override;
|
||||||
|
|
||||||
AddNewInformation addNewInformation(const QStringList &files, Node *context) const override;
|
AddNewInformation addNewInformation(const QStringList &files, Node *context) const override;
|
||||||
|
|
||||||
QmakeProjectManager::ProjectType projectType() const;
|
QmakeProjectManager::ProjectType projectType() const;
|
||||||
QString buildDir() const;
|
QString buildDir() const;
|
||||||
|
Utils::FileName buildDir(QmakeBuildConfiguration *bc) const;
|
||||||
|
|
||||||
QStringList variableValue(const Variable var) const;
|
QStringList variableValue(const Variable var) const;
|
||||||
QString singleVariableValue(const Variable var) const;
|
QString singleVariableValue(const Variable var) const;
|
||||||
|
|||||||
@@ -1029,23 +1029,6 @@ const QmakeProFile *QmakeProFile::findProFile(const FileName &fileName) const
|
|||||||
return static_cast<const QmakeProFile *>(findPriFile(fileName));
|
return static_cast<const QmakeProFile *>(findPriFile(fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmakeProFile::makefile() const
|
|
||||||
{
|
|
||||||
return singleVariableValue(Variable::Makefile);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QmakeProFile::objectExtension() const
|
|
||||||
{
|
|
||||||
if (m_varValues[Variable::ObjectExt].isEmpty())
|
|
||||||
return HostOsInfo::isWindowsHost() ? QLatin1String(".obj") : QLatin1String(".o");
|
|
||||||
return m_varValues[Variable::ObjectExt].first();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QmakeProFile::objectsDirectory() const
|
|
||||||
{
|
|
||||||
return singleVariableValue(Variable::ObjectsDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray QmakeProFile::cxxDefines() const
|
QByteArray QmakeProFile::cxxDefines() const
|
||||||
{
|
{
|
||||||
QByteArray result;
|
QByteArray result;
|
||||||
@@ -1125,18 +1108,6 @@ QList<QmakeProFile *> QmakeProFile::allProFiles()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmakeProFile::isDebugAndRelease() const
|
|
||||||
{
|
|
||||||
const QStringList configValues = m_varValues.value(Variable::Config);
|
|
||||||
return configValues.contains(QLatin1String("debug_and_release"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QmakeProFile::isQtcRunnable() const
|
|
||||||
{
|
|
||||||
const QStringList configValues = m_varValues.value(Variable::Config);
|
|
||||||
return configValues.contains(QLatin1String("qtc_runnable"));
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectType QmakeProFile::projectType() const
|
ProjectType QmakeProFile::projectType() const
|
||||||
{
|
{
|
||||||
return m_projectType;
|
return m_projectType;
|
||||||
|
|||||||
@@ -303,9 +303,6 @@ public:
|
|||||||
TargetInformation targetInformation() const;
|
TargetInformation targetInformation() const;
|
||||||
InstallsList installsList() const;
|
InstallsList installsList() const;
|
||||||
|
|
||||||
QString makefile() const;
|
|
||||||
QString objectExtension() const;
|
|
||||||
QString objectsDirectory() const;
|
|
||||||
QByteArray cxxDefines() const;
|
QByteArray cxxDefines() const;
|
||||||
|
|
||||||
enum AsyncUpdateDelay { ParseNow, ParseLater };
|
enum AsyncUpdateDelay { ParseNow, ParseLater };
|
||||||
@@ -315,9 +312,6 @@ public:
|
|||||||
bool validParse() const;
|
bool validParse() const;
|
||||||
bool parseInProgress() const;
|
bool parseInProgress() const;
|
||||||
|
|
||||||
bool isDebugAndRelease() const;
|
|
||||||
bool isQtcRunnable() const;
|
|
||||||
|
|
||||||
void setParseInProgressRecursive(bool b);
|
void setParseInProgressRecursive(bool b);
|
||||||
|
|
||||||
void asyncUpdate();
|
void asyncUpdate();
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ bool QMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
QString makefile = workingDirectory + '/';
|
QString makefile = workingDirectory + '/';
|
||||||
|
|
||||||
if (qmakeBc->subNodeBuild()) {
|
if (qmakeBc->subNodeBuild()) {
|
||||||
QmakeProFile *pro = qmakeBc->subNodeBuild()->proFile();
|
QmakeProFileNode *pro = qmakeBc->subNodeBuild();
|
||||||
if (pro && !pro->makefile().isEmpty())
|
if (pro && !pro->makefile().isEmpty())
|
||||||
makefile.append(pro->makefile());
|
makefile.append(pro->makefile());
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user