2016-01-15 14:57:40 +01:00
|
|
|
/****************************************************************************
|
2011-11-29 14:19:28 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 Openismus GmbH.
|
|
|
|
|
** Author: Peter Penz (ppenz@openismus.com)
|
|
|
|
|
** Author: Patricia Santana Cruz (patriciasantanacruz@gmail.com)
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-11-29 14:19:28 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-11-29 14:19:28 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-11-29 14:19:28 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-11-29 14:19:28 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class AutogenStep : 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-06-26 13:59:38 +02:00
|
|
|
AutogenStep(BuildStepList *bsl, Utils::Id id);
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-01-09 14:00:22 +01:00
|
|
|
private:
|
|
|
|
|
void doRun() override;
|
|
|
|
|
|
2020-08-13 09:16:00 +02:00
|
|
|
StringAspect *m_additionalArgumentsAspect = nullptr;
|
2020-01-09 14:00:22 +01:00
|
|
|
bool m_runAutogen = false;
|
|
|
|
|
};
|
2011-11-29 14:19:28 +01:00
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
AutogenStep::AutogenStep(BuildStepList *bsl, Utils::Id id) : AbstractProcessStep(bsl, id)
|
2011-11-29 14:19:28 +01:00
|
|
|
{
|
2020-08-13 09:16:00 +02:00
|
|
|
m_additionalArgumentsAspect = addAspect<StringAspect>();
|
2019-06-26 12:48:53 +02:00
|
|
|
m_additionalArgumentsAspect->setSettingsKey(
|
|
|
|
|
"AutotoolsProjectManager.AutogenStep.AdditionalArguments");
|
2018-10-17 13:01:19 +02:00
|
|
|
m_additionalArgumentsAspect->setLabelText(tr("Arguments:"));
|
2020-08-13 09:16:00 +02:00
|
|
|
m_additionalArgumentsAspect->setDisplayStyle(StringAspect::LineEditDisplay);
|
2018-10-17 13:01:19 +02:00
|
|
|
m_additionalArgumentsAspect->setHistoryCompleter("AutotoolsPM.History.AutogenStepArgs");
|
2019-06-25 10:41:32 +02:00
|
|
|
|
2020-09-18 12:11:40 +02:00
|
|
|
connect(m_additionalArgumentsAspect, &BaseAspect::changed, this, [this] {
|
2019-06-25 10:41:32 +02:00
|
|
|
m_runAutogen = true;
|
|
|
|
|
});
|
|
|
|
|
|
2020-08-13 16:48:25 +02:00
|
|
|
setCommandLineProvider([this] {
|
|
|
|
|
return CommandLine(FilePath::fromString("./autogen.sh"),
|
|
|
|
|
m_additionalArgumentsAspect->value(),
|
|
|
|
|
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
|