forked from qt-creator/qt-creator
QbsProjectManager: Fix setting up extra compilers
There were a couple of typos breaking the functionality. Also separate updating extra compilers and the code model. Change-Id: Ie8f7bbf62d4b7817af3a26298401ad99c011b6e5 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -460,6 +460,7 @@ void QbsBuildSystem::updateAfterParse()
|
|||||||
updateDocuments();
|
updateDocuments();
|
||||||
updateBuildTargetData();
|
updateBuildTargetData();
|
||||||
updateCppCodeModel();
|
updateCppCodeModel();
|
||||||
|
updateExtraCompilers();
|
||||||
updateQmlJsCodeModel();
|
updateQmlJsCodeModel();
|
||||||
emit project()->fileListChanged();
|
emit project()->fileListChanged();
|
||||||
m_envCache.clear();
|
m_envCache.clear();
|
||||||
@@ -637,7 +638,7 @@ void QbsBuildSystem::updateAfterBuild()
|
|||||||
m_projectData = projectData;
|
m_projectData = projectData;
|
||||||
updateProjectNodes();
|
updateProjectNodes();
|
||||||
updateBuildTargetData();
|
updateBuildTargetData();
|
||||||
updateCppCodeModel(); // TODO: Should be updateExtraCompilers().
|
updateExtraCompilers();
|
||||||
m_envCache.clear();
|
m_envCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -809,7 +810,6 @@ static void getExpandedCompilerFlags(QStringList &cFlags, QStringList &cxxFlags,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Factor out the part that deals with extra compilers.
|
|
||||||
void QbsBuildSystem::updateCppCodeModel()
|
void QbsBuildSystem::updateCppCodeModel()
|
||||||
{
|
{
|
||||||
OpTimer optimer("updateCppCodeModel");
|
OpTimer optimer("updateCppCodeModel");
|
||||||
@@ -817,16 +817,11 @@ void QbsBuildSystem::updateCppCodeModel()
|
|||||||
if (projectData.isEmpty())
|
if (projectData.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QList<ExtraCompilerFactory *> factories =
|
|
||||||
ExtraCompilerFactory::extraCompilerFactories();
|
|
||||||
QHash<QString, QStringList> sourcesForGeneratedFiles;
|
|
||||||
m_sourcesForGeneratedFiles.clear();
|
|
||||||
|
|
||||||
const QtSupport::CppKitInfo kitInfo(kit());
|
const QtSupport::CppKitInfo kitInfo(kit());
|
||||||
QTC_ASSERT(kitInfo.isValid(), return);
|
QTC_ASSERT(kitInfo.isValid(), return);
|
||||||
|
|
||||||
RawProjectParts rpps;
|
RawProjectParts rpps;
|
||||||
forAllProducts(projectData, [&, this](const QJsonObject &prd) {
|
forAllProducts(projectData, [&](const QJsonObject &prd) {
|
||||||
const QString productName = prd.value("full-display-name").toString();
|
const QString productName = prd.value("full-display-name").toString();
|
||||||
QString cPch;
|
QString cPch;
|
||||||
QString cxxPch;
|
QString cxxPch;
|
||||||
@@ -903,7 +898,7 @@ void QbsBuildSystem::updateCppCodeModel()
|
|||||||
bool hasCxxFiles = false;
|
bool hasCxxFiles = false;
|
||||||
bool hasObjcFiles = false;
|
bool hasObjcFiles = false;
|
||||||
bool hasObjcxxFiles = false;
|
bool hasObjcxxFiles = false;
|
||||||
const auto artifactWorker = [&, this](const QJsonObject &source) {
|
const auto artifactWorker = [&](const QJsonObject &source) {
|
||||||
const QString filePath = source.value("file-path").toString();
|
const QString filePath = source.value("file-path").toString();
|
||||||
filePathToSourceArtifact.insert(filePath, source);
|
filePathToSourceArtifact.insert(filePath, source);
|
||||||
for (const QJsonValue &tag : source.value("file-tags").toArray()) {
|
for (const QJsonValue &tag : source.value("file-tags").toArray()) {
|
||||||
@@ -915,12 +910,6 @@ void QbsBuildSystem::updateCppCodeModel()
|
|||||||
hasObjcFiles = true;
|
hasObjcFiles = true;
|
||||||
else if (tag == "objcpp")
|
else if (tag == "objcpp")
|
||||||
hasObjcxxFiles = true;
|
hasObjcxxFiles = true;
|
||||||
for (auto i = factories.cbegin(); i != factories.cend(); ++i) {
|
|
||||||
if ((*i)->sourceTag() == tag.toString()) {
|
|
||||||
m_sourcesForGeneratedFiles[*i] << filePath;
|
|
||||||
sourcesForGeneratedFiles[productName] << filePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
forAllArtifacts(grp, artifactWorker);
|
forAllArtifacts(grp, artifactWorker);
|
||||||
@@ -959,6 +948,34 @@ void QbsBuildSystem::updateCppCodeModel()
|
|||||||
});
|
});
|
||||||
|
|
||||||
m_cppCodeModelUpdater->update({project(), kitInfo, activeParseEnvironment(), rpps});
|
m_cppCodeModelUpdater->update({project(), kitInfo, activeParseEnvironment(), rpps});
|
||||||
|
}
|
||||||
|
|
||||||
|
void QbsBuildSystem::updateExtraCompilers()
|
||||||
|
{
|
||||||
|
OpTimer optimer("updateExtraCompilers");
|
||||||
|
const QJsonObject projectData = session()->projectData();
|
||||||
|
if (projectData.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const QList<ExtraCompilerFactory *> factories = ExtraCompilerFactory::extraCompilerFactories();
|
||||||
|
QHash<QString, QStringList> sourcesForGeneratedFiles;
|
||||||
|
m_sourcesForGeneratedFiles.clear();
|
||||||
|
|
||||||
|
forAllProducts(projectData, [&, this](const QJsonObject &prd) {
|
||||||
|
const QString productName = prd.value("full-display-name").toString();
|
||||||
|
forAllArtifacts(prd, ArtifactType::Source, [&, this](const QJsonObject &source) {
|
||||||
|
const QString filePath = source.value("file-path").toString();
|
||||||
|
for (const QJsonValue &tag : source.value("file-tags").toArray()) {
|
||||||
|
for (auto i = factories.cbegin(); i != factories.cend(); ++i) {
|
||||||
|
if ((*i)->sourceTag() == tag.toString()) {
|
||||||
|
m_sourcesForGeneratedFiles[*i] << filePath;
|
||||||
|
sourcesForGeneratedFiles[productName] << filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
if (!sourcesForGeneratedFiles.isEmpty())
|
if (!sourcesForGeneratedFiles.isEmpty())
|
||||||
session()->requestFilesGeneratedFrom(sourcesForGeneratedFiles);
|
session()->requestFilesGeneratedFrom(sourcesForGeneratedFiles);
|
||||||
}
|
}
|
||||||
|
@@ -134,6 +134,7 @@ private:
|
|||||||
void updateDocuments();
|
void updateDocuments();
|
||||||
void updateCppCodeModel();
|
void updateCppCodeModel();
|
||||||
void updateQmlJsCodeModel();
|
void updateQmlJsCodeModel();
|
||||||
|
void updateExtraCompilers();
|
||||||
void updateApplicationTargets();
|
void updateApplicationTargets();
|
||||||
void updateDeploymentInfo();
|
void updateDeploymentInfo();
|
||||||
void updateBuildTargetData();
|
void updateBuildTargetData();
|
||||||
|
@@ -317,7 +317,7 @@ void QbsSession::requestFilesGeneratedFrom(const QHash<QString, QStringList> &so
|
|||||||
QJsonArray products;
|
QJsonArray products;
|
||||||
for (auto it = sourceFilesPerProduct.cbegin(); it != sourceFilesPerProduct.cend(); ++it) {
|
for (auto it = sourceFilesPerProduct.cbegin(); it != sourceFilesPerProduct.cend(); ++it) {
|
||||||
QJsonObject product;
|
QJsonObject product;
|
||||||
product.insert("full-display-name", it->first());
|
product.insert("full-display-name", it.key());
|
||||||
QJsonArray requests;
|
QJsonArray requests;
|
||||||
for (const QString &sourceFile : it.value())
|
for (const QString &sourceFile : it.value())
|
||||||
requests << QJsonObject({qMakePair(QString("source-file"), sourceFile)});
|
requests << QJsonObject({qMakePair(QString("source-file"), sourceFile)});
|
||||||
@@ -504,7 +504,7 @@ void QbsSession::handlePacket(const QJsonObject &packet)
|
|||||||
emit taskProgress(packet.value("progress").toInt());
|
emit taskProgress(packet.value("progress").toInt());
|
||||||
} else if (type == "new-max-progress") {
|
} else if (type == "new-max-progress") {
|
||||||
emit maxProgressChanged(packet.value("max-progress").toInt());
|
emit maxProgressChanged(packet.value("max-progress").toInt());
|
||||||
} else if (type == "generated-files-for-source") {
|
} else if (type == "generated-files-for-sources") {
|
||||||
QHash<QString, QStringList> generatedFiles;
|
QHash<QString, QStringList> generatedFiles;
|
||||||
for (const QJsonValue &product : packet.value("products").toArray()) {
|
for (const QJsonValue &product : packet.value("products").toArray()) {
|
||||||
for (const QJsonValue &r : product.toObject().value("results").toArray()) {
|
for (const QJsonValue &r : product.toObject().value("results").toArray()) {
|
||||||
|
Reference in New Issue
Block a user