diff options
author | hjk <hjk@qt.io> | 2023-01-17 15:51:29 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2023-01-24 14:14:49 +0000 |
commit | 77e7f0e3142ab4c11ea9781a6fd871dd282569f8 (patch) | |
tree | 2b485c7f80aefb9a013e4ce12f701c443b19c159 | |
parent | d995b650abfd4bbd8bde00deb75fde93b55c6a7c (diff) | |
download | qt-creator-77e7f0e3142ab4c11ea9781a6fd871dd282569f8.tar.gz |
AutoTools: Simplify build step implementations
... and make it usable remotely.
Change-Id: Ib19b661ba5cbb7b8a585c0b130dd672605ff0506
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
4 files changed, 24 insertions, 51 deletions
diff --git a/src/plugins/autotoolsprojectmanager/autogenstep.cpp b/src/plugins/autotoolsprojectmanager/autogenstep.cpp index 1395dc3868..c0a383205d 100644 --- a/src/plugins/autotoolsprojectmanager/autogenstep.cpp +++ b/src/plugins/autotoolsprojectmanager/autogenstep.cpp @@ -52,12 +52,12 @@ AutogenStep::AutogenStep(BuildStepList *bsl, Id id) : AbstractProcessStep(bsl, i arguments->setDisplayStyle(StringAspect::LineEditDisplay); arguments->setHistoryCompleter("AutotoolsPM.History.AutogenStepArgs"); - connect(arguments, &BaseAspect::changed, this, [this] { - m_runAutogen = true; - }); + connect(arguments, &BaseAspect::changed, this, [this] { m_runAutogen = true; }); + + setWorkingDirectoryProvider([this] { return project()->projectDirectory(); }); - setCommandLineProvider([arguments] { - return CommandLine(FilePath("./autogen.sh"), + setCommandLineProvider([this, arguments] { + return CommandLine(project()->projectDirectory() / "autogen.sh", arguments->value(), CommandLine::Raw); }); @@ -72,14 +72,14 @@ AutogenStep::AutogenStep(BuildStepList *bsl, Id id) : AbstractProcessStep(bsl, i void AutogenStep::doRun() { // Check whether we need to run autogen.sh - const QString projectDir = project()->projectDirectory().toString(); - const QFileInfo configureInfo(projectDir + "/configure"); - const QFileInfo configureAcInfo(projectDir + "/configure.ac"); - const QFileInfo makefileAmInfo(projectDir + "/Makefile.am"); - - if (!configureInfo.exists() - || configureInfo.lastModified() < configureAcInfo.lastModified() - || configureInfo.lastModified() < makefileAmInfo.lastModified()) { + const FilePath projectDir = project()->projectDirectory(); + const FilePath configure = projectDir / "configure"; + const FilePath configureAc = projectDir / "configure.ac"; + const FilePath makefileAm = projectDir / "Makefile.am"; + + if (!configure.exists() + || configure.lastModified() < configureAc.lastModified() + || configure.lastModified() < makefileAm.lastModified()) { m_runAutogen = true; } diff --git a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp index 8500a9c847..a238f41b68 100644 --- a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp +++ b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp @@ -20,7 +20,7 @@ using namespace Utils; namespace AutotoolsProjectManager::Internal { -// AutoreconfStep class +// AutoreconfStep /** * @brief Implementation of the ProjectExplorer::AbstractProcessStep interface. @@ -72,9 +72,8 @@ AutoreconfStep::AutoreconfStep(BuildStepList *bsl, Id id) void AutoreconfStep::doRun() { // Check whether we need to run autoreconf - const QString projectDir(project()->projectDirectory().toString()); - - if (!QFileInfo::exists(projectDir + "/configure")) + const FilePath configure = project()->projectDirectory() / "configure"; + if (!configure.exists()) m_runAutoreconf = true; if (!m_runAutoreconf) { @@ -88,7 +87,7 @@ void AutoreconfStep::doRun() AbstractProcessStep::doRun(); } -// AutoreconfStepFactory class +// AutoreconfStepFactory /** * @brief Implementation of the ProjectExplorer::IBuildStepFactory interface. diff --git a/src/plugins/autotoolsprojectmanager/configurestep.cpp b/src/plugins/autotoolsprojectmanager/configurestep.cpp index 368437994d..6975a1cd91 100644 --- a/src/plugins/autotoolsprojectmanager/configurestep.cpp +++ b/src/plugins/autotoolsprojectmanager/configurestep.cpp @@ -15,27 +15,12 @@ #include <utils/aspects.h> #include <QDateTime> -#include <QDir> using namespace ProjectExplorer; using namespace Utils; namespace AutotoolsProjectManager::Internal { -// Helper Function - -static QString projectDirRelativeToBuildDir(BuildConfiguration *bc) -{ - const QDir buildDir(bc->buildDirectory().toString()); - QString projDirToBuildDir = buildDir.relativeFilePath( - bc->project()->projectDirectory().toString()); - if (projDirToBuildDir.isEmpty()) - return QString("./"); - if (!projDirToBuildDir.endsWith('/')) - projDirToBuildDir.append('/'); - return projDirToBuildDir; -} - // ConfigureStep ///** @@ -77,8 +62,6 @@ ConfigureStep::ConfigureStep(BuildStepList *bsl, Id id) m_runConfigure = true; }); - setWorkingDirectoryProvider([this] { return project()->projectDirectory(); }); - setCommandLineProvider([this, arguments] { return getCommandLine(arguments->value()); }); @@ -93,24 +76,17 @@ ConfigureStep::ConfigureStep(BuildStepList *bsl, Id id) CommandLine ConfigureStep::getCommandLine(const QString &arguments) { - BuildConfiguration *bc = buildConfiguration(); - - return CommandLine({FilePath::fromString(projectDirRelativeToBuildDir(bc) + "configure"), - arguments, - CommandLine::Raw}); + return {project()->projectDirectory() / "configure", arguments, CommandLine::Raw}; } void ConfigureStep::doRun() { - //Check whether we need to run configure - const QString projectDir(project()->projectDirectory().toString()); - const QFileInfo configureInfo(projectDir + "/configure"); - const QFileInfo configStatusInfo(buildDirectory().toString() + "/config.status"); + // Check whether we need to run configure + const FilePath configure = project()->projectDirectory() / "configure"; + const FilePath configStatus = buildDirectory() / "config.status"; - if (!configStatusInfo.exists() - || configStatusInfo.lastModified() < configureInfo.lastModified()) { + if (!configStatus.exists() || configStatus.lastModified() < configure.lastModified()) m_runConfigure = true; - } if (!m_runConfigure) { emit addOutput(Tr::tr("Configuration unchanged, skipping configure step."), OutputFormat::NormalMessage); diff --git a/src/plugins/autotoolsprojectmanager/makestep.cpp b/src/plugins/autotoolsprojectmanager/makestep.cpp index d02d28e24a..5685908c86 100644 --- a/src/plugins/autotoolsprojectmanager/makestep.cpp +++ b/src/plugins/autotoolsprojectmanager/makestep.cpp @@ -7,8 +7,6 @@ #include <projectexplorer/buildsteplist.h> #include <projectexplorer/projectexplorerconstants.h> -using namespace AutotoolsProjectManager::Constants; - namespace AutotoolsProjectManager::Internal { // MakeStep @@ -33,9 +31,9 @@ public: MakeStepFactory::MakeStepFactory() { - registerStep<MakeStep>(MAKE_STEP_ID); + registerStep<MakeStep>(Constants::MAKE_STEP_ID); setDisplayName(ProjectExplorer::MakeStep::defaultDisplayName()); - setSupportedProjectType(AUTOTOOLS_PROJECT_ID); + setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID); } } // AutotoolsProjectManager::Internal |