2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 Openismus GmbH.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 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"
|
|
|
|
|
|
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>
|
2018-10-17 13:01:19 +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>
|
|
|
|
|
|
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
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
namespace AutotoolsProjectManager {
|
|
|
|
|
namespace Internal {
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
// AutoreconfStep class
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @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
|
|
|
Q_DECLARE_TR_FUNCTIONS(AutotoolsProjectManager::Internal::AutoreconfStep)
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
public:
|
2020-10-05 12:42:37 +02:00
|
|
|
AutoreconfStep(BuildStepList *bsl, Id id);
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
void doRun() override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool m_runAutoreconf = false;
|
|
|
|
|
};
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-10-05 12:42:37 +02:00
|
|
|
AutoreconfStep::AutoreconfStep(BuildStepList *bsl, Id id)
|
2019-12-20 17:05:30 +01:00
|
|
|
: AbstractProcessStep(bsl, id)
|
2011-11-29 14:19:28 +01:00
|
|
|
{
|
2020-10-05 12:42:37 +02:00
|
|
|
auto arguments = addAspect<StringAspect>();
|
|
|
|
|
arguments->setSettingsKey("AutotoolsProjectManager.AutoreconfStep.AdditionalArguments");
|
|
|
|
|
arguments->setLabelText(tr("Arguments:"));
|
|
|
|
|
arguments->setValue("--force --install");
|
|
|
|
|
arguments->setDisplayStyle(StringAspect::LineEditDisplay);
|
|
|
|
|
arguments->setHistoryCompleter("AutotoolsPM.History.AutoreconfStepArgs");
|
|
|
|
|
|
|
|
|
|
connect(arguments, &BaseAspect::changed, this, [this] {
|
2019-06-25 10:41:32 +02:00
|
|
|
m_runAutoreconf = true;
|
|
|
|
|
});
|
|
|
|
|
|
2020-10-05 12:42:37 +02:00
|
|
|
setCommandLineProvider([arguments] {
|
2021-08-10 16:19:02 +02:00
|
|
|
return CommandLine("autoreconf", arguments->value(), CommandLine::Raw);
|
2020-08-13 16:48:25 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setWorkingDirectoryProvider([this] { return project()->projectDirectory(); });
|
|
|
|
|
|
2019-06-25 10:41:32 +02:00
|
|
|
setSummaryUpdater([this] {
|
|
|
|
|
ProcessParameters param;
|
2020-08-13 16:48:25 +02:00
|
|
|
setupProcessParameters(¶m);
|
2019-06-25 10:41:32 +02:00
|
|
|
return param.summary(displayName());
|
|
|
|
|
});
|
2011-11-29 14:19:28 +01:00
|
|
|
}
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
void AutoreconfStep::doRun()
|
2011-11-29 14:19:28 +01:00
|
|
|
{
|
2011-11-30 15:54:22 +01:00
|
|
|
// Check whether we need to run autoreconf
|
2020-02-19 11:55:48 +01:00
|
|
|
const QString projectDir(project()->projectDirectory().toString());
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2017-06-12 14:23:34 +02:00
|
|
|
if (!QFileInfo::exists(projectDir + "/configure"))
|
2011-11-29 14:19:28 +01:00
|
|
|
m_runAutoreconf = true;
|
|
|
|
|
|
|
|
|
|
if (!m_runAutoreconf) {
|
2020-10-05 12:42:37 +02:00
|
|
|
emit addOutput(tr("Configuration unchanged, skipping autoreconf step."), OutputFormat::NormalMessage);
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
emit finished(true);
|
2011-11-29 14:19:28 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_runAutoreconf = false;
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
AbstractProcessStep::doRun();
|
2011-11-29 14:19:28 +01:00
|
|
|
}
|
2020-01-09 14:00:22 +01:00
|
|
|
|
|
|
|
|
// AutoreconfStepFactory class
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Implementation of the ProjectExplorer::IBuildStepFactory interface.
|
|
|
|
|
*
|
|
|
|
|
* The factory is used to create instances of AutoreconfStep.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
AutoreconfStepFactory::AutoreconfStepFactory()
|
|
|
|
|
{
|
|
|
|
|
registerStep<AutoreconfStep>(Constants::AUTORECONF_STEP_ID);
|
|
|
|
|
setDisplayName(AutoreconfStep::tr("Autoreconf", "Display name for AutotoolsProjectManager::AutoreconfStep id."));
|
|
|
|
|
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
|
|
|
|
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // Internal
|
|
|
|
|
} // AutotoolsProjectManager
|