forked from qt-creator/qt-creator
Nim: Move a few factories to their product's compilation units
There's several hundred kBytes extra for the separate .o in a debug build, this doesn't scale well for a handful lines of code. As the Nim plugin is a nice template for others elsewise, it would be nice to use scalable patterns only. Change-Id: I78e473d28a6a63d458dcbe06a77d93221867417f Reviewed-by: Filippo Cucchetto <filippocucchetto@gmail.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -22,11 +22,8 @@ HEADERS += \
|
||||
project/nimcompilerbuildstepconfigwidget.h \
|
||||
project/nimcompilercleanstep.h \
|
||||
project/nimcompilercleanstepconfigwidget.h \
|
||||
project/nimrunconfigurationfactory.h \
|
||||
project/nimrunconfiguration.h \
|
||||
project/nimrunconfigurationwidget.h \
|
||||
project/nimcompilerbuildstepfactory.h \
|
||||
project/nimcompilercleanstepfactory.h \
|
||||
project/nimbuildconfigurationwidget.h \
|
||||
editor/nimeditorfactory.h \
|
||||
settings/nimcodestylesettingspage.h \
|
||||
@@ -48,11 +45,8 @@ SOURCES += \
|
||||
project/nimcompilerbuildstepconfigwidget.cpp \
|
||||
project/nimcompilercleanstep.cpp \
|
||||
project/nimcompilercleanstepconfigwidget.cpp \
|
||||
project/nimrunconfigurationfactory.cpp \
|
||||
project/nimrunconfiguration.cpp \
|
||||
project/nimrunconfigurationwidget.cpp \
|
||||
project/nimcompilerbuildstepfactory.cpp \
|
||||
project/nimcompilercleanstepfactory.cpp \
|
||||
project/nimbuildconfigurationwidget.cpp \
|
||||
editor/nimeditorfactory.cpp \
|
||||
settings/nimcodestylesettingspage.cpp \
|
||||
|
@@ -39,14 +39,11 @@ QtcPlugin {
|
||||
"nimbuildconfigurationwidget.h", "nimbuildconfigurationwidget.cpp",
|
||||
"nimcompilerbuildstep.h", "nimcompilerbuildstep.cpp",
|
||||
"nimcompilerbuildstepconfigwidget.h", "nimcompilerbuildstepconfigwidget.cpp", "nimcompilerbuildstepconfigwidget.ui",
|
||||
"nimcompilerbuildstepfactory.h", "nimcompilerbuildstepfactory.cpp",
|
||||
"nimcompilercleanstep.h", "nimcompilercleanstep.cpp",
|
||||
"nimcompilercleanstepconfigwidget.h", "nimcompilercleanstepconfigwidget.cpp", "nimcompilercleanstepconfigwidget.ui",
|
||||
"nimcompilercleanstepfactory.h", "nimcompilercleanstepfactory.cpp",
|
||||
"nimproject.h", "nimproject.cpp",
|
||||
"nimprojectnode.h", "nimprojectnode.cpp",
|
||||
"nimrunconfiguration.h", "nimrunconfiguration.cpp",
|
||||
"nimrunconfigurationfactory.h", "nimrunconfigurationfactory.cpp",
|
||||
"nimrunconfigurationwidget.h", "nimrunconfigurationwidget.cpp",
|
||||
"nimtoolchain.h", "nimtoolchain.cpp",
|
||||
"nimtoolchainfactory.h", "nimtoolchainfactory.cpp",
|
||||
|
@@ -29,11 +29,10 @@
|
||||
#include "editor/nimeditorfactory.h"
|
||||
#include "editor/nimhighlighter.h"
|
||||
#include "project/nimbuildconfiguration.h"
|
||||
#include "project/nimcompilerbuildstepfactory.h"
|
||||
#include "project/nimcompilercleanstepfactory.h"
|
||||
#include "project/nimcompilerbuildstep.h"
|
||||
#include "project/nimcompilercleanstep.h"
|
||||
#include "project/nimproject.h"
|
||||
#include "project/nimrunconfiguration.h"
|
||||
#include "project/nimrunconfigurationfactory.h"
|
||||
#include "project/nimtoolchainfactory.h"
|
||||
#include "settings/nimcodestylepreferencesfactory.h"
|
||||
#include "settings/nimcodestylesettingspage.h"
|
||||
|
@@ -285,6 +285,17 @@ void NimCompilerBuildStep::updateTargetNimFile()
|
||||
setTargetNimFile(nimFiles.at(0));
|
||||
}
|
||||
|
||||
// NimCompilerBuildStepFactory
|
||||
|
||||
NimCompilerBuildStepFactory::NimCompilerBuildStepFactory()
|
||||
{
|
||||
registerStep<NimCompilerBuildStep>(Constants::C_NIMCOMPILERBUILDSTEP_ID);
|
||||
setDisplayName(tr("Nim Compiler Build Step"));
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID);
|
||||
setRepeatable(false);
|
||||
}
|
||||
|
||||
} // namespace Nim
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
|
@@ -83,4 +83,10 @@ private:
|
||||
Utils::FileName m_outFilePath;
|
||||
};
|
||||
|
||||
}
|
||||
class NimCompilerBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
NimCompilerBuildStepFactory();
|
||||
};
|
||||
|
||||
} // Nim
|
||||
|
@@ -1,49 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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
|
||||
** 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.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "nimbuildconfiguration.h"
|
||||
#include "nimcompilerbuildstep.h"
|
||||
#include "nimcompilerbuildstepfactory.h"
|
||||
|
||||
#include "../nimconstants.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Nim {
|
||||
|
||||
NimCompilerBuildStepFactory::NimCompilerBuildStepFactory()
|
||||
{
|
||||
registerStep<NimCompilerBuildStep>(Constants::C_NIMCOMPILERBUILDSTEP_ID);
|
||||
setDisplayName(tr("Nim Compiler Build Step"));
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID);
|
||||
setRepeatable(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,40 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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
|
||||
** 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.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
namespace Nim {
|
||||
|
||||
class NimCompilerBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NimCompilerBuildStepFactory();
|
||||
};
|
||||
|
||||
}
|
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "../nimconstants.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDir>
|
||||
@@ -107,5 +108,16 @@ bool NimCompilerCleanStep::removeOutFilePath()
|
||||
return QFile(bc->outFilePath().toFileInfo().absoluteFilePath()).remove();
|
||||
}
|
||||
|
||||
// NimCompilerCleanStepFactory
|
||||
|
||||
NimCompilerCleanStepFactory::NimCompilerCleanStepFactory()
|
||||
{
|
||||
registerStep<NimCompilerCleanStep>(Constants::C_NIMCOMPILERCLEANSTEP_ID);
|
||||
setFlags(BuildStepInfo::Unclonable);
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||
setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID);
|
||||
setRepeatable(false);
|
||||
setDisplayName(tr(Nim::Constants::C_NIMCOMPILERCLEANSTEP_DISPLAY));
|
||||
}
|
||||
|
||||
} // Nim
|
||||
|
@@ -39,9 +39,7 @@ public:
|
||||
NimCompilerCleanStep(ProjectExplorer::BuildStepList *parentList);
|
||||
|
||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||
|
||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||
|
||||
void run(QFutureInterface<bool> &fi) override;
|
||||
|
||||
private:
|
||||
@@ -51,4 +49,10 @@ private:
|
||||
Utils::FileName m_buildDir;
|
||||
};
|
||||
|
||||
}
|
||||
class NimCompilerCleanStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
NimCompilerCleanStepFactory();
|
||||
};
|
||||
|
||||
} // Nim
|
||||
|
@@ -1,48 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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
|
||||
** 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.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "nimcompilercleanstepfactory.h"
|
||||
#include "nimbuildconfiguration.h"
|
||||
#include "nimcompilercleanstep.h"
|
||||
|
||||
#include "../nimconstants.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Nim {
|
||||
|
||||
NimCompilerCleanStepFactory::NimCompilerCleanStepFactory()
|
||||
{
|
||||
registerStep<NimCompilerCleanStep>(Constants::C_NIMCOMPILERCLEANSTEP_ID);
|
||||
setFlags(BuildStepInfo::Unclonable);
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||
setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID);
|
||||
setRepeatable(false);
|
||||
setDisplayName(tr(Nim::Constants::C_NIMCOMPILERCLEANSTEP_DISPLAY));
|
||||
}
|
||||
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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
|
||||
** 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.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
namespace Nim {
|
||||
|
||||
class NimCompilerCleanStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NimCompilerCleanStepFactory();
|
||||
};
|
||||
|
||||
}
|
@@ -130,4 +130,13 @@ void NimRunConfiguration::setActiveBuildConfiguration(NimBuildConfiguration *act
|
||||
}
|
||||
}
|
||||
|
||||
// NimRunConfigurationFactory
|
||||
|
||||
NimRunConfigurationFactory::NimRunConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<NimRunConfiguration>(Constants::C_NIMRUNCONFIGURATION_ID);
|
||||
addSupportedProjectType(Constants::C_NIMPROJECT_ID);
|
||||
addFixedBuildTarget("-TempRunConf");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -62,4 +62,10 @@ private:
|
||||
ProjectExplorer::LocalEnvironmentAspect* m_localEnvironmentAspect;
|
||||
};
|
||||
|
||||
}
|
||||
class NimRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
NimRunConfigurationFactory();
|
||||
};
|
||||
|
||||
} // Nim
|
||||
|
@@ -1,46 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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
|
||||
** 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.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "nimrunconfigurationfactory.h"
|
||||
#include "nimproject.h"
|
||||
#include "nimrunconfiguration.h"
|
||||
|
||||
#include "../nimconstants.h"
|
||||
|
||||
#include <debugger/debuggerrunconfigurationaspect.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Nim {
|
||||
|
||||
NimRunConfigurationFactory::NimRunConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<NimRunConfiguration>(Constants::C_NIMRUNCONFIGURATION_ID);
|
||||
addSupportedProjectType(Constants::C_NIMPROJECT_ID);
|
||||
addFixedBuildTarget("-TempRunConf");
|
||||
}
|
||||
|
||||
}
|
@@ -1,38 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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
|
||||
** 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.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
namespace Nim {
|
||||
|
||||
class NimRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
NimRunConfigurationFactory();
|
||||
};
|
||||
|
||||
}
|
Reference in New Issue
Block a user