forked from qt-creator/qt-creator
AbstractProcessStep: Remove two virtual methods
Remove stdOutput() and stdError() virtual methods. Connect to addOutput() signal in subclasses instead and filter for desired channel. Change-Id: Ifd9a2e4ff037776caa706bbdb9634992060172ff Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -456,6 +456,11 @@ AndroidBuildApkStep::AndroidBuildApkStep(BuildStepList *parent, Utils::Id id)
|
|||||||
{
|
{
|
||||||
setImmutable(true);
|
setImmutable(true);
|
||||||
setDisplayName(Tr::tr("Build Android APK"));
|
setDisplayName(Tr::tr("Build Android APK"));
|
||||||
|
|
||||||
|
connect(this, &BuildStep::addOutput, this, [this](const QString &string, OutputFormat format) {
|
||||||
|
if (format == OutputFormat::Stderr)
|
||||||
|
stdError(string);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AndroidBuildApkStep::init()
|
bool AndroidBuildApkStep::init()
|
||||||
@@ -872,8 +877,6 @@ void AndroidBuildApkStep::setBuildTargetSdk(const QString &sdk)
|
|||||||
|
|
||||||
void AndroidBuildApkStep::stdError(const QString &output)
|
void AndroidBuildApkStep::stdError(const QString &output)
|
||||||
{
|
{
|
||||||
AbstractProcessStep::stdError(output);
|
|
||||||
|
|
||||||
QString newOutput = output;
|
QString newOutput = output;
|
||||||
newOutput.remove(QRegularExpression("^(\\n)+"));
|
newOutput.remove(QRegularExpression("^(\\n)+"));
|
||||||
|
|
||||||
|
@@ -52,8 +52,6 @@ public:
|
|||||||
QString buildTargetSdk() const;
|
QString buildTargetSdk() const;
|
||||||
void setBuildTargetSdk(const QString &sdk);
|
void setBuildTargetSdk(const QString &sdk);
|
||||||
|
|
||||||
void stdError(const QString &output) override;
|
|
||||||
|
|
||||||
QVariant data(Utils::Id id) const override;
|
QVariant data(Utils::Id id) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -67,6 +65,7 @@ private:
|
|||||||
bool verifyCertificatePassword();
|
bool verifyCertificatePassword();
|
||||||
|
|
||||||
void doRun() override;
|
void doRun() override;
|
||||||
|
void stdError(const QString &output);
|
||||||
|
|
||||||
void reportWarningOrError(const QString &message, ProjectExplorer::Task::TaskType type);
|
void reportWarningOrError(const QString &message, ProjectExplorer::Task::TaskType type);
|
||||||
|
|
||||||
|
@@ -205,10 +205,12 @@ void AbstractProcessStep::doRun()
|
|||||||
d->m_process->setLowPriority();
|
d->m_process->setLowPriority();
|
||||||
|
|
||||||
connect(d->m_process.get(), &QtcProcess::readyReadStandardOutput, this, [this] {
|
connect(d->m_process.get(), &QtcProcess::readyReadStandardOutput, this, [this] {
|
||||||
stdOutput(d->stdoutStream->toUnicode(d->m_process->readAllStandardOutput()));
|
emit addOutput(d->stdoutStream->toUnicode(d->m_process->readAllStandardOutput()),
|
||||||
|
OutputFormat::Stdout, DontAppendNewline);
|
||||||
});
|
});
|
||||||
connect(d->m_process.get(), &QtcProcess::readyReadStandardError, this, [this] {
|
connect(d->m_process.get(), &QtcProcess::readyReadStandardError, this, [this] {
|
||||||
stdError(d->stderrStream->toUnicode(d->m_process->readAllStandardError()));
|
emit addOutput(d->stderrStream->toUnicode(d->m_process->readAllStandardError()),
|
||||||
|
OutputFormat::Stderr, DontAppendNewline);
|
||||||
});
|
});
|
||||||
connect(d->m_process.get(), &QtcProcess::started, this, [this] {
|
connect(d->m_process.get(), &QtcProcess::started, this, [this] {
|
||||||
ProcessParameters *params = displayedParameters();
|
ProcessParameters *params = displayedParameters();
|
||||||
@@ -326,28 +328,6 @@ void AbstractProcessStep::processStartupFailed()
|
|||||||
finish(false);
|
finish(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Called for each line of output on stdOut().
|
|
||||||
|
|
||||||
The default implementation adds the line to the application output window.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void AbstractProcessStep::stdOutput(const QString &output)
|
|
||||||
{
|
|
||||||
emit addOutput(output, OutputFormat::Stdout, DontAppendNewline);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Called for each line of output on StdErrror().
|
|
||||||
|
|
||||||
The default implementation adds the line to the application output window.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void AbstractProcessStep::stdError(const QString &output)
|
|
||||||
{
|
|
||||||
emit addOutput(output, OutputFormat::Stderr, DontAppendNewline);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractProcessStep::finish(bool success)
|
void AbstractProcessStep::finish(bool success)
|
||||||
{
|
{
|
||||||
emit finished(success);
|
emit finished(success);
|
||||||
|
@@ -45,8 +45,6 @@ protected:
|
|||||||
void setDisplayedParameters(ProcessParameters *params);
|
void setDisplayedParameters(ProcessParameters *params);
|
||||||
|
|
||||||
virtual void finish(bool success);
|
virtual void finish(bool success);
|
||||||
virtual void stdOutput(const QString &output);
|
|
||||||
virtual void stdError(const QString &output);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processStartupFailed();
|
void processStartupFailed();
|
||||||
|
@@ -115,6 +115,13 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent, Id id) : MakeStep(parent
|
|||||||
const MakeInstallCommand cmd = buildSystem()->makeInstallCommand(rootPath);
|
const MakeInstallCommand cmd = buildSystem()->makeInstallCommand(rootPath);
|
||||||
QTC_ASSERT(!cmd.command.isEmpty(), return);
|
QTC_ASSERT(!cmd.command.isEmpty(), return);
|
||||||
makeAspect->setExecutable(cmd.command.executable());
|
makeAspect->setExecutable(cmd.command.executable());
|
||||||
|
|
||||||
|
connect(this, &BuildStep::addOutput, this, [this](const QString &string, OutputFormat format) {
|
||||||
|
// When using Makefiles: "No rule to make target 'install'"
|
||||||
|
// When using ninja: "ninja: error: unknown target 'install'"
|
||||||
|
if (format == OutputFormat::Stderr && string.contains("target 'install'"))
|
||||||
|
m_noInstallTarget = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Id MakeInstallStep::stepId()
|
Utils::Id MakeInstallStep::stepId()
|
||||||
@@ -215,15 +222,6 @@ void MakeInstallStep::finish(bool success)
|
|||||||
MakeStep::finish(success);
|
MakeStep::finish(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeInstallStep::stdError(const QString &line)
|
|
||||||
{
|
|
||||||
// When using Makefiles: "No rule to make target 'install'"
|
|
||||||
// When using ninja: "ninja: error: unknown target 'install'"
|
|
||||||
if (line.contains("target 'install'"))
|
|
||||||
m_noInstallTarget = true;
|
|
||||||
MakeStep::stdError(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
FilePath MakeInstallStep::installRoot() const
|
FilePath MakeInstallStep::installRoot() const
|
||||||
{
|
{
|
||||||
return static_cast<StringAspect *>(aspect(InstallRootAspectId))->filePath();
|
return static_cast<StringAspect *>(aspect(InstallRootAspectId))->filePath();
|
||||||
|
@@ -24,7 +24,6 @@ private:
|
|||||||
QWidget *createConfigWidget() override;
|
QWidget *createConfigWidget() override;
|
||||||
bool init() override;
|
bool init() override;
|
||||||
void finish(bool success) override;
|
void finish(bool success) override;
|
||||||
void stdError(const QString &line) 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