2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 Openismus GmbH.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2011-11-29 14:19:28 +01:00
|
|
|
|
|
|
|
|
#include "configurestep.h"
|
2019-08-13 12:47:11 +02:00
|
|
|
|
2011-11-29 14:19:28 +01:00
|
|
|
#include "autotoolsprojectconstants.h"
|
2022-09-29 17:11:01 +02:00
|
|
|
#include "autotoolsprojectmanagertr.h"
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
#include <projectexplorer/abstractprocessstep.h>
|
2018-11-17 21:19:04 +02:00
|
|
|
#include <projectexplorer/processparameters.h>
|
2019-08-13 12:47:11 +02:00
|
|
|
#include <projectexplorer/project.h>
|
2020-09-18 12:11:40 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2019-08-13 12:47:11 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-09-18 12:11:40 +02:00
|
|
|
#include <utils/aspects.h>
|
2023-07-12 14:51:25 +02:00
|
|
|
#include <utils/process.h>
|
2020-09-18 12:11:40 +02:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDateTime>
|
2011-11-29 14:19:28 +01:00
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
2019-06-21 08:31:37 +02:00
|
|
|
using namespace Utils;
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2022-09-29 17:11:01 +02:00
|
|
|
namespace AutotoolsProjectManager::Internal {
|
2020-01-09 14:00:22 +01:00
|
|
|
|
|
|
|
|
// ConfigureStep
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
///**
|
|
|
|
|
// * @brief Implementation of the ProjectExplorer::AbstractProcessStep interface.
|
|
|
|
|
// *
|
|
|
|
|
// * A configure step can be configured by selecting the "Projects" button of Qt
|
|
|
|
|
// * Creator (in the left hand side menu) and under "Build Settings".
|
|
|
|
|
// *
|
|
|
|
|
// * It is possible for the user to specify custom arguments. The corresponding
|
|
|
|
|
// * configuration widget is created by MakeStep::createConfigWidget and is
|
|
|
|
|
// * represented by an instance of the class MakeStepConfigWidget.
|
|
|
|
|
// */
|
|
|
|
|
|
2020-10-05 12:42:37 +02:00
|
|
|
class ConfigureStep final : public AbstractProcessStep
|
2011-11-29 14:19:28 +01:00
|
|
|
{
|
2020-01-09 14:00:22 +01:00
|
|
|
public:
|
2023-07-06 10:15:53 +02:00
|
|
|
ConfigureStep(BuildStepList *bsl, Id id)
|
|
|
|
|
: AbstractProcessStep(bsl, id)
|
|
|
|
|
{
|
|
|
|
|
arguments.setDisplayStyle(StringAspect::LineEditDisplay);
|
|
|
|
|
arguments.setSettingsKey("AutotoolsProjectManager.ConfigureStep.AdditionalArguments");
|
|
|
|
|
arguments.setLabelText(Tr::tr("Arguments:"));
|
|
|
|
|
arguments.setHistoryCompleter("AutotoolsPM.History.ConfigureArgs");
|
|
|
|
|
|
|
|
|
|
connect(&arguments, &BaseAspect::changed, this, [this] {
|
|
|
|
|
m_runConfigure = true;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setCommandLineProvider([this] {
|
|
|
|
|
return getCommandLine(arguments());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setSummaryUpdater([this] {
|
|
|
|
|
ProcessParameters param;
|
|
|
|
|
setupProcessParameters(¶m);
|
|
|
|
|
|
|
|
|
|
return param.summaryInWorkdir(displayName());
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-01-09 14:00:22 +01:00
|
|
|
|
|
|
|
|
private:
|
2023-07-12 16:30:33 +02:00
|
|
|
Tasking::GroupItem runRecipe() final;
|
2020-01-09 14:00:22 +01:00
|
|
|
|
2023-07-06 10:15:53 +02:00
|
|
|
CommandLine getCommandLine(const QString &arguments)
|
|
|
|
|
{
|
|
|
|
|
return {project()->projectDirectory() / "configure", arguments, CommandLine::Raw};
|
|
|
|
|
}
|
2021-12-17 11:05:21 +01:00
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
bool m_runConfigure = false;
|
2023-07-06 10:15:53 +02:00
|
|
|
StringAspect arguments{this};
|
2020-01-09 14:00:22 +01:00
|
|
|
};
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2023-07-12 16:30:33 +02:00
|
|
|
Tasking::GroupItem ConfigureStep::runRecipe()
|
2011-11-29 14:19:28 +01:00
|
|
|
{
|
2023-07-12 14:51:25 +02:00
|
|
|
using namespace Tasking;
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2023-07-12 14:51:25 +02:00
|
|
|
const auto onSetup = [this] {
|
|
|
|
|
// Check whether we need to run configure
|
|
|
|
|
const FilePath configure = project()->projectDirectory() / "configure";
|
|
|
|
|
const FilePath configStatus = buildDirectory() / "config.status";
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2023-07-12 14:51:25 +02:00
|
|
|
if (!configStatus.exists() || configStatus.lastModified() < configure.lastModified())
|
|
|
|
|
m_runConfigure = true;
|
2021-12-17 11:05:21 +01:00
|
|
|
|
2023-07-12 14:51:25 +02:00
|
|
|
if (!m_runConfigure) {
|
|
|
|
|
emit addOutput(Tr::tr("Configuration unchanged, skipping configure step."), OutputFormat::NormalMessage);
|
2023-11-04 12:57:23 +01:00
|
|
|
return SetupResult::StopWithSuccess;
|
2023-07-12 14:51:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProcessParameters *param = processParameters();
|
|
|
|
|
if (!param->effectiveCommand().exists()) {
|
|
|
|
|
param->setCommandLine(getCommandLine(param->command().arguments()));
|
|
|
|
|
setSummaryText(param->summaryInWorkdir(displayName()));
|
|
|
|
|
}
|
|
|
|
|
return SetupResult::Continue;
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-03 18:50:32 +01:00
|
|
|
return Group {
|
|
|
|
|
onGroupSetup(onSetup),
|
|
|
|
|
onGroupDone([this] { m_runConfigure = false; }, CallDoneIf::Success),
|
|
|
|
|
defaultProcessTask()
|
|
|
|
|
};
|
2011-11-29 14:19:28 +01:00
|
|
|
}
|
2020-01-09 14:00:22 +01:00
|
|
|
|
|
|
|
|
// ConfigureStepFactory
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Implementation of the ProjectExplorer::IBuildStepFactory interface.
|
|
|
|
|
*
|
|
|
|
|
* The factory is used to create instances of ConfigureStep.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
ConfigureStepFactory::ConfigureStepFactory()
|
|
|
|
|
{
|
|
|
|
|
registerStep<ConfigureStep>(Constants::CONFIGURE_STEP_ID);
|
2022-09-29 17:11:01 +02:00
|
|
|
setDisplayName(Tr::tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id."));
|
2020-01-09 14:00:22 +01:00
|
|
|
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
|
|
|
|
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-29 17:11:01 +02:00
|
|
|
} // AutotoolsProjectManager::Internal
|