forked from qt-creator/qt-creator
GenericProject: Normalize make step setup
We have only one id for the steps, so short of coming up with some fancy upgrade mechanism, stick to the one kind of step, but also use only one factory, and do the switch in the step constructor based on the nature of the parent buildsteplist. Change-Id: I8fcc599682840d61e4a7f8b6fb7b792aafdd8766 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -63,10 +63,10 @@ void GenericBuildConfiguration::initialize(const BuildInfo &info)
|
|||||||
BuildConfiguration::initialize(info);
|
BuildConfiguration::initialize(info);
|
||||||
|
|
||||||
BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
buildSteps->appendStep(new GenericMakeStep(buildSteps, "all"));
|
buildSteps->appendStep(Constants::GENERIC_MS_ID);
|
||||||
|
|
||||||
BuildStepList *cleanSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
BuildStepList *cleanSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||||
cleanSteps->appendStep(new GenericMakeStep(cleanSteps, "clean"));
|
cleanSteps->appendStep(Constants::GENERIC_MS_ID);
|
||||||
|
|
||||||
updateCacheAndEmitEnvironmentChanged();
|
updateCacheAndEmitEnvironmentChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "genericmakestep.h"
|
#include "genericmakestep.h"
|
||||||
#include "genericprojectconstants.h"
|
#include "genericprojectconstants.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/buildsteplist.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -33,52 +34,23 @@ using namespace ProjectExplorer;
|
|||||||
namespace GenericProjectManager {
|
namespace GenericProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const char GENERIC_MS_ID[] = "GenericProjectManager.GenericMakeStep";
|
GenericMakeStep::GenericMakeStep(BuildStepList *parent)
|
||||||
|
: MakeStep(parent, Constants::GENERIC_MS_ID)
|
||||||
GenericMakeStep::GenericMakeStep(BuildStepList *parent, const QString &buildTarget)
|
|
||||||
: MakeStep(parent, GENERIC_MS_ID)
|
|
||||||
{
|
{
|
||||||
setBuildTarget(buildTarget);
|
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_BUILD) {
|
||||||
|
setBuildTarget("all");
|
||||||
|
} else if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
|
||||||
|
setBuildTarget("clean");
|
||||||
|
setClean(true);
|
||||||
|
}
|
||||||
setAvailableBuildTargets({"all", "clean"});
|
setAvailableBuildTargets({"all", "clean"});
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
GenericMakeStepFactory::GenericMakeStepFactory()
|
||||||
// GenericMakeAllStepFactory
|
|
||||||
//
|
|
||||||
|
|
||||||
GenericMakeAllStepFactory::GenericMakeAllStepFactory()
|
|
||||||
{
|
{
|
||||||
struct Step : GenericMakeStep
|
registerStep<GenericMakeStep>(Constants::GENERIC_MS_ID);
|
||||||
{
|
|
||||||
Step(BuildStepList *bsl) : GenericMakeStep(bsl) { setBuildTarget("all"); }
|
|
||||||
};
|
|
||||||
|
|
||||||
registerStep<Step>(GENERIC_MS_ID);
|
|
||||||
setDisplayName(MakeStep::defaultDisplayName());
|
setDisplayName(MakeStep::defaultDisplayName());
|
||||||
setSupportedProjectType(Constants::GENERICPROJECT_ID);
|
setSupportedProjectType(Constants::GENERICPROJECT_ID);
|
||||||
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD,
|
|
||||||
ProjectExplorer::Constants::BUILDSTEPS_DEPLOY});
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// GenericMakeCleanStepFactory
|
|
||||||
//
|
|
||||||
|
|
||||||
GenericMakeCleanStepFactory::GenericMakeCleanStepFactory()
|
|
||||||
{
|
|
||||||
struct Step : GenericMakeStep
|
|
||||||
{
|
|
||||||
Step(BuildStepList *bsl) : GenericMakeStep(bsl)
|
|
||||||
{
|
|
||||||
setBuildTarget("clean", true);
|
|
||||||
setClean(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
registerStep<Step>(GENERIC_MS_ID);
|
|
||||||
setDisplayName(MakeStep::defaultDisplayName());
|
|
||||||
setSupportedProjectType(Constants::GENERICPROJECT_ID);
|
|
||||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -37,19 +37,13 @@ class GenericMakeStep : public ProjectExplorer::MakeStep
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GenericMakeStep(ProjectExplorer::BuildStepList *parent, const QString &buildTarget = {});
|
explicit GenericMakeStep(ProjectExplorer::BuildStepList *parent);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GenericMakeAllStepFactory : public ProjectExplorer::BuildStepFactory
|
class GenericMakeStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GenericMakeAllStepFactory();
|
GenericMakeStepFactory();
|
||||||
};
|
|
||||||
|
|
||||||
class GenericMakeCleanStepFactory : public ProjectExplorer::BuildStepFactory
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GenericMakeCleanStepFactory();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ namespace Constants {
|
|||||||
|
|
||||||
const char GENERICMIMETYPE[] = "text/x-generic-project"; // ### FIXME
|
const char GENERICMIMETYPE[] = "text/x-generic-project"; // ### FIXME
|
||||||
|
|
||||||
|
const char GENERIC_MS_ID[] = "GenericProjectManager.GenericMakeStep";
|
||||||
|
|
||||||
// Contexts
|
// Contexts
|
||||||
const char FILES_EDITOR_ID[] = "QT4.FilesEditor";
|
const char FILES_EDITOR_ID[] = "QT4.FilesEditor";
|
||||||
|
|
||||||
|
|||||||
@@ -64,8 +64,7 @@ public:
|
|||||||
GenericProjectPluginPrivate();
|
GenericProjectPluginPrivate();
|
||||||
|
|
||||||
ProjectFilesFactory projectFilesFactory;
|
ProjectFilesFactory projectFilesFactory;
|
||||||
GenericMakeAllStepFactory makeAllStepFactory;
|
GenericMakeStepFactory makeStepFactory;
|
||||||
GenericMakeCleanStepFactory makeCleanStepFactory;
|
|
||||||
GenericBuildConfigurationFactory buildConfigFactory;
|
GenericBuildConfigurationFactory buildConfigFactory;
|
||||||
|
|
||||||
QAction editFilesAction{GenericProjectPlugin::tr("Edit Files..."), nullptr};
|
QAction editFilesAction{GenericProjectPlugin::tr("Edit Files..."), nullptr};
|
||||||
|
|||||||
Reference in New Issue
Block a user