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>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDateTime>
|
2019-08-13 12:47:11 +02:00
|
|
|
#include <QDir>
|
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
|
|
|
|
2014-08-24 20:33:40 +01:00
|
|
|
// Helper Function
|
2020-01-09 14:00:22 +01:00
|
|
|
|
|
|
|
|
static QString projectDirRelativeToBuildDir(BuildConfiguration *bc)
|
|
|
|
|
{
|
2014-08-24 20:33:40 +01:00
|
|
|
const QDir buildDir(bc->buildDirectory().toString());
|
|
|
|
|
QString projDirToBuildDir = buildDir.relativeFilePath(
|
2019-08-13 12:47:11 +02:00
|
|
|
bc->project()->projectDirectory().toString());
|
2014-08-24 20:33:40 +01:00
|
|
|
if (projDirToBuildDir.isEmpty())
|
2017-07-26 06:45:27 +02:00
|
|
|
return QString("./");
|
2017-06-12 14:23:34 +02:00
|
|
|
if (!projDirToBuildDir.endsWith('/'))
|
|
|
|
|
projDirToBuildDir.append('/');
|
2014-08-24 20:33:40 +01:00
|
|
|
return projDirToBuildDir;
|
|
|
|
|
}
|
|
|
|
|
|
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:
|
2020-10-05 12:42:37 +02:00
|
|
|
ConfigureStep(BuildStepList *bsl, Id id);
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
void setAdditionalArguments(const QString &list);
|
|
|
|
|
|
|
|
|
|
private:
|
2020-10-05 12:42:37 +02:00
|
|
|
void doRun() final;
|
2020-01-09 14:00:22 +01:00
|
|
|
|
2021-12-17 11:05:21 +01:00
|
|
|
CommandLine getCommandLine(const QString &arguments);
|
|
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
bool m_runConfigure = false;
|
|
|
|
|
};
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-10-05 12:42:37 +02:00
|
|
|
ConfigureStep::ConfigureStep(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->setDisplayStyle(StringAspect::LineEditDisplay);
|
|
|
|
|
arguments->setSettingsKey("AutotoolsProjectManager.ConfigureStep.AdditionalArguments");
|
2022-09-29 17:11:01 +02:00
|
|
|
arguments->setLabelText(Tr::tr("Arguments:"));
|
2020-10-05 12:42:37 +02:00
|
|
|
arguments->setHistoryCompleter("AutotoolsPM.History.ConfigureArgs");
|
|
|
|
|
|
|
|
|
|
connect(arguments, &BaseAspect::changed, this, [this] {
|
2019-06-25 10:10:06 +02:00
|
|
|
m_runConfigure = true;
|
|
|
|
|
});
|
|
|
|
|
|
2020-08-13 16:48:25 +02:00
|
|
|
setWorkingDirectoryProvider([this] { return project()->projectDirectory(); });
|
|
|
|
|
|
2020-10-05 12:42:37 +02:00
|
|
|
setCommandLineProvider([this, arguments] {
|
2021-12-17 11:05:21 +01:00
|
|
|
return getCommandLine(arguments->value());
|
2020-08-13 16:48:25 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setSummaryUpdater([this] {
|
2019-06-25 10:10:06 +02:00
|
|
|
ProcessParameters param;
|
2020-08-13 16:48:25 +02:00
|
|
|
setupProcessParameters(¶m);
|
2019-06-25 10:10:06 +02:00
|
|
|
|
|
|
|
|
return param.summaryInWorkdir(displayName());
|
|
|
|
|
});
|
2011-11-29 14:19:28 +01:00
|
|
|
}
|
|
|
|
|
|
2021-12-17 11:05:21 +01:00
|
|
|
CommandLine ConfigureStep::getCommandLine(const QString &arguments)
|
|
|
|
|
{
|
|
|
|
|
BuildConfiguration *bc = buildConfiguration();
|
|
|
|
|
|
|
|
|
|
return CommandLine({FilePath::fromString(projectDirRelativeToBuildDir(bc) + "configure"),
|
|
|
|
|
arguments,
|
|
|
|
|
CommandLine::Raw});
|
|
|
|
|
}
|
|
|
|
|
|
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 ConfigureStep::doRun()
|
2011-11-29 14:19:28 +01:00
|
|
|
{
|
2011-11-30 15:54:22 +01:00
|
|
|
//Check whether we need to run configure
|
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");
|
2020-02-19 11:55:48 +01:00
|
|
|
const QFileInfo configStatusInfo(buildDirectory().toString() + "/config.status");
|
2011-11-29 14:19:28 +01:00
|
|
|
|
|
|
|
|
if (!configStatusInfo.exists()
|
|
|
|
|
|| configStatusInfo.lastModified() < configureInfo.lastModified()) {
|
|
|
|
|
m_runConfigure = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!m_runConfigure) {
|
2022-09-29 17:11:01 +02:00
|
|
|
emit addOutput(Tr::tr("Configuration unchanged, skipping configure 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;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-17 11:05:21 +01:00
|
|
|
ProcessParameters *param = processParameters();
|
|
|
|
|
if (!param->effectiveCommand().exists()) {
|
|
|
|
|
param->setCommandLine(getCommandLine(param->command().arguments()));
|
|
|
|
|
setSummaryText(param->summaryInWorkdir(displayName()));
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-29 14:19:28 +01:00
|
|
|
m_runConfigure = 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
|
|
|
|
|
|
|
|
// 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
|