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,9 +265,11 @@ QString BuildStep::fallbackWorkingDirectory() const
|
|||||||
|
|
||||||
void BuildStep::setupOutputFormatter(OutputFormatter *formatter)
|
void BuildStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||||
{
|
{
|
||||||
for (const Utils::Id id : buildConfiguration()->customParsers()) {
|
if (qobject_cast<BuildConfiguration *>(parent()->parent())) {
|
||||||
if (Internal::CustomParser * const parser = Internal::CustomParser::createFromId(id))
|
for (const Utils::Id id : buildConfiguration()->customParsers()) {
|
||||||
formatter->addLineParser(parser);
|
if (Internal::CustomParser * const parser = Internal::CustomParser::createFromId(id))
|
||||||
|
formatter->addLineParser(parser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Utils::FileInProjectFinder fileFinder;
|
Utils::FileInProjectFinder fileFinder;
|
||||||
fileFinder.setProjectDirectory(project()->projectDirectory());
|
fileFinder.setProjectDirectory(project()->projectDirectory());
|
||||||
|
@@ -109,16 +109,16 @@ QbsInstallStep::~QbsInstallStep()
|
|||||||
|
|
||||||
bool QbsInstallStep::init()
|
bool QbsInstallStep::init()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!buildSystem()->isParsing() && !m_session, return false);
|
QTC_ASSERT(!target()->buildSystem()->isParsing() && !m_session, return false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsInstallStep::doRun()
|
void QbsInstallStep::doRun()
|
||||||
{
|
{
|
||||||
m_session = static_cast<QbsBuildSystem *>(buildSystem())->session();
|
m_session = static_cast<QbsBuildSystem *>(target()->buildSystem())->session();
|
||||||
|
|
||||||
QJsonObject request;
|
QJsonObject request;
|
||||||
request.insert("type", "install");
|
request.insert("type", "install-project");
|
||||||
request.insert("install-root", installRoot());
|
request.insert("install-root", installRoot());
|
||||||
request.insert("clean-install-root", m_cleanInstallRoot);
|
request.insert("clean-install-root", m_cleanInstallRoot);
|
||||||
request.insert("keep-going", m_keepGoing);
|
request.insert("keep-going", m_keepGoing);
|
||||||
@@ -153,7 +153,7 @@ QString QbsInstallStep::installRoot() const
|
|||||||
|
|
||||||
const QbsBuildConfiguration *QbsInstallStep::buildConfig() const
|
const QbsBuildConfiguration *QbsInstallStep::buildConfig() const
|
||||||
{
|
{
|
||||||
return static_cast<QbsBuildConfiguration *>(buildConfiguration());
|
return static_cast<QbsBuildConfiguration *>(target()->activeBuildConfiguration());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QbsInstallStep::fromMap(const QVariantMap &map)
|
bool QbsInstallStep::fromMap(const QVariantMap &map)
|
||||||
|
@@ -267,7 +267,7 @@ QString QbsSession::errorString(QbsSession::Error error)
|
|||||||
case Error::QbsFailedToStart:
|
case Error::QbsFailedToStart:
|
||||||
return tr("The qbs process failed to start.");
|
return tr("The qbs process failed to start.");
|
||||||
case Error::ProtocolError:
|
case Error::ProtocolError:
|
||||||
return tr("The qbs process sent invalid data.");
|
return tr("The qbs process sent unexpected data.");
|
||||||
case Error::VersionMismatch:
|
case Error::VersionMismatch:
|
||||||
return tr("The qbs API level is not compatible with what Qt Creator expects.");
|
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") {
|
} else if (type == "run-environment") {
|
||||||
d->reply = packet;
|
d->reply = packet;
|
||||||
d->eventLoop.quit();
|
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