forked from qt-creator/qt-creator
QbsProjectManager: Fix install step
We got the install command name wrong, which caused the installation to fail. In addition, we forgot to add handling for the "protocol-error" message from qbs, so the step was hanging, rather than aborting. Finally, we triggered a number of assertions in BuildStep::buildConfiguration(). This went all unnoticed for a while, because the install step is not enabled by default these days. Change-Id: I906e7e472563d4ad8fc7557bd706a7cb67f9f2ba Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -265,10 +265,12 @@ QString BuildStep::fallbackWorkingDirectory() const
|
||||
|
||||
void BuildStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
{
|
||||
if (qobject_cast<BuildConfiguration *>(parent()->parent())) {
|
||||
for (const Utils::Id id : buildConfiguration()->customParsers()) {
|
||||
if (Internal::CustomParser * const parser = Internal::CustomParser::createFromId(id))
|
||||
formatter->addLineParser(parser);
|
||||
}
|
||||
}
|
||||
Utils::FileInProjectFinder fileFinder;
|
||||
fileFinder.setProjectDirectory(project()->projectDirectory());
|
||||
fileFinder.setProjectFiles(project()->files(Project::AllFiles));
|
||||
|
@@ -109,16 +109,16 @@ QbsInstallStep::~QbsInstallStep()
|
||||
|
||||
bool QbsInstallStep::init()
|
||||
{
|
||||
QTC_ASSERT(!buildSystem()->isParsing() && !m_session, return false);
|
||||
QTC_ASSERT(!target()->buildSystem()->isParsing() && !m_session, return false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void QbsInstallStep::doRun()
|
||||
{
|
||||
m_session = static_cast<QbsBuildSystem *>(buildSystem())->session();
|
||||
m_session = static_cast<QbsBuildSystem *>(target()->buildSystem())->session();
|
||||
|
||||
QJsonObject request;
|
||||
request.insert("type", "install");
|
||||
request.insert("type", "install-project");
|
||||
request.insert("install-root", installRoot());
|
||||
request.insert("clean-install-root", m_cleanInstallRoot);
|
||||
request.insert("keep-going", m_keepGoing);
|
||||
@@ -153,7 +153,7 @@ QString QbsInstallStep::installRoot() const
|
||||
|
||||
const QbsBuildConfiguration *QbsInstallStep::buildConfig() const
|
||||
{
|
||||
return static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
||||
return static_cast<QbsBuildConfiguration *>(target()->activeBuildConfiguration());
|
||||
}
|
||||
|
||||
bool QbsInstallStep::fromMap(const QVariantMap &map)
|
||||
|
@@ -267,7 +267,7 @@ QString QbsSession::errorString(QbsSession::Error error)
|
||||
case Error::QbsFailedToStart:
|
||||
return tr("The qbs process failed to start.");
|
||||
case Error::ProtocolError:
|
||||
return tr("The qbs process sent invalid data.");
|
||||
return tr("The qbs process sent unexpected data.");
|
||||
case Error::VersionMismatch:
|
||||
return tr("The qbs API level is not compatible with what Qt Creator expects.");
|
||||
}
|
||||
@@ -534,6 +534,15 @@ void QbsSession::handlePacket(const QJsonObject &packet)
|
||||
} else if (type == "run-environment") {
|
||||
d->reply = packet;
|
||||
d->eventLoop.quit();
|
||||
} else if (type == "protocol-error") {
|
||||
const ErrorInfo errorInfo = ErrorInfo(packet.value("error").toObject());
|
||||
|
||||
// TODO: This loop occurs a lot. Factor it out.
|
||||
for (const ErrorInfoItem &item : errorInfo.items) {
|
||||
TaskHub::addTask(BuildSystemTask(Task::Error, item.description,
|
||||
item.filePath, item.line));
|
||||
}
|
||||
setError(Error::ProtocolError);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user