forked from qt-creator/qt-creator
Nim: De-Q_OBJECT-ify NimCompilerCleanStep
Change-Id: I3fce6484b90ac540009d0e5501a4435d15f241b6 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -40,6 +40,24 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
|
class NimCompilerCleanStep final : public BuildStep
|
||||||
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(Nim::NimCompilerCleanStep)
|
||||||
|
|
||||||
|
public:
|
||||||
|
NimCompilerCleanStep(BuildStepList *parentList, Core::Id id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool init() final;
|
||||||
|
void doRun() final;
|
||||||
|
void doCancel() final {} // Can be left empty. The run() function hardly does anything.
|
||||||
|
|
||||||
|
bool removeCacheDirectory();
|
||||||
|
bool removeOutFilePath();
|
||||||
|
|
||||||
|
Utils::FilePath m_buildDir;
|
||||||
|
};
|
||||||
|
|
||||||
NimCompilerCleanStep::NimCompilerCleanStep(BuildStepList *parentList, Core::Id id)
|
NimCompilerCleanStep::NimCompilerCleanStep(BuildStepList *parentList, Core::Id id)
|
||||||
: BuildStep(parentList, id)
|
: BuildStep(parentList, id)
|
||||||
{
|
{
|
||||||
@@ -68,32 +86,27 @@ bool NimCompilerCleanStep::init()
|
|||||||
void NimCompilerCleanStep::doRun()
|
void NimCompilerCleanStep::doRun()
|
||||||
{
|
{
|
||||||
if (!m_buildDir.exists()) {
|
if (!m_buildDir.exists()) {
|
||||||
emit addOutput(tr("Build directory \"%1\" does not exist.").arg(m_buildDir.toUserOutput()), BuildStep::OutputFormat::ErrorMessage);
|
emit addOutput(tr("Build directory \"%1\" does not exist.").arg(m_buildDir.toUserOutput()), OutputFormat::ErrorMessage);
|
||||||
emit finished(false);
|
emit finished(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!removeCacheDirectory()) {
|
if (!removeCacheDirectory()) {
|
||||||
emit addOutput(tr("Failed to delete the cache directory."), BuildStep::OutputFormat::ErrorMessage);
|
emit addOutput(tr("Failed to delete the cache directory."), OutputFormat::ErrorMessage);
|
||||||
emit finished(false);
|
emit finished(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!removeOutFilePath()) {
|
if (!removeOutFilePath()) {
|
||||||
emit addOutput(tr("Failed to delete the out file."), BuildStep::OutputFormat::ErrorMessage);
|
emit addOutput(tr("Failed to delete the out file."), OutputFormat::ErrorMessage);
|
||||||
emit finished(false);
|
emit finished(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit addOutput(tr("Clean step completed successfully."), BuildStep::OutputFormat::NormalMessage);
|
emit addOutput(tr("Clean step completed successfully."), OutputFormat::NormalMessage);
|
||||||
emit finished(true);
|
emit finished(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NimCompilerCleanStep::doCancel()
|
|
||||||
{
|
|
||||||
// Can be left empty. The run() function hardly does anything.
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NimCompilerCleanStep::removeCacheDirectory()
|
bool NimCompilerCleanStep::removeCacheDirectory()
|
||||||
{
|
{
|
||||||
auto bc = qobject_cast<NimBuildConfiguration*>(buildConfiguration());
|
auto bc = qobject_cast<NimBuildConfiguration*>(buildConfiguration());
|
||||||
|
@@ -26,30 +26,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/buildstep.h>
|
#include <projectexplorer/buildstep.h>
|
||||||
#include <projectexplorer/buildsteplist.h>
|
|
||||||
#include <utils/fileutils.h>
|
|
||||||
|
|
||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
class NimCompilerCleanStep : public ProjectExplorer::BuildStep
|
class NimCompilerCleanStepFactory final : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
NimCompilerCleanStep(ProjectExplorer::BuildStepList *parentList, Core::Id id);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool init() override;
|
|
||||||
void doRun() override;
|
|
||||||
void doCancel() override;
|
|
||||||
|
|
||||||
bool removeCacheDirectory();
|
|
||||||
bool removeOutFilePath();
|
|
||||||
|
|
||||||
Utils::FilePath m_buildDir;
|
|
||||||
};
|
|
||||||
|
|
||||||
class NimCompilerCleanStepFactory : public ProjectExplorer::BuildStepFactory
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NimCompilerCleanStepFactory();
|
NimCompilerCleanStepFactory();
|
||||||
|
Reference in New Issue
Block a user