Files
qt-creator/src/plugins/haskell/stackbuildstep.cpp
hjk e28110f6fd Haskell: Use new setup pattern for StackBuildStep
Change-Id: Id78047e755a3419499d804ada3edb7ec75fa61d1
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-11-20 15:06:49 +00:00

69 lines
1.8 KiB
C++

// Copyright (c) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "stackbuildstep.h"
#include "haskellconstants.h"
#include "haskellsettings.h"
#include "haskelltr.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/processparameters.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
using namespace ProjectExplorer;
namespace Haskell::Internal {
static QString trDisplayName()
{
return Tr::tr("Stack Build");
}
class StackBuildStep final : public AbstractProcessStep
{
public:
StackBuildStep(BuildStepList *bsl, Utils::Id id)
: AbstractProcessStep(bsl, id)
{
setDefaultDisplayName(trDisplayName());
}
QWidget *createConfigWidget() final
{
return new QWidget;
}
bool init() final
{
if (AbstractProcessStep::init()) {
const auto projectDir = QDir(project()->projectDirectory().toString());
processParameters()->setCommandLine(
{settings().stackPath(),
{"build", "--work-dir", projectDir.relativeFilePath(buildDirectory().toString())}});
processParameters()->setEnvironment(buildEnvironment());
}
return true;
}
};
class StackBuildStepFactory final : public BuildStepFactory
{
public:
StackBuildStepFactory()
{
registerStep<StackBuildStep>(Constants::C_STACK_BUILD_STEP_ID);
setDisplayName(trDisplayName());
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}
};
void setupHaskellStackBuildStep()
{
static StackBuildStepFactory theStackBuildStepFactory;
}
} // Haskell::Internal