Autotools: De-Q_OBJECT-ify build related classes

Only used for translations, and that can be achieved much cheaper
without the extra translation units created by moc.

This reduces the size of the autotoolsprojectmanagers/.obj build
dir from 23220 kB to 17696 kB for my debug buld.

Take the opportunity to sprinkle in a few 'final'.

Change-Id: I85b36c6b8ca58469d0906f1105b2b1587b7c7e6c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2020-01-09 14:00:22 +01:00
parent 5cd0749830
commit 9686e91bd5
12 changed files with 204 additions and 216 deletions

View File

@@ -29,31 +29,47 @@
#include "autotoolsprojectconstants.h" #include "autotoolsprojectconstants.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/processparameters.h> #include <projectexplorer/processparameters.h>
#include <projectexplorer/projectconfigurationaspects.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <QDateTime> #include <QDateTime>
using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
// AutogenStepFactory namespace AutotoolsProjectManager {
namespace Internal {
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);
}
// AutogenStep // 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
{
Q_DECLARE_TR_FUNCTIONS(AutotoolsProjectManager::Internal::AutogenStep)
public:
AutogenStep(BuildStepList *bsl, Core::Id id);
private:
bool init() override;
void doRun() override;
BaseStringAspect *m_additionalArgumentsAspect = nullptr;
bool m_runAutogen = false;
};
AutogenStep::AutogenStep(BuildStepList *bsl, Core::Id id) : AbstractProcessStep(bsl, id) AutogenStep::AutogenStep(BuildStepList *bsl, Core::Id id) : AbstractProcessStep(bsl, id)
{ {
setDefaultDisplayName(tr("Autogen")); setDefaultDisplayName(tr("Autogen"));
@@ -104,7 +120,7 @@ void AutogenStep::doRun()
BuildConfiguration *bc = buildConfiguration(); BuildConfiguration *bc = buildConfiguration();
// Check whether we need to run autogen.sh // Check whether we need to run autogen.sh
const QString projectDir(bc->target()->project()->projectDirectory().toString()); const QString projectDir = bc->target()->project()->projectDirectory().toString();
const QFileInfo configureInfo(projectDir + "/configure"); const QFileInfo configureInfo(projectDir + "/configure");
const QFileInfo configureAcInfo(projectDir + "/configure.ac"); const QFileInfo configureAcInfo(projectDir + "/configure.ac");
const QFileInfo makefileAmInfo(projectDir + "/Makefile.am"); const QFileInfo makefileAmInfo(projectDir + "/Makefile.am");
@@ -124,3 +140,22 @@ void AutogenStep::doRun()
m_runAutogen = false; m_runAutogen = false;
AbstractProcessStep::doRun(); AbstractProcessStep::doRun();
} }
// 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

View File

@@ -27,52 +27,16 @@
#pragma once #pragma once
#include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/buildstep.h>
#include <projectexplorer/projectconfigurationaspects.h>
namespace AutotoolsProjectManager { namespace AutotoolsProjectManager {
namespace Internal { namespace Internal {
///////////////////////////// class AutogenStepFactory final : public ProjectExplorer::BuildStepFactory
// AutogenStepFactory class
/////////////////////////////
/**
* @brief Implementation of the ProjectExplorer::IBuildStepFactory interface.
*
* This factory is used to create instances of AutogenStep.
*/
class AutogenStepFactory : public ProjectExplorer::BuildStepFactory
{ {
public: public:
AutogenStepFactory(); AutogenStepFactory();
}; };
///////////////////////
// AutogenStep class
///////////////////////
/**
* @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 ProjectExplorer::AbstractProcessStep
{
Q_OBJECT
public:
AutogenStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
private:
bool init() override;
void doRun() override;
ProjectExplorer::BaseStringAspect *m_additionalArgumentsAspect = nullptr;
bool m_runAutogen = false;
};
} // namespace Internal } // namespace Internal
} // namespace AutotoolsProjectManager } // namespace AutotoolsProjectManager

View File

@@ -29,28 +29,44 @@
#include "autotoolsprojectconstants.h" #include "autotoolsprojectconstants.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/processparameters.h> #include <projectexplorer/processparameters.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectconfigurationaspects.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
// AutoreconfStepFactory class namespace AutotoolsProjectManager {
namespace Internal {
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);
}
// AutoreconfStep class // 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.
*/
class AutoreconfStep : public AbstractProcessStep
{
Q_DECLARE_TR_FUNCTIONS(AutotoolsProjectManager::Internal::AutoreconfStep)
public:
AutoreconfStep(BuildStepList *bsl, Core::Id id);
bool init() override;
void doRun() override;
private:
BaseStringAspect *m_additionalArgumentsAspect = nullptr;
bool m_runAutoreconf = false;
};
AutoreconfStep::AutoreconfStep(BuildStepList *bsl, Core::Id id) AutoreconfStep::AutoreconfStep(BuildStepList *bsl, Core::Id id)
: AbstractProcessStep(bsl, id) : AbstractProcessStep(bsl, id)
{ {
@@ -115,3 +131,22 @@ void AutoreconfStep::doRun()
m_runAutoreconf = false; m_runAutoreconf = false;
AbstractProcessStep::doRun(); AbstractProcessStep::doRun();
} }
// 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

View File

@@ -27,52 +27,16 @@
#pragma once #pragma once
#include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/buildstep.h>
#include <projectexplorer/projectconfigurationaspects.h>
namespace AutotoolsProjectManager { namespace AutotoolsProjectManager {
namespace Internal { namespace Internal {
//////////////////////////////// class AutoreconfStepFactory final : public ProjectExplorer::BuildStepFactory
// AutoreconfStepFactory class
////////////////////////////////
/**
* @brief Implementation of the ProjectExplorer::IBuildStepFactory interface.
*
* The factory is used to create instances of AutoreconfStep.
*/
class AutoreconfStepFactory : public ProjectExplorer::BuildStepFactory
{ {
public: public:
AutoreconfStepFactory(); AutoreconfStepFactory();
}; };
/////////////////////////
// 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.
*/
class AutoreconfStep : public ProjectExplorer::AbstractProcessStep
{
Q_OBJECT
public:
AutoreconfStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
bool init() override;
void doRun() override;
private:
ProjectExplorer::BaseStringAspect *m_additionalArgumentsAspect = nullptr;
bool m_runAutoreconf = false;
};
} // namespace Internal } // namespace Internal
} // namespace AutotoolsProjectManager } // namespace AutotoolsProjectManager

View File

@@ -35,9 +35,7 @@
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
using namespace AutotoolsProjectManager::Constants;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace ProjectExplorer::Constants;
using namespace Utils; using namespace Utils;
namespace AutotoolsProjectManager { namespace AutotoolsProjectManager {
@@ -45,28 +43,34 @@ namespace Internal {
// AutotoolsBuildConfiguration // AutotoolsBuildConfiguration
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(Target *target, Core::Id id) class AutotoolsBuildConfiguration : public BuildConfiguration
: BuildConfiguration(target, id)
{ {
// /<foobar> is used so the un-changed check in setBuildDirectory() works correctly. Q_DECLARE_TR_FUNCTIONS(AutotoolsProjectManager::Internal::AutotoolsBuildConfiguration)
// The leading / is to avoid the relative the path expansion in BuildConfiguration::buildDirectory.
setBuildDirectory(Utils::FilePath::fromString("/<foobar>"));
setBuildDirectoryHistoryCompleter("AutoTools.BuildDir.History");
setConfigWidgetDisplayName(tr("Autotools Manager"));
// ### Build Steps Build ### public:
QFile autogenFile(target->project()->projectDirectory().toString() + "/autogen.sh"); AutotoolsBuildConfiguration(Target *target, Core::Id id)
if (autogenFile.exists()) : BuildConfiguration(target, id)
appendInitialBuildStep(Constants::AUTOGEN_STEP_ID); // autogen.sh {
else // /<foobar> is used so the un-changed check in setBuildDirectory() works correctly.
appendInitialBuildStep(Constants::AUTORECONF_STEP_ID); // autoreconf // The leading / is to avoid the relative the path expansion in BuildConfiguration::buildDirectory.
setBuildDirectory(Utils::FilePath::fromString("/<foobar>"));
setBuildDirectoryHistoryCompleter("AutoTools.BuildDir.History");
setConfigWidgetDisplayName(tr("Autotools Manager"));
appendInitialBuildStep(Constants::CONFIGURE_STEP_ID); // ./configure. // ### Build Steps Build ###
appendInitialBuildStep(Constants::MAKE_STEP_ID); // make QFile autogenFile(target->project()->projectDirectory().toString() + "/autogen.sh");
if (autogenFile.exists())
appendInitialBuildStep(Constants::AUTOGEN_STEP_ID); // autogen.sh
else
appendInitialBuildStep(Constants::AUTORECONF_STEP_ID); // autoreconf
// ### Build Steps Clean ### appendInitialBuildStep(Constants::CONFIGURE_STEP_ID); // ./configure.
appendInitialBuildStep(Constants::MAKE_STEP_ID); appendInitialBuildStep(Constants::MAKE_STEP_ID); // make
}
// ### Build Steps Clean ###
appendInitialBuildStep(Constants::MAKE_STEP_ID);
}
};
AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory() AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory()
{ {

View File

@@ -32,14 +32,6 @@
namespace AutotoolsProjectManager { namespace AutotoolsProjectManager {
namespace Internal { namespace Internal {
class AutotoolsBuildConfiguration : public ProjectExplorer::BuildConfiguration
{
Q_OBJECT
friend class ProjectExplorer::BuildConfigurationFactory;
AutotoolsBuildConfiguration(ProjectExplorer::Target *target, Core::Id id);
};
class AutotoolsBuildConfigurationFactory final : public ProjectExplorer::BuildConfigurationFactory class AutotoolsBuildConfigurationFactory final : public ProjectExplorer::BuildConfigurationFactory
{ {
public: public:

View File

@@ -36,13 +36,11 @@ namespace Internal {
class MakefileParserThread; class MakefileParserThread;
class AutotoolsBuildSystem : public ProjectExplorer::BuildSystem class AutotoolsBuildSystem final : public ProjectExplorer::BuildSystem
{ {
Q_OBJECT
public: public:
explicit AutotoolsBuildSystem(ProjectExplorer::Target *target); explicit AutotoolsBuildSystem(ProjectExplorer::Target *target);
~AutotoolsBuildSystem() override; ~AutotoolsBuildSystem() final;
private: private:
void triggerParsing() final; void triggerParsing() final;

View File

@@ -37,6 +37,7 @@
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectmanager.h> #include <projectexplorer/projectmanager.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>

View File

@@ -30,22 +30,25 @@
#include "autotoolsbuildconfiguration.h" #include "autotoolsbuildconfiguration.h"
#include "autotoolsprojectconstants.h" #include "autotoolsprojectconstants.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/processparameters.h> #include <projectexplorer/processparameters.h>
#include <projectexplorer/projectconfigurationaspects.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
///////////////////// namespace AutotoolsProjectManager {
namespace Internal {
// Helper Function // Helper Function
/////////////////////
static QString projectDirRelativeToBuildDir(BuildConfiguration *bc) { static QString projectDirRelativeToBuildDir(BuildConfiguration *bc)
{
const QDir buildDir(bc->buildDirectory().toString()); const QDir buildDir(bc->buildDirectory().toString());
QString projDirToBuildDir = buildDir.relativeFilePath( QString projDirToBuildDir = buildDir.relativeFilePath(
bc->project()->projectDirectory().toString()); bc->project()->projectDirectory().toString());
@@ -56,20 +59,36 @@ static QString projectDirRelativeToBuildDir(BuildConfiguration *bc) {
return projDirToBuildDir; return projDirToBuildDir;
} }
// ConfigureStepFactory
ConfigureStepFactory::ConfigureStepFactory()
{
registerStep<ConfigureStep>(Constants::CONFIGURE_STEP_ID);
setDisplayName(ConfigureStep::tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}
// ConfigureStep // ConfigureStep
///**
// * @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.
// */
class ConfigureStep : public ProjectExplorer::AbstractProcessStep
{
Q_DECLARE_TR_FUNCTIONS(AutotoolsProjectManager::Internal::ConfigureStep)
public:
ConfigureStep(BuildStepList *bsl, Core::Id id);
void setAdditionalArguments(const QString &list);
private:
bool init() override;
void doRun() override;
ProjectExplorer::BaseStringAspect *m_additionalArgumentsAspect = nullptr;
bool m_runConfigure = false;
};
ConfigureStep::ConfigureStep(BuildStepList *bsl, Core::Id id) ConfigureStep::ConfigureStep(BuildStepList *bsl, Core::Id id)
: AbstractProcessStep(bsl, id) : AbstractProcessStep(bsl, id)
{ {
@@ -139,3 +158,22 @@ void ConfigureStep::doRun()
m_runConfigure = false; m_runConfigure = false;
AbstractProcessStep::doRun(); AbstractProcessStep::doRun();
} }
// 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);
setDisplayName(ConfigureStep::tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}
} // namespace Internal
} // namespace AutotoolsProjectManager

View File

@@ -27,55 +27,16 @@
#pragma once #pragma once
#include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/buildstep.h>
#include <projectexplorer/projectconfigurationaspects.h>
namespace AutotoolsProjectManager { namespace AutotoolsProjectManager {
namespace Internal { namespace Internal {
////////////////////////////////// class ConfigureStepFactory final : public ProjectExplorer::BuildStepFactory
// ConfigureStepFactory Class
//////////////////////////////////
/**
* @brief Implementation of the ProjectExplorer::IBuildStepFactory interface.
*
* The factory is used to create instances of ConfigureStep.
*/
class ConfigureStepFactory : public ProjectExplorer::BuildStepFactory
{ {
public: public:
ConfigureStepFactory(); ConfigureStepFactory();
}; };
//////////////////////////
//// ConfigureStep class
//////////////////////////
///**
// * @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.
// */
class ConfigureStep : public ProjectExplorer::AbstractProcessStep
{
Q_OBJECT
public:
ConfigureStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
void setAdditionalArguments(const QString &list);
private:
bool init() override;
void doRun() override;
ProjectExplorer::BaseStringAspect *m_additionalArgumentsAspect = nullptr;
bool m_runConfigure = false;
};
} // namespace Internal } // namespace Internal
} // namespace AutotoolsProjectManager } // namespace AutotoolsProjectManager

View File

@@ -31,21 +31,19 @@
#include <projectexplorer/buildsteplist.h> #include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
using namespace AutotoolsProjectManager::Constants; using namespace AutotoolsProjectManager::Constants;
// MakeStepFactory namespace AutotoolsProjectManager {
namespace Internal {
MakeStepFactory::MakeStepFactory()
{
registerStep<MakeStep>(MAKE_STEP_ID);
setDisplayName(ProjectExplorer::MakeStep::defaultDisplayName());
setSupportedProjectType(AUTOTOOLS_PROJECT_ID);
}
// MakeStep // MakeStep
class MakeStep : public ProjectExplorer::MakeStep
{
public:
MakeStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
};
MakeStep::MakeStep(ProjectExplorer::BuildStepList *bsl, Core::Id id) MakeStep::MakeStep(ProjectExplorer::BuildStepList *bsl, Core::Id id)
: ProjectExplorer::MakeStep(bsl, id) : ProjectExplorer::MakeStep(bsl, id)
{ {
@@ -57,3 +55,15 @@ MakeStep::MakeStep(ProjectExplorer::BuildStepList *bsl, Core::Id id)
setBuildTarget("all", true); setBuildTarget("all", true);
} }
} }
// MakeStepFactory
MakeStepFactory::MakeStepFactory()
{
registerStep<MakeStep>(MAKE_STEP_ID);
setDisplayName(ProjectExplorer::MakeStep::defaultDisplayName());
setSupportedProjectType(AUTOTOOLS_PROJECT_ID);
}
} // Internal
} // AutotoolsProjectManager

View File

@@ -32,25 +32,11 @@
namespace AutotoolsProjectManager { namespace AutotoolsProjectManager {
namespace Internal { namespace Internal {
/////////////////////////// class MakeStepFactory final : public ProjectExplorer::BuildStepFactory
// MakeStepFactory class
///////////////////////////
class MakeStepFactory : public ProjectExplorer::BuildStepFactory
{ {
public: public:
MakeStepFactory(); MakeStepFactory();
}; };
/////////////////////
// MakeStep class
/////////////////////
class MakeStep : public ProjectExplorer::MakeStep
{
Q_OBJECT
public:
MakeStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
};
} // namespace Internal } // namespace Internal
} // namespace AutotoolsProjectManager } // namespace AutotoolsProjectManager