forked from qt-creator/qt-creator
AbstractProcessStep: Merge finish() with processFinished()
Change-Id: Ied15ec3ee9d3bcc80b03b2589d101c65f2fd062a Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -615,10 +615,11 @@ QWidget *AndroidBuildApkStep::createConfigWidget()
|
||||
return new AndroidBuildApkWidget(this);
|
||||
}
|
||||
|
||||
void AndroidBuildApkStep::processFinished(bool success)
|
||||
void AndroidBuildApkStep::finish(ProcessResult result)
|
||||
{
|
||||
if (m_openPackageLocationForRun && success)
|
||||
if (m_openPackageLocationForRun && isSuccess(result))
|
||||
QTimer::singleShot(0, this, &AndroidBuildApkStep::showInGraphicalShell);
|
||||
AbstractProcessStep::finish(result);
|
||||
}
|
||||
|
||||
bool AndroidBuildApkStep::verifyKeystorePassword()
|
||||
|
@@ -60,7 +60,7 @@ private:
|
||||
bool init() override;
|
||||
void setupOutputFormatter(Utils::OutputFormatter *formatter) override;
|
||||
QWidget *createConfigWidget() override;
|
||||
void processFinished(bool success) override;
|
||||
void finish(Utils::ProcessResult result) override;
|
||||
bool verifyKeystorePassword();
|
||||
bool verifyCertificatePassword();
|
||||
|
||||
|
@@ -682,10 +682,10 @@ QString CMakeBuildStep::baseEnvironmentText() const
|
||||
return Tr::tr("System Environment");
|
||||
}
|
||||
|
||||
void CMakeBuildStep::processFinished(bool success)
|
||||
void CMakeBuildStep::finish(ProcessResult result)
|
||||
{
|
||||
Q_UNUSED(success)
|
||||
emit progress(100, {});
|
||||
AbstractProcessStep::finish(result);
|
||||
}
|
||||
|
||||
// CMakeBuildStepFactory
|
||||
|
@@ -77,7 +77,7 @@ signals:
|
||||
private:
|
||||
Utils::CommandLine cmakeCommand() const;
|
||||
|
||||
void processFinished(bool success) override;
|
||||
void finish(Utils::ProcessResult result) override;
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
||||
bool init() override;
|
||||
|
@@ -36,7 +36,7 @@ public:
|
||||
private:
|
||||
CommandLine cmakeCommand() const;
|
||||
|
||||
void processFinished(bool success) override;
|
||||
void finish(ProcessResult result) override;
|
||||
|
||||
void setupOutputFormatter(OutputFormatter *formatter) override;
|
||||
QWidget *createConfigWidget() override;
|
||||
@@ -88,12 +88,11 @@ CommandLine CMakeInstallStep::cmakeCommand() const
|
||||
return cmd;
|
||||
}
|
||||
|
||||
void CMakeInstallStep::processFinished(bool success)
|
||||
void CMakeInstallStep::finish(ProcessResult result)
|
||||
{
|
||||
Q_UNUSED(success)
|
||||
emit progress(100, {});
|
||||
AbstractProcessStep::finish(result);
|
||||
}
|
||||
|
||||
QWidget *CMakeInstallStep::createConfigWidget()
|
||||
{
|
||||
auto updateDetails = [this] {
|
||||
|
@@ -174,7 +174,7 @@ void AbstractProcessStep::doRun()
|
||||
if (!wd.createDir()) {
|
||||
emit addOutput(tr("Could not create directory \"%1\"").arg(wd.toUserOutput()),
|
||||
OutputFormat::ErrorMessage);
|
||||
finish(false);
|
||||
finish(ProcessResult::StartFailed);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -290,23 +290,12 @@ void AbstractProcessStep::Private::cleanUp(int exitCode, QProcess::ExitStatus st
|
||||
OutputFormat::ErrorMessage);
|
||||
}
|
||||
|
||||
const bool success = exitCode == 0 && status == QProcess::NormalExit
|
||||
&& !outputFormatter->hasFatalErrors();
|
||||
q->processFinished(success);
|
||||
if (m_process)
|
||||
m_process.release()->deleteLater();
|
||||
q->finish(success || m_ignoreReturnValue);
|
||||
}
|
||||
|
||||
/*!
|
||||
Called after the process is finished.
|
||||
|
||||
The default implementation adds a line to the output window.
|
||||
*/
|
||||
|
||||
void AbstractProcessStep::processFinished(bool success)
|
||||
{
|
||||
Q_UNUSED(success)
|
||||
const ProcessResult result = (status == QProcess::NormalExit && exitCode == 0
|
||||
&& !outputFormatter->hasFatalErrors())
|
||||
? ProcessResult::FinishedWithSuccess : ProcessResult::FinishedWithError;
|
||||
q->finish(result);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -325,12 +314,18 @@ void AbstractProcessStep::processStartupFailed()
|
||||
QString err = d->m_process ? d->m_process->errorString() : QString();
|
||||
if (!err.isEmpty())
|
||||
emit addOutput(err, OutputFormat::ErrorMessage);
|
||||
finish(false);
|
||||
finish(ProcessResult::StartFailed);
|
||||
}
|
||||
|
||||
void AbstractProcessStep::finish(bool success)
|
||||
bool AbstractProcessStep::isSuccess(ProcessResult result) const
|
||||
{
|
||||
emit finished(success);
|
||||
return result == ProcessResult::FinishedWithSuccess
|
||||
|| (result == ProcessResult::FinishedWithError && d->m_ignoreReturnValue);
|
||||
}
|
||||
|
||||
void AbstractProcessStep::finish(ProcessResult result)
|
||||
{
|
||||
emit finished(isSuccess(result));
|
||||
}
|
||||
|
||||
void AbstractProcessStep::handleProcessDone()
|
||||
|
@@ -9,6 +9,7 @@
|
||||
|
||||
namespace Utils {
|
||||
class CommandLine;
|
||||
enum class ProcessResult;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -43,13 +44,13 @@ protected:
|
||||
void doCancel() override;
|
||||
void setLowPriority();
|
||||
void setDisplayedParameters(ProcessParameters *params);
|
||||
bool isSuccess(Utils::ProcessResult result) const;
|
||||
|
||||
virtual void finish(bool success);
|
||||
virtual void finish(Utils::ProcessResult result);
|
||||
|
||||
private:
|
||||
void processStartupFailed();
|
||||
ProcessParameters *displayedParameters() const;
|
||||
virtual void processFinished(bool success);
|
||||
void handleProcessDone();
|
||||
|
||||
class Private;
|
||||
|
@@ -40,7 +40,7 @@ public:
|
||||
QmakeMakeStep(BuildStepList *bsl, Id id);
|
||||
|
||||
private:
|
||||
void finish(bool success) override;
|
||||
void finish(ProcessResult result) override;
|
||||
bool init() override;
|
||||
void setupOutputFormatter(OutputFormatter *formatter) override;
|
||||
void doRun() override;
|
||||
@@ -219,15 +219,15 @@ void QmakeMakeStep::doRun()
|
||||
AbstractProcessStep::doRun();
|
||||
}
|
||||
|
||||
void QmakeMakeStep::finish(bool success)
|
||||
void QmakeMakeStep::finish(ProcessResult result)
|
||||
{
|
||||
if (!success && !isCanceled() && m_unalignedBuildDir
|
||||
if (!isSuccess(result) && !isCanceled() && m_unalignedBuildDir
|
||||
&& QmakeSettings::warnAgainstUnalignedBuildDir()) {
|
||||
const QString msg = Tr::tr("The build directory is not at the same level as the source "
|
||||
"directory, which could be the reason for the build failure.");
|
||||
emit addTask(BuildSystemTask(Task::Warning, msg));
|
||||
}
|
||||
MakeStep::finish(success);
|
||||
MakeStep::finish(result);
|
||||
}
|
||||
|
||||
QStringList QmakeMakeStep::displayArguments() const
|
||||
|
@@ -294,18 +294,15 @@ void QMakeStep::setForced(bool b)
|
||||
m_forced = b;
|
||||
}
|
||||
|
||||
void QMakeStep::processFinished(bool success)
|
||||
void QMakeStep::finish(ProcessResult result)
|
||||
{
|
||||
if (!success)
|
||||
m_needToRunQMake = true;
|
||||
emit buildConfiguration()->buildDirectoryInitialized();
|
||||
}
|
||||
if (result != ProcessResult::StartFailed)
|
||||
emit buildConfiguration()->buildDirectoryInitialized();
|
||||
|
||||
void QMakeStep::finish(bool success)
|
||||
{
|
||||
if (!success)
|
||||
if (result != ProcessResult::FinishedWithSuccess)
|
||||
m_needToRunQMake = true;
|
||||
m_wasSuccess = success;
|
||||
|
||||
m_wasSuccess = isSuccess(result);
|
||||
runNextCommand();
|
||||
}
|
||||
|
||||
|
@@ -139,8 +139,7 @@ protected:
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
||||
private:
|
||||
void finish(bool success) override;
|
||||
void processFinished(bool success) override;
|
||||
void finish(Utils::ProcessResult result) override;
|
||||
|
||||
void startOneCommand(const Utils::CommandLine &command);
|
||||
void runNextCommand();
|
||||
|
@@ -190,9 +190,9 @@ bool MakeInstallStep::init()
|
||||
return true;
|
||||
}
|
||||
|
||||
void MakeInstallStep::finish(bool success)
|
||||
void MakeInstallStep::finish(ProcessResult result)
|
||||
{
|
||||
if (success) {
|
||||
if (isSuccess(result)) {
|
||||
const FilePath rootDir = installRoot().onDevice(makeCommand());
|
||||
|
||||
m_deploymentData = DeploymentData();
|
||||
@@ -219,7 +219,7 @@ void MakeInstallStep::finish(bool success)
|
||||
emit addTask(DeploymentTask(Task::Warning, Tr::tr("You need to add an install statement "
|
||||
"to your CMakeLists.txt file for deployment to work.")));
|
||||
}
|
||||
MakeStep::finish(success);
|
||||
MakeStep::finish(result);
|
||||
}
|
||||
|
||||
FilePath MakeInstallStep::installRoot() const
|
||||
|
@@ -23,7 +23,7 @@ private:
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
QWidget *createConfigWidget() override;
|
||||
bool init() override;
|
||||
void finish(bool success) override;
|
||||
void finish(Utils::ProcessResult result) override;
|
||||
bool isJobCountSupported() const override { return false; }
|
||||
|
||||
Utils::FilePath installRoot() const;
|
||||
|
Reference in New Issue
Block a user