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