2023-01-27 14:44:20 +01:00
|
|
|
// Copyright (c) 2017 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2023-01-19 17:34:40 +01:00
|
|
|
|
|
|
|
|
#include "stackbuildstep.h"
|
|
|
|
|
|
|
|
|
|
#include "haskellconstants.h"
|
2023-05-15 15:15:17 +02:00
|
|
|
#include "haskellsettings.h"
|
2023-02-10 17:12:59 +01:00
|
|
|
#include "haskelltr.h"
|
2023-01-19 17:34:40 +01:00
|
|
|
|
2023-11-20 12:13:01 +01:00
|
|
|
#include <projectexplorer/abstractprocessstep.h>
|
2023-01-19 17:34:40 +01:00
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
|
|
|
|
#include <projectexplorer/processparameters.h>
|
|
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
2023-11-20 12:13:01 +01:00
|
|
|
namespace Haskell::Internal {
|
2023-01-19 17:34:40 +01:00
|
|
|
|
2023-11-20 12:13:01 +01:00
|
|
|
static QString trDisplayName()
|
2023-01-19 17:34:40 +01:00
|
|
|
{
|
2023-11-20 12:13:01 +01:00
|
|
|
return Tr::tr("Stack Build");
|
2023-01-19 17:34:40 +01:00
|
|
|
}
|
|
|
|
|
|
2023-11-20 12:13:01 +01:00
|
|
|
class StackBuildStep final : public AbstractProcessStep
|
2023-01-19 17:34:40 +01:00
|
|
|
{
|
2023-11-20 12:13:01 +01:00
|
|
|
public:
|
|
|
|
|
StackBuildStep(BuildStepList *bsl, Utils::Id id)
|
|
|
|
|
: AbstractProcessStep(bsl, id)
|
|
|
|
|
{
|
|
|
|
|
setDefaultDisplayName(trDisplayName());
|
|
|
|
|
}
|
2023-01-19 17:34:40 +01:00
|
|
|
|
2023-11-20 12:13:01 +01:00
|
|
|
QWidget *createConfigWidget() final
|
|
|
|
|
{
|
|
|
|
|
return new QWidget;
|
|
|
|
|
}
|
2023-01-19 17:34:40 +01:00
|
|
|
|
2023-11-20 12:13:01 +01:00
|
|
|
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
|
2023-01-19 17:34:40 +01:00
|
|
|
{
|
2023-11-20 12:13:01 +01:00
|
|
|
public:
|
|
|
|
|
StackBuildStepFactory()
|
|
|
|
|
{
|
|
|
|
|
registerStep<StackBuildStep>(Constants::C_STACK_BUILD_STEP_ID);
|
|
|
|
|
setDisplayName(trDisplayName());
|
|
|
|
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
2023-01-19 17:34:40 +01:00
|
|
|
}
|
2023-11-20 12:13:01 +01:00
|
|
|
};
|
2023-01-19 17:34:40 +01:00
|
|
|
|
2023-11-20 12:13:01 +01:00
|
|
|
void setupHaskellStackBuildStep()
|
2023-01-19 17:34:40 +01:00
|
|
|
{
|
2023-11-20 12:13:01 +01:00
|
|
|
static StackBuildStepFactory theStackBuildStepFactory;
|
2023-01-19 17:34:40 +01:00
|
|
|
}
|
|
|
|
|
|
2023-11-20 12:13:01 +01:00
|
|
|
} // Haskell::Internal
|