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 "autogenstep.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>
|
|
|
|
|
|
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
|
|
|
|
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
|
|
|
// AutogenStep
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Implementation of the ProjectExplorer::AbstractProcessStep interface.
|
|
|
|
|
*
|
|
|
|
|
* A autogen 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 AutogenStep 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::AutogenStep)
|
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
|
|
|
AutogenStep(BuildStepList *bsl, Id id);
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
private:
|
2020-10-05 12:42:37 +02:00
|
|
|
void doRun() final;
|
2020-01-09 14:00:22 +01:00
|
|
|
|
|
|
|
|
bool m_runAutogen = false;
|
|
|
|
|
};
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-10-05 12:42:37 +02:00
|
|
|
AutogenStep::AutogenStep(BuildStepList *bsl, Id id) : 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.AutogenStep.AdditionalArguments");
|
|
|
|
|
arguments->setLabelText(tr("Arguments:"));
|
|
|
|
|
arguments->setDisplayStyle(StringAspect::LineEditDisplay);
|
|
|
|
|
arguments->setHistoryCompleter("AutotoolsPM.History.AutogenStepArgs");
|
|
|
|
|
|
|
|
|
|
connect(arguments, &BaseAspect::changed, this, [this] {
|
2019-06-25 10:41:32 +02:00
|
|
|
m_runAutogen = true;
|
|
|
|
|
});
|
|
|
|
|
|
2020-10-05 12:42:37 +02:00
|
|
|
setCommandLineProvider([arguments] {
|
2021-08-10 16:19:02 +02:00
|
|
|
return CommandLine(FilePath("./autogen.sh"),
|
2020-10-05 12:42:37 +02:00
|
|
|
arguments->value(),
|
2020-08-13 16:48:25 +02:00
|
|
|
CommandLine::Raw);
|
|
|
|
|
});
|
|
|
|
|
|
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 AutogenStep::doRun()
|
2011-11-29 14:19:28 +01:00
|
|
|
{
|
2011-11-30 15:54:22 +01:00
|
|
|
// Check whether we need to run autogen.sh
|
2020-02-19 11:55:48 +01:00
|
|
|
const QString projectDir = project()->projectDirectory().toString();
|
2017-06-12 14:23:34 +02:00
|
|
|
const QFileInfo configureInfo(projectDir + "/configure");
|
|
|
|
|
const QFileInfo configureAcInfo(projectDir + "/configure.ac");
|
|
|
|
|
const QFileInfo makefileAmInfo(projectDir + "/Makefile.am");
|
2011-11-29 14:19:28 +01:00
|
|
|
|
|
|
|
|
if (!configureInfo.exists()
|
|
|
|
|
|| configureInfo.lastModified() < configureAcInfo.lastModified()
|
|
|
|
|
|| configureInfo.lastModified() < makefileAmInfo.lastModified()) {
|
|
|
|
|
m_runAutogen = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!m_runAutogen) {
|
2017-01-12 10:59:12 +01:00
|
|
|
emit addOutput(tr("Configuration unchanged, skipping autogen step."), BuildStep::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_runAutogen = 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
|
|
|
|
|
|
|
|
// AutogenStepFactory
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Implementation of the ProjectExplorer::BuildStepFactory interface.
|
|
|
|
|
*
|
|
|
|
|
* This factory is used to create instances of AutogenStep.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
AutogenStepFactory::AutogenStepFactory()
|
|
|
|
|
{
|
|
|
|
|
registerStep<AutogenStep>(Constants::AUTOGEN_STEP_ID);
|
|
|
|
|
setDisplayName(AutogenStep::tr("Autogen", "Display name for AutotoolsProjectManager::AutogenStep id."));
|
|
|
|
|
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
|
|
|
|
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // Internal
|
|
|
|
|
} // AutotoolsProjectManager
|