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 "autoreconfstep.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-10-17 13:01:19 +02:00
|
|
|
#include <projectexplorer/buildconfiguration.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>
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-09-18 12:11:40 +02:00
|
|
|
#include <utils/aspects.h>
|
2023-07-12 14:25:08 +02:00
|
|
|
#include <utils/process.h>
|
2020-09-18 12:11:40 +02:00
|
|
|
|
2011-11-29 14:19:28 +01:00
|
|
|
using namespace ProjectExplorer;
|
2020-09-18 12:11:40 +02:00
|
|
|
using namespace Utils;
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2022-09-29 17:11:01 +02:00
|
|
|
namespace AutotoolsProjectManager::Internal {
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2023-01-17 15:51:29 +01:00
|
|
|
// AutoreconfStep
|
2020-01-09 14:00:22 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Implementation of the ProjectExplorer::AbstractProcessStep interface.
|
|
|
|
|
*
|
|
|
|
|
* A autoreconf 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2020-10-05 12:42:37 +02:00
|
|
|
class AutoreconfStep final : public AbstractProcessStep
|
2011-11-29 14:19:28 +01:00
|
|
|
{
|
2020-01-09 14:00:22 +01:00
|
|
|
public:
|
2023-06-29 18:00:06 +02:00
|
|
|
AutoreconfStep(BuildStepList *bsl, Id id)
|
|
|
|
|
: AbstractProcessStep(bsl, id)
|
|
|
|
|
{
|
|
|
|
|
arguments.setSettingsKey("AutotoolsProjectManager.AutoreconfStep.AdditionalArguments");
|
|
|
|
|
arguments.setLabelText(Tr::tr("Arguments:"));
|
|
|
|
|
arguments.setValue("--force --install");
|
|
|
|
|
arguments.setDisplayStyle(StringAspect::LineEditDisplay);
|
|
|
|
|
arguments.setHistoryCompleter("AutotoolsPM.History.AutoreconfStepArgs");
|
|
|
|
|
|
|
|
|
|
connect(&arguments, &BaseAspect::changed, this, [this] { m_runAutoreconf = true; });
|
|
|
|
|
|
|
|
|
|
setCommandLineProvider([this] {
|
|
|
|
|
return CommandLine("autoreconf", arguments(), CommandLine::Raw);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setWorkingDirectoryProvider([this] {
|
|
|
|
|
return project()->projectDirectory();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setSummaryUpdater([this] {
|
|
|
|
|
ProcessParameters param;
|
|
|
|
|
setupProcessParameters(¶m);
|
|
|
|
|
return param.summary(displayName());
|
|
|
|
|
});
|
|
|
|
|
}
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2023-07-12 16:30:33 +02:00
|
|
|
private:
|
|
|
|
|
Tasking::GroupItem runRecipe() final
|
2023-06-29 18:00:06 +02:00
|
|
|
{
|
2023-07-12 14:25:08 +02:00
|
|
|
using namespace Tasking;
|
|
|
|
|
|
|
|
|
|
const auto onSetup = [this] {
|
|
|
|
|
// Check whether we need to run autoreconf
|
|
|
|
|
const FilePath configure = project()->projectDirectory() / "configure";
|
|
|
|
|
if (!configure.exists())
|
|
|
|
|
m_runAutoreconf = true;
|
|
|
|
|
|
|
|
|
|
if (!m_runAutoreconf) {
|
2023-10-16 15:14:01 +02:00
|
|
|
emit addOutput(::AutotoolsProjectManager::Tr::tr(
|
|
|
|
|
"Configuration unchanged, skipping autoreconf step."),
|
2023-07-12 14:25:08 +02:00
|
|
|
OutputFormat::NormalMessage);
|
2023-11-04 12:57:23 +01:00
|
|
|
return SetupResult::StopWithSuccess;
|
2023-07-12 14:25:08 +02:00
|
|
|
}
|
|
|
|
|
return SetupResult::Continue;
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-03 18:50:32 +01:00
|
|
|
return Group {
|
|
|
|
|
onGroupSetup(onSetup),
|
|
|
|
|
onGroupDone([this] { m_runAutoreconf = false; }, CallDoneIf::Success),
|
|
|
|
|
defaultProcessTask()
|
|
|
|
|
};
|
2023-06-29 18:00:06 +02:00
|
|
|
}
|
2020-01-09 14:00:22 +01:00
|
|
|
|
|
|
|
|
bool m_runAutoreconf = false;
|
2023-06-29 18:00:06 +02:00
|
|
|
StringAspect arguments{this};
|
2020-01-09 14:00:22 +01:00
|
|
|
};
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
|
2023-01-17 15:51:29 +01:00
|
|
|
// AutoreconfStepFactory
|
2020-01-09 14:00:22 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Implementation of the ProjectExplorer::IBuildStepFactory interface.
|
|
|
|
|
*
|
|
|
|
|
* The factory is used to create instances of AutoreconfStep.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
AutoreconfStepFactory::AutoreconfStepFactory()
|
|
|
|
|
{
|
|
|
|
|
registerStep<AutoreconfStep>(Constants::AUTORECONF_STEP_ID);
|
2022-09-29 17:11:01 +02:00
|
|
|
setDisplayName(Tr::tr("Autoreconf", "Display name for AutotoolsProjectManager::AutoreconfStep 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
|