forked from qt-creator/qt-creator
Make BuildSteps one instance per BuildConfiguration
Enables users to change which buildsteps get run per buildconfiguration. Some further tweaks are probably necessary. This is a rather big change, though it should work. :)
This commit is contained in:
@@ -105,6 +105,13 @@ bool CMakeBuildConfigurationFactory::create(const QString &type) const
|
||||
return false;
|
||||
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
|
||||
|
||||
MakeStep *makeStep = new MakeStep(m_project, bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
|
||||
MakeStep *cleanMakeStep = new MakeStep(m_project, bc);
|
||||
bc->insertCleanStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
||||
m_project->sourceDirectory(),
|
||||
m_project->buildDirectory(bc),
|
||||
@@ -114,12 +121,14 @@ bool CMakeBuildConfigurationFactory::create(const QString &type) const
|
||||
return false;
|
||||
}
|
||||
m_project->addBuildConfiguration(bc); // this also makes the name unique
|
||||
// Default to all
|
||||
if (m_project->targets().contains("all"))
|
||||
m_project->makeStep()->setBuildTarget(buildConfigurationName, "all", true);
|
||||
|
||||
bc->setValue("buildDirectory", copw.buildDirectory());
|
||||
bc->setValue("msvcVersion", copw.msvcVersion());
|
||||
m_project->parseCMakeLists();
|
||||
|
||||
// Default to all
|
||||
if (m_project->targets().contains("all"))
|
||||
makeStep->setBuildTarget("all", true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -627,17 +636,6 @@ void CMakeProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &w
|
||||
Project::saveSettingsImpl(writer);
|
||||
}
|
||||
|
||||
MakeStep *CMakeProject::makeStep() const
|
||||
{
|
||||
foreach (ProjectExplorer::BuildStep *bs, buildSteps()) {
|
||||
MakeStep *ms = qobject_cast<MakeStep *>(bs);
|
||||
if (ms)
|
||||
return ms;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader)
|
||||
{
|
||||
Project::restoreSettingsImpl(reader);
|
||||
@@ -651,22 +649,19 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
if (copw.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
|
||||
qDebug()<<"ccd.buildDirectory()"<<copw.buildDirectory();
|
||||
|
||||
// Now create a standard build configuration
|
||||
makeStep = new MakeStep(this);
|
||||
|
||||
insertBuildStep(0, makeStep);
|
||||
|
||||
ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration("all");
|
||||
addBuildConfiguration(bc);
|
||||
bc->setValue("msvcVersion", copw.msvcVersion());
|
||||
if (!copw.buildDirectory().isEmpty())
|
||||
bc->setValue("buildDirectory", copw.buildDirectory());
|
||||
//TODO save arguments somewhere copw.arguments()
|
||||
|
||||
MakeStep *cleanMakeStep = new MakeStep(this);
|
||||
insertCleanStep(0, cleanMakeStep);
|
||||
// Now create a standard build configuration
|
||||
makeStep = new MakeStep(this, bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
|
||||
//TODO save arguments somewhere copw.arguments()
|
||||
MakeStep *cleanMakeStep = new MakeStep(this, bc);
|
||||
bc->insertCleanStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setClean(true);
|
||||
setActiveBuildConfiguration(bc);
|
||||
} else {
|
||||
@@ -697,15 +692,15 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasUserFile && targets().contains("all"))
|
||||
makeStep->setBuildTarget("all", "all", true);
|
||||
|
||||
m_watcher = new ProjectExplorer::FileWatcher(this);
|
||||
connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString)));
|
||||
bool result = parseCMakeLists(); // Gets the directory from the active buildconfiguration
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
if (!hasUserFile && targets().contains("all"))
|
||||
makeStep->setBuildTarget("all", true);
|
||||
|
||||
connect(this, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SLOT(slotActiveBuildConfiguration()));
|
||||
return true;
|
||||
|
||||
@@ -113,7 +113,6 @@ public:
|
||||
virtual ProjectExplorer::ProjectNode *rootProjectNode() const;
|
||||
|
||||
virtual QStringList files(FilesMode fileMode) const;
|
||||
MakeStep *makeStep() const;
|
||||
QStringList targets() const;
|
||||
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
CMakeTarget targetForTitle(const QString &title);
|
||||
|
||||
@@ -40,13 +40,25 @@
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
MakeStep::MakeStep(CMakeProject *pro)
|
||||
: AbstractMakeStep(pro), m_pro(pro), m_clean(false)
|
||||
MakeStep::MakeStep(CMakeProject *pro, BuildConfiguration *bc)
|
||||
: AbstractMakeStep(pro, bc), m_pro(pro), m_clean(false), m_futureInterface(0)
|
||||
{
|
||||
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
||||
}
|
||||
|
||||
MakeStep::MakeStep(MakeStep *bs, BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bs, bc),
|
||||
m_pro(bs->m_pro),
|
||||
m_clean(bs->m_clean),
|
||||
m_futureInterface(0),
|
||||
m_buildTargets(bs->m_buildTargets),
|
||||
m_additionalArguments(bs->m_buildTargets)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MakeStep::~MakeStep()
|
||||
{
|
||||
|
||||
@@ -57,53 +69,34 @@ void MakeStep::setClean(bool clean)
|
||||
m_clean = clean;
|
||||
}
|
||||
|
||||
void MakeStep::restoreFromMap(const QMap<QString, QVariant> &map)
|
||||
void MakeStep::restoreFromGlobalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
if (map.value("clean").isValid() && map.value("clean").toBool())
|
||||
m_clean = true;
|
||||
ProjectExplorer::AbstractMakeStep::restoreFromMap(map);
|
||||
AbstractMakeStep::restoreFromGlobalMap(map);
|
||||
}
|
||||
|
||||
void MakeStep::storeIntoMap(QMap<QString, QVariant> &map)
|
||||
void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
m_buildTargets = map["buildTargets"].toStringList();
|
||||
m_additionalArguments = map["additionalArguments"].toStringList();
|
||||
if (map.value("clean").isValid() && map.value("clean").toBool())
|
||||
m_clean = true;
|
||||
AbstractMakeStep::restoreFromLocalMap(map);
|
||||
}
|
||||
|
||||
void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
{
|
||||
map["buildTargets"] = m_buildTargets;
|
||||
map["additionalArguments"] = m_additionalArguments;
|
||||
if (m_clean)
|
||||
map["clean"] = true;
|
||||
ProjectExplorer::AbstractMakeStep::storeIntoMap(map);
|
||||
AbstractMakeStep::storeIntoLocalMap(map);
|
||||
}
|
||||
|
||||
void MakeStep::restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map)
|
||||
bool MakeStep::init()
|
||||
{
|
||||
m_values[buildConfiguration].buildTargets = map["buildTargets"].toStringList();
|
||||
m_values[buildConfiguration].additionalArguments = map["additionalArguments"].toStringList();
|
||||
ProjectExplorer::AbstractMakeStep::restoreFromMap(buildConfiguration, map);
|
||||
}
|
||||
|
||||
void MakeStep::storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map)
|
||||
{
|
||||
map["buildTargets"] = m_values.value(buildConfiguration).buildTargets;
|
||||
map["additionalArguments"] = m_values.value(buildConfiguration).additionalArguments;
|
||||
ProjectExplorer::AbstractMakeStep::storeIntoMap(buildConfiguration, map);
|
||||
}
|
||||
|
||||
|
||||
void MakeStep::addBuildConfiguration(const QString & name)
|
||||
{
|
||||
m_values.insert(name, MakeStepSettings());
|
||||
}
|
||||
|
||||
void MakeStep::removeBuildConfiguration(const QString & name)
|
||||
{
|
||||
m_values.remove(name);
|
||||
}
|
||||
|
||||
void MakeStep::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||
{
|
||||
m_values.insert(dest, m_values.value(source));
|
||||
}
|
||||
|
||||
bool MakeStep::init(const QString &buildConfiguration)
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(buildConfiguration);
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
setBuildParser(m_pro->buildParser(bc));
|
||||
|
||||
setEnabled(true);
|
||||
@@ -111,13 +104,13 @@ bool MakeStep::init(const QString &buildConfiguration)
|
||||
|
||||
setCommand(m_pro->toolChain(bc)->makeCommand());
|
||||
|
||||
QStringList arguments = m_values.value(buildConfiguration).buildTargets;
|
||||
arguments << additionalArguments(buildConfiguration);
|
||||
setArguments(arguments); // TODO
|
||||
QStringList arguments = m_buildTargets;
|
||||
arguments << additionalArguments();
|
||||
setArguments(arguments);
|
||||
setEnvironment(m_pro->environment(bc));
|
||||
setIgnoreReturnValue(m_clean);
|
||||
|
||||
return AbstractMakeStep::init(buildConfiguration);
|
||||
return AbstractMakeStep::init();
|
||||
}
|
||||
|
||||
void MakeStep::run(QFutureInterface<bool> &fi)
|
||||
@@ -140,7 +133,7 @@ QString MakeStep::displayName()
|
||||
return "Make";
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget()
|
||||
BuildStepConfigWidget *MakeStep::createConfigWidget()
|
||||
{
|
||||
return new MakeStepConfigWidget(this);
|
||||
}
|
||||
@@ -166,29 +159,29 @@ CMakeProject *MakeStep::project() const
|
||||
return m_pro;
|
||||
}
|
||||
|
||||
bool MakeStep::buildsTarget(const QString &buildConfiguration, const QString &target) const
|
||||
bool MakeStep::buildsTarget(const QString &target) const
|
||||
{
|
||||
return m_values.value(buildConfiguration).buildTargets.contains(target);
|
||||
return m_buildTargets.contains(target);
|
||||
}
|
||||
|
||||
void MakeStep::setBuildTarget(const QString &buildConfiguration, const QString &target, bool on)
|
||||
void MakeStep::setBuildTarget(const QString &target, bool on)
|
||||
{
|
||||
QStringList old = m_values.value(buildConfiguration).buildTargets;
|
||||
QStringList old = m_buildTargets;
|
||||
if (on && !old.contains(target))
|
||||
old << target;
|
||||
else if(!on && old.contains(target))
|
||||
old.removeOne(target);
|
||||
m_values[buildConfiguration].buildTargets = old;
|
||||
m_buildTargets = old;
|
||||
}
|
||||
|
||||
QStringList MakeStep::additionalArguments(const QString &buildConfiguration) const
|
||||
QStringList MakeStep::additionalArguments() const
|
||||
{
|
||||
return m_values.value(buildConfiguration).additionalArguments;
|
||||
return m_additionalArguments;
|
||||
}
|
||||
|
||||
void MakeStep::setAdditionalArguments(const QString &buildConfiguration, const QStringList &list)
|
||||
void MakeStep::setAdditionalArguments(const QStringList &list)
|
||||
{
|
||||
m_values[buildConfiguration].additionalArguments = list;
|
||||
m_additionalArguments = list;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -227,13 +220,13 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||
|
||||
void MakeStepConfigWidget::additionalArgumentsEdited()
|
||||
{
|
||||
m_makeStep->setAdditionalArguments(m_buildConfiguration, ProjectExplorer::Environment::parseCombinedArgString(m_additionalArguments->text()));
|
||||
m_makeStep->setAdditionalArguments(Environment::parseCombinedArgString(m_additionalArguments->text()));
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::itemChanged(QListWidgetItem *item)
|
||||
{
|
||||
m_makeStep->setBuildTarget(m_buildConfiguration, item->text(), item->checkState() & Qt::Checked);
|
||||
m_makeStep->setBuildTarget(item->text(), item->checkState() & Qt::Checked);
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
@@ -242,30 +235,29 @@ QString MakeStepConfigWidget::displayName() const
|
||||
return "Make";
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::init(const QString &buildConfiguration)
|
||||
void MakeStepConfigWidget::init()
|
||||
{
|
||||
// disconnect to make the changes to the items
|
||||
disconnect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
||||
m_buildConfiguration = buildConfiguration;
|
||||
int count = m_targetsList->count();
|
||||
for(int i = 0; i < count; ++i) {
|
||||
QListWidgetItem *item = m_targetsList->item(i);
|
||||
item->setCheckState(m_makeStep->buildsTarget(buildConfiguration, item->text()) ? Qt::Checked : Qt::Unchecked);
|
||||
item->setCheckState(m_makeStep->buildsTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
// and connect again
|
||||
connect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
||||
|
||||
m_additionalArguments->setText(ProjectExplorer::Environment::joinArgumentList(m_makeStep->additionalArguments(m_buildConfiguration)));
|
||||
m_additionalArguments->setText(Environment::joinArgumentList(m_makeStep->additionalArguments()));
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::updateDetails()
|
||||
{
|
||||
QStringList arguments = m_makeStep->m_values.value(m_buildConfiguration).buildTargets;
|
||||
arguments << m_makeStep->additionalArguments(m_buildConfiguration);
|
||||
QStringList arguments = m_makeStep->m_buildTargets;
|
||||
arguments << m_makeStep->additionalArguments();
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2")
|
||||
.arg(m_makeStep->project()->toolChain(
|
||||
m_makeStep->project()->buildConfiguration(m_buildConfiguration))
|
||||
m_makeStep->buildConfiguration())
|
||||
->makeCommand(),
|
||||
arguments.join(" "));
|
||||
emit updateSummary();
|
||||
@@ -285,15 +277,20 @@ bool MakeStepFactory::canCreate(const QString &name) const
|
||||
return (Constants::MAKESTEP == name);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *MakeStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
|
||||
BuildStep *MakeStepFactory::create(Project *project, BuildConfiguration *bc, const QString &name) const
|
||||
{
|
||||
Q_ASSERT(name == Constants::MAKESTEP);
|
||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||
Q_ASSERT(pro);
|
||||
return new MakeStep(pro);
|
||||
return new MakeStep(pro, bc);
|
||||
}
|
||||
|
||||
QStringList MakeStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
|
||||
BuildStep *MakeStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
||||
{
|
||||
return new MakeStep(static_cast<MakeStep *>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList MakeStepFactory::canCreateForProject(Project * /* pro */) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
@@ -43,21 +43,16 @@ namespace Internal {
|
||||
|
||||
class CMakeProject;
|
||||
|
||||
struct MakeStepSettings
|
||||
{
|
||||
QStringList buildTargets;
|
||||
QStringList additionalArguments;
|
||||
};
|
||||
|
||||
class MakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class MakeStepConfigWidget; // TODO remove
|
||||
// This is for modifying m_values
|
||||
// This is for modifying internal data
|
||||
public:
|
||||
MakeStep(CMakeProject *pro);
|
||||
MakeStep(CMakeProject *pro, ProjectExplorer::BuildConfiguration *bc);
|
||||
MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||
~MakeStep();
|
||||
virtual bool init(const QString &buildConfiguration);
|
||||
virtual bool init();
|
||||
|
||||
virtual void run(QFutureInterface<bool> &fi);
|
||||
|
||||
@@ -66,22 +61,18 @@ public:
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
CMakeProject *project() const;
|
||||
bool buildsTarget(const QString &buildConfiguration, const QString &target) const;
|
||||
void setBuildTarget(const QString &buildConfiguration, const QString &target, bool on);
|
||||
QStringList additionalArguments(const QString &buildConfiguration) const;
|
||||
void setAdditionalArguments(const QString &buildConfiguration, const QStringList &list);
|
||||
bool buildsTarget(const QString &target) const;
|
||||
void setBuildTarget(const QString &target, bool on);
|
||||
QStringList additionalArguments() const;
|
||||
void setAdditionalArguments(const QStringList &list);
|
||||
|
||||
virtual void restoreFromMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoMap(QMap<QString, QVariant> &map);
|
||||
virtual void restoreFromGlobalMap(const QMap<QString, QVariant> &map);
|
||||
|
||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
|
||||
void setClean(bool clean);
|
||||
|
||||
virtual void restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map);
|
||||
|
||||
virtual void addBuildConfiguration(const QString & name);
|
||||
virtual void removeBuildConfiguration(const QString & name);
|
||||
virtual void copyBuildConfiguration(const QString &source, const QString &dest);
|
||||
protected:
|
||||
// For parsing [ 76%]
|
||||
virtual void stdOut(const QString &line);
|
||||
@@ -90,7 +81,8 @@ private:
|
||||
bool m_clean;
|
||||
QRegExp m_percentProgress;
|
||||
QFutureInterface<bool> *m_futureInterface;
|
||||
QMap<QString, MakeStepSettings> m_values;
|
||||
QStringList m_buildTargets;
|
||||
QStringList m_additionalArguments;
|
||||
};
|
||||
|
||||
class MakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
|
||||
@@ -99,14 +91,13 @@ class MakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
|
||||
public:
|
||||
MakeStepConfigWidget(MakeStep *makeStep);
|
||||
virtual QString displayName() const;
|
||||
virtual void init(const QString &buildConfiguration);
|
||||
virtual void init();
|
||||
virtual QString summaryText() const;
|
||||
private slots:
|
||||
void itemChanged(QListWidgetItem*);
|
||||
void additionalArgumentsEdited();
|
||||
void updateDetails();
|
||||
private:
|
||||
QString m_buildConfiguration;
|
||||
MakeStep *m_makeStep;
|
||||
QListWidget *m_targetsList;
|
||||
QLineEdit *m_additionalArguments;
|
||||
@@ -116,7 +107,8 @@ private:
|
||||
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, ProjectExplorer::BuildConfiguration *bc, const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
using namespace GenericProjectManager;
|
||||
using namespace GenericProjectManager::Internal;
|
||||
|
||||
GenericMakeStep::GenericMakeStep(GenericProject *pro)
|
||||
: AbstractMakeStep(pro), m_pro(pro)
|
||||
GenericMakeStep::GenericMakeStep(GenericProject *pro, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(pro, bc), m_pro(pro)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ GenericMakeStep::~GenericMakeStep()
|
||||
{
|
||||
}
|
||||
|
||||
bool GenericMakeStep::init(const QString &buildConfigurationName)
|
||||
bool GenericMakeStep::init()
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(buildConfigurationName);
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
const QString buildParser = m_pro->buildParser(bc);
|
||||
setBuildParser(buildParser);
|
||||
qDebug() << "*** build parser:" << buildParser;
|
||||
@@ -69,50 +69,34 @@ bool GenericMakeStep::init(const QString &buildConfigurationName)
|
||||
const QString buildDir = vm->resolve(rawBuildDir);
|
||||
setWorkingDirectory(buildDir);
|
||||
|
||||
setCommand(makeCommand(buildConfigurationName));
|
||||
setArguments(replacedArguments(buildConfigurationName));
|
||||
setCommand(makeCommand());
|
||||
setArguments(replacedArguments());
|
||||
|
||||
setEnvironment(m_pro->environment(bc));
|
||||
return AbstractMakeStep::init(buildConfigurationName);
|
||||
return AbstractMakeStep::init();
|
||||
}
|
||||
|
||||
void GenericMakeStep::restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map)
|
||||
void GenericMakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
m_values[buildConfiguration].buildTargets = map.value("buildTargets").toStringList();
|
||||
m_values[buildConfiguration].makeArguments = map.value("makeArguments").toStringList();
|
||||
m_values[buildConfiguration].makeCommand = map.value("makeCommand").toString();
|
||||
ProjectExplorer::AbstractMakeStep::restoreFromMap(buildConfiguration, map);
|
||||
m_buildTargets = map.value("buildTargets").toStringList();
|
||||
m_makeArguments = map.value("makeArguments").toStringList();
|
||||
m_makeCommand = map.value("makeCommand").toString();
|
||||
ProjectExplorer::AbstractMakeStep::restoreFromLocalMap(map);
|
||||
}
|
||||
|
||||
void GenericMakeStep::storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map)
|
||||
void GenericMakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
{
|
||||
map["buildTargets"] = m_values.value(buildConfiguration).buildTargets;
|
||||
map["makeArguments"] = m_values.value(buildConfiguration).makeArguments;
|
||||
map["makeCommand"] = m_values.value(buildConfiguration).makeCommand;
|
||||
ProjectExplorer::AbstractMakeStep::storeIntoMap(buildConfiguration, map);
|
||||
map["buildTargets"] = m_buildTargets;
|
||||
map["makeArguments"] = m_makeArguments;
|
||||
map["makeCommand"] = m_makeCommand;
|
||||
ProjectExplorer::AbstractMakeStep::storeIntoLocalMap(map);
|
||||
}
|
||||
|
||||
void GenericMakeStep::addBuildConfiguration(const QString & name)
|
||||
{
|
||||
m_values.insert(name, GenericMakeStepSettings());
|
||||
}
|
||||
|
||||
void GenericMakeStep::removeBuildConfiguration(const QString & name)
|
||||
{
|
||||
m_values.remove(name);
|
||||
}
|
||||
|
||||
void GenericMakeStep::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||
{
|
||||
m_values.insert(dest, m_values.value(source));
|
||||
}
|
||||
|
||||
|
||||
QStringList GenericMakeStep::replacedArguments(const QString &buildConfiguration) const
|
||||
QStringList GenericMakeStep::replacedArguments() const
|
||||
{
|
||||
Core::VariableManager *vm = Core::VariableManager::instance();
|
||||
const QStringList targets = m_values.value(buildConfiguration).buildTargets;
|
||||
QStringList arguments = m_values.value(buildConfiguration).makeArguments;
|
||||
const QStringList targets = m_buildTargets;
|
||||
QStringList arguments = m_makeArguments;
|
||||
QStringList replacedArguments;
|
||||
foreach (const QString &arg, arguments) {
|
||||
replacedArguments.append(vm->resolve(arg));
|
||||
@@ -123,9 +107,9 @@ QStringList GenericMakeStep::replacedArguments(const QString &buildConfiguration
|
||||
return replacedArguments;
|
||||
}
|
||||
|
||||
QString GenericMakeStep::makeCommand(const QString &buildConfiguration) const
|
||||
QString GenericMakeStep::makeCommand() const
|
||||
{
|
||||
QString command = m_values.value(buildConfiguration).makeCommand;
|
||||
QString command = m_makeCommand;
|
||||
if (command.isEmpty()) {
|
||||
if (ProjectExplorer::ToolChain *toolChain = m_pro->toolChain())
|
||||
command = toolChain->makeCommand();
|
||||
@@ -165,20 +149,20 @@ GenericProject *GenericMakeStep::project() const
|
||||
return m_pro;
|
||||
}
|
||||
|
||||
bool GenericMakeStep::buildsTarget(const QString &buildConfiguration, const QString &target) const
|
||||
bool GenericMakeStep::buildsTarget(const QString &target) const
|
||||
{
|
||||
return m_values.value(buildConfiguration).buildTargets.contains(target);
|
||||
return m_buildTargets.contains(target);
|
||||
}
|
||||
|
||||
void GenericMakeStep::setBuildTarget(const QString &buildConfiguration, const QString &target, bool on)
|
||||
void GenericMakeStep::setBuildTarget(const QString &target, bool on)
|
||||
{
|
||||
QStringList old = m_values.value(buildConfiguration).buildTargets;
|
||||
QStringList old = m_buildTargets;
|
||||
if (on && !old.contains(target))
|
||||
old << target;
|
||||
else if(!on && old.contains(target))
|
||||
old.removeOne(target);
|
||||
|
||||
m_values[buildConfiguration].buildTargets = old;
|
||||
m_buildTargets = old;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -220,19 +204,17 @@ QString GenericMakeStepConfigWidget::displayName() const
|
||||
// TODO: Label should update when tool chain is changed
|
||||
void GenericMakeStepConfigWidget::updateMakeOverrrideLabel()
|
||||
{
|
||||
m_ui->makeLabel->setText(tr("Override %1:").arg(m_makeStep->makeCommand(m_buildConfiguration)));
|
||||
m_ui->makeLabel->setText(tr("Override %1:").arg(m_makeStep->makeCommand()));
|
||||
}
|
||||
|
||||
void GenericMakeStepConfigWidget::init(const QString &buildConfiguration)
|
||||
void GenericMakeStepConfigWidget::init()
|
||||
{
|
||||
m_buildConfiguration = buildConfiguration;
|
||||
|
||||
updateMakeOverrrideLabel();
|
||||
|
||||
QString makeCommand = m_makeStep->m_values.value(buildConfiguration).makeCommand;
|
||||
QString makeCommand = m_makeStep->m_makeCommand;
|
||||
m_ui->makeLineEdit->setText(makeCommand);
|
||||
|
||||
const QStringList &makeArguments = m_makeStep->m_values.value(buildConfiguration).makeArguments;
|
||||
const QStringList &makeArguments = m_makeStep->m_makeArguments;
|
||||
m_ui->makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
|
||||
|
||||
// Disconnect to make the changes to the items
|
||||
@@ -241,7 +223,7 @@ void GenericMakeStepConfigWidget::init(const QString &buildConfiguration)
|
||||
int count = m_ui->targetsList->count();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
QListWidgetItem *item = m_ui->targetsList->item(i);
|
||||
item->setCheckState(m_makeStep->buildsTarget(buildConfiguration, item->text()) ? Qt::Checked : Qt::Unchecked);
|
||||
item->setCheckState(m_makeStep->buildsTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
|
||||
updateDetails();
|
||||
@@ -252,8 +234,8 @@ void GenericMakeStepConfigWidget::init(const QString &buildConfiguration)
|
||||
void GenericMakeStepConfigWidget::updateDetails()
|
||||
{
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2")
|
||||
.arg(m_makeStep->makeCommand(m_buildConfiguration),
|
||||
ProjectExplorer::Environment::joinArgumentList(m_makeStep->replacedArguments(m_buildConfiguration)));
|
||||
.arg(m_makeStep->makeCommand(),
|
||||
ProjectExplorer::Environment::joinArgumentList(m_makeStep->replacedArguments()));
|
||||
emit updateSummary();
|
||||
}
|
||||
|
||||
@@ -264,23 +246,20 @@ QString GenericMakeStepConfigWidget::summaryText() const
|
||||
|
||||
void GenericMakeStepConfigWidget::itemChanged(QListWidgetItem *item)
|
||||
{
|
||||
QTC_ASSERT(!m_buildConfiguration.isNull(), return);
|
||||
m_makeStep->setBuildTarget(m_buildConfiguration, item->text(), item->checkState() & Qt::Checked);
|
||||
m_makeStep->setBuildTarget(item->text(), item->checkState() & Qt::Checked);
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void GenericMakeStepConfigWidget::makeLineEditTextEdited()
|
||||
{
|
||||
QTC_ASSERT(!m_buildConfiguration.isNull(), return);
|
||||
m_makeStep->m_values[m_buildConfiguration].makeCommand = m_ui->makeLineEdit->text();
|
||||
m_makeStep->m_makeCommand = m_ui->makeLineEdit->text();
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void GenericMakeStepConfigWidget::makeArgumentsLineEditTextEdited()
|
||||
{
|
||||
QTC_ASSERT(!m_buildConfiguration.isNull(), return);
|
||||
m_makeStep->m_values[m_buildConfiguration].makeArguments =
|
||||
ProjectExplorer::Environment::parseCombinedArgString(m_ui->makeArgumentsLineEdit->text());
|
||||
m_makeStep->m_makeArguments =
|
||||
ProjectExplorer::Environment::parseCombinedArgString(m_ui->makeArgumentsLineEdit->text());
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
@@ -293,12 +272,20 @@ bool GenericMakeStepFactory::canCreate(const QString &name) const
|
||||
return (Constants::MAKESTEP == name);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::create(ProjectExplorer::Project *project,
|
||||
ProjectExplorer::BuildConfiguration *bc,
|
||||
const QString &name) const
|
||||
{
|
||||
Q_ASSERT(name == Constants::MAKESTEP);
|
||||
GenericProject *pro = qobject_cast<GenericProject *>(project);
|
||||
Q_ASSERT(pro);
|
||||
return new GenericMakeStep(pro);
|
||||
return new GenericMakeStep(pro, bc);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::clone(ProjectExplorer::BuildStep *bs,
|
||||
ProjectExplorer::BuildConfiguration *bc) const
|
||||
{
|
||||
return new GenericMakeStep(static_cast<GenericMakeStep*>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList GenericMakeStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
|
||||
|
||||
@@ -48,20 +48,18 @@ class GenericMakeStepConfigWidget;
|
||||
|
||||
struct GenericMakeStepSettings
|
||||
{
|
||||
QStringList buildTargets;
|
||||
QStringList makeArguments;
|
||||
QString makeCommand;
|
||||
|
||||
};
|
||||
|
||||
class GenericMakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class GenericMakeStepConfigWidget; // TODO remove again?
|
||||
// Currently the ConfigWidget accesses the m_values directly
|
||||
public:
|
||||
GenericMakeStep(GenericProject *pro);
|
||||
GenericMakeStep(GenericProject *pro, ProjectExplorer::BuildConfiguration *bc);
|
||||
GenericMakeStep(GenericMakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||
~GenericMakeStep();
|
||||
virtual bool init(const QString &buildConfiguration);
|
||||
virtual bool init();
|
||||
|
||||
virtual void run(QFutureInterface<bool> &fi);
|
||||
|
||||
@@ -70,20 +68,18 @@ public:
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
GenericProject *project() const;
|
||||
bool buildsTarget(const QString &buildConfiguration, const QString &target) const;
|
||||
void setBuildTarget(const QString &buildConfiguration, const QString &target, bool on);
|
||||
QStringList replacedArguments(const QString &buildConfiguration) const;
|
||||
QString makeCommand(const QString &buildConfiguration) const;
|
||||
bool buildsTarget(const QString &target) const;
|
||||
void setBuildTarget(const QString &target, bool on);
|
||||
QStringList replacedArguments() const;
|
||||
QString makeCommand() const;
|
||||
|
||||
virtual void restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map);
|
||||
|
||||
virtual void addBuildConfiguration(const QString & name);
|
||||
virtual void removeBuildConfiguration(const QString & name);
|
||||
virtual void copyBuildConfiguration(const QString &source, const QString &dest);
|
||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
private:
|
||||
GenericProject *m_pro;
|
||||
QMap<QString, GenericMakeStepSettings> m_values;
|
||||
QStringList m_buildTargets;
|
||||
QStringList m_makeArguments;
|
||||
QString m_makeCommand;
|
||||
};
|
||||
|
||||
class GenericMakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
|
||||
@@ -92,7 +88,7 @@ class GenericMakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
|
||||
public:
|
||||
GenericMakeStepConfigWidget(GenericMakeStep *makeStep);
|
||||
virtual QString displayName() const;
|
||||
virtual void init(const QString &buildConfiguration);
|
||||
virtual void init();
|
||||
virtual QString summaryText() const;
|
||||
private slots:
|
||||
void itemChanged(QListWidgetItem*);
|
||||
@@ -101,7 +97,6 @@ private slots:
|
||||
void updateMakeOverrrideLabel();
|
||||
void updateDetails();
|
||||
private:
|
||||
QString m_buildConfiguration;
|
||||
Ui::GenericMakeStep *m_ui;
|
||||
GenericMakeStep *m_makeStep;
|
||||
QString m_summaryText;
|
||||
@@ -110,7 +105,11 @@ private:
|
||||
class GenericMakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro,
|
||||
ProjectExplorer::BuildConfiguration *bc,
|
||||
const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs,
|
||||
ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
|
||||
@@ -147,7 +147,10 @@ bool GenericBuildConfigurationFactory::create(const QString &type) const
|
||||
return false;
|
||||
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
|
||||
m_project->addBuildConfiguration(bc); // also makes the name unique...
|
||||
m_project->makeStep()->setBuildTarget(bc->name(), "all", true);
|
||||
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(m_project, bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
makeStep->setBuildTarget("all", /* on = */ true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -510,34 +513,25 @@ QStringList GenericProject::targets() const
|
||||
return targets;
|
||||
}
|
||||
|
||||
GenericMakeStep *GenericProject::makeStep() const
|
||||
{
|
||||
foreach (ProjectExplorer::BuildStep *bs, buildSteps()) {
|
||||
if (GenericMakeStep *ms = qobject_cast<GenericMakeStep *>(bs))
|
||||
return ms;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool GenericProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader)
|
||||
{
|
||||
Project::restoreSettingsImpl(reader);
|
||||
|
||||
if (buildConfigurations().isEmpty()) {
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(this);
|
||||
insertBuildStep(0, makeStep);
|
||||
|
||||
const QLatin1String all("all");
|
||||
|
||||
ProjectExplorer::BuildConfiguration *bc = new BuildConfiguration(all);
|
||||
ProjectExplorer::BuildConfiguration *bc = new BuildConfiguration("all");
|
||||
addBuildConfiguration(bc);
|
||||
setActiveBuildConfiguration(bc);
|
||||
makeStep->setBuildTarget(all, all, /* on = */ true);
|
||||
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(this, bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
|
||||
makeStep->setBuildTarget("all", /* on = */ true);
|
||||
|
||||
const QLatin1String buildDirectory("buildDirectory");
|
||||
|
||||
const QFileInfo fileInfo(file()->fileName());
|
||||
bc->setValue(buildDirectory, fileInfo.absolutePath());
|
||||
|
||||
setActiveBuildConfiguration(bc);
|
||||
}
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
@@ -103,7 +103,6 @@ public:
|
||||
virtual QStringList files(FilesMode fileMode) const;
|
||||
|
||||
QStringList targets() const;
|
||||
GenericMakeStep *makeStep() const;
|
||||
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
ProjectExplorer::ToolChain *toolChain() const;
|
||||
|
||||
|
||||
@@ -46,27 +46,31 @@ namespace {
|
||||
bool debug = false;
|
||||
}
|
||||
|
||||
AbstractMakeStep::AbstractMakeStep(Project *project)
|
||||
: AbstractProcessStep(project),
|
||||
m_project(project),
|
||||
AbstractMakeStep::AbstractMakeStep(Project *project, BuildConfiguration *bc)
|
||||
: AbstractProcessStep(project, bc),
|
||||
m_buildParser(0)
|
||||
{
|
||||
}
|
||||
|
||||
AbstractMakeStep::AbstractMakeStep(AbstractMakeStep *bs, BuildConfiguration *bc)
|
||||
: AbstractProcessStep(bs, bc),
|
||||
m_buildParser(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AbstractMakeStep::~AbstractMakeStep()
|
||||
{
|
||||
delete m_buildParser;
|
||||
m_buildParser = 0;
|
||||
}
|
||||
|
||||
bool AbstractMakeStep::init(const QString &buildConfiguration)
|
||||
bool AbstractMakeStep::init()
|
||||
{
|
||||
m_buildConfiguration = buildConfiguration;
|
||||
|
||||
m_openDirectories.clear();
|
||||
addDirectory(workingDirectory());
|
||||
|
||||
return AbstractProcessStep::init(buildConfiguration);
|
||||
return AbstractProcessStep::init();
|
||||
}
|
||||
|
||||
QString AbstractMakeStep::buildParser() const
|
||||
@@ -140,7 +144,7 @@ void AbstractMakeStep::slotAddToTaskWindow(const TaskWindow::Task &task)
|
||||
if (debug)
|
||||
qDebug() << "No success. Trying all files in project ...";
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
foreach (const QString &file, m_project->files(ProjectExplorer::Project::AllFiles)) {
|
||||
foreach (const QString &file, project()->files(ProjectExplorer::Project::AllFiles)) {
|
||||
QFileInfo candidate(file);
|
||||
if (candidate.fileName() == fileName) {
|
||||
if (debug)
|
||||
|
||||
@@ -46,9 +46,10 @@ class PROJECTEXPLORER_EXPORT AbstractMakeStep : public ProjectExplorer::Abstract
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AbstractMakeStep(Project * project);
|
||||
AbstractMakeStep(Project * project, BuildConfiguration *bc);
|
||||
AbstractMakeStep(AbstractMakeStep *bs, BuildConfiguration *bc);
|
||||
~AbstractMakeStep();
|
||||
virtual bool init(const QString & name);
|
||||
virtual bool init();
|
||||
virtual void run(QFutureInterface<bool> &);
|
||||
|
||||
protected:
|
||||
@@ -64,7 +65,6 @@ private slots:
|
||||
void addDirectory(const QString &dir);
|
||||
void removeDirectory(const QString &dir);
|
||||
private:
|
||||
Project *m_project;
|
||||
QString m_buildParserName;
|
||||
ProjectExplorer::IBuildParser *m_buildParser;
|
||||
QString m_buildConfiguration;
|
||||
|
||||
@@ -39,9 +39,16 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
AbstractProcessStep::AbstractProcessStep(Project *pro)
|
||||
: BuildStep(pro)
|
||||
AbstractProcessStep::AbstractProcessStep(Project *pro, BuildConfiguration *bc)
|
||||
: BuildStep(pro, bc), m_timer(0), m_futureInterface(0), m_process(0), m_eventLoop(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AbstractProcessStep::AbstractProcessStep(AbstractProcessStep *bs, BuildConfiguration *bc)
|
||||
: BuildStep(bs, bc), m_timer(0), m_futureInterface(0), m_process(0), m_eventLoop(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AbstractProcessStep::setCommand(const QString &cmd)
|
||||
@@ -79,9 +86,8 @@ void AbstractProcessStep::setEnvironment(Environment env)
|
||||
m_environment = env;
|
||||
}
|
||||
|
||||
bool AbstractProcessStep::init(const QString &buildConfiguration)
|
||||
bool AbstractProcessStep::init()
|
||||
{
|
||||
Q_UNUSED(buildConfiguration)
|
||||
if (QFileInfo(m_command).isRelative()) {
|
||||
QString searchInPath = m_environment.searchInPath(m_command);
|
||||
if (!searchInPath.isEmpty())
|
||||
@@ -133,6 +139,7 @@ void AbstractProcessStep::run(QFutureInterface<bool> & fi)
|
||||
m_eventLoop->exec();
|
||||
m_timer->stop();
|
||||
delete m_timer;
|
||||
m_timer = 0;
|
||||
|
||||
// The process has finished, leftover data is read in processFinished
|
||||
bool returnValue = processFinished(m_process->exitCode(), m_process->exitStatus());
|
||||
@@ -142,6 +149,7 @@ void AbstractProcessStep::run(QFutureInterface<bool> & fi)
|
||||
delete m_eventLoop;
|
||||
m_eventLoop = 0;
|
||||
fi.reportResult(returnValue);
|
||||
m_futureInterface = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,10 +65,11 @@ class PROJECTEXPLORER_EXPORT AbstractProcessStep : public BuildStep
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AbstractProcessStep(Project *pro);
|
||||
AbstractProcessStep(Project *pro, BuildConfiguration *bc);
|
||||
AbstractProcessStep(AbstractProcessStep *bs, BuildConfiguration *bc);
|
||||
/// reimplemented from BuildStep::init()
|
||||
/// You need to call this from YourBuildStep::init()
|
||||
virtual bool init(const QString & name);
|
||||
virtual bool init();
|
||||
/// reimplemented from BuildStep::init()
|
||||
/// You need to call this from YourBuildStep::run()
|
||||
virtual void run(QFutureInterface<bool> &);
|
||||
|
||||
@@ -30,9 +30,20 @@
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
IBuildStepFactory *findFactory(const QString &name)
|
||||
{
|
||||
QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
|
||||
foreach(IBuildStepFactory *factory, factories)
|
||||
if (factory->canCreate(name))
|
||||
return factory;
|
||||
return 0;
|
||||
}
|
||||
|
||||
BuildConfiguration::BuildConfiguration(const QString &name)
|
||||
: m_name(name)
|
||||
{
|
||||
@@ -42,6 +53,22 @@ BuildConfiguration::BuildConfiguration(const QString &name)
|
||||
BuildConfiguration::BuildConfiguration(const QString &name, BuildConfiguration *source)
|
||||
: m_values(source->m_values), m_name(name)
|
||||
{
|
||||
foreach(BuildStep *originalbs, source->buildSteps()) {
|
||||
IBuildStepFactory *factory = findFactory(originalbs->name());
|
||||
BuildStep *clonebs = factory->clone(originalbs, this);
|
||||
m_buildSteps.append(clonebs);
|
||||
}
|
||||
foreach(BuildStep *originalcs, source->cleanSteps()) {
|
||||
IBuildStepFactory *factory = findFactory(originalcs->name());
|
||||
BuildStep *clonecs = factory->clone(originalcs, this);
|
||||
m_cleanSteps.append(clonecs);
|
||||
}
|
||||
}
|
||||
|
||||
BuildConfiguration::~BuildConfiguration()
|
||||
{
|
||||
qDeleteAll(m_buildSteps);
|
||||
qDeleteAll(m_cleanSteps);
|
||||
}
|
||||
|
||||
void BuildConfiguration::setName(const QString &name)
|
||||
@@ -98,6 +125,53 @@ QMap<QString, QVariant> BuildConfiguration::toMap() const
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<BuildStep *> BuildConfiguration::buildSteps() const
|
||||
{
|
||||
return m_buildSteps;
|
||||
}
|
||||
|
||||
void BuildConfiguration::insertBuildStep(int position, BuildStep *step)
|
||||
{
|
||||
m_buildSteps.insert(position, step);
|
||||
}
|
||||
|
||||
void BuildConfiguration::removeBuildStep(int position)
|
||||
{
|
||||
delete m_buildSteps.at(position);
|
||||
m_buildSteps.removeAt(position);
|
||||
}
|
||||
|
||||
void BuildConfiguration::moveBuildStepUp(int position)
|
||||
{
|
||||
BuildStep *bs = m_buildSteps.takeAt(position);
|
||||
m_buildSteps.insert(position - 1, bs);
|
||||
}
|
||||
|
||||
QList<BuildStep *> BuildConfiguration::cleanSteps() const
|
||||
{
|
||||
return m_cleanSteps;
|
||||
}
|
||||
|
||||
void BuildConfiguration::insertCleanStep(int position, BuildStep *step)
|
||||
{
|
||||
m_cleanSteps.insert(position, step);
|
||||
}
|
||||
|
||||
void BuildConfiguration::removeCleanStep(int position)
|
||||
{
|
||||
delete m_cleanSteps.at(position);
|
||||
m_cleanSteps.removeAt(position);
|
||||
}
|
||||
|
||||
void BuildConfiguration::moveCleanStepUp(int position)
|
||||
{
|
||||
BuildStep *cs = m_cleanSteps.takeAt(position);
|
||||
m_cleanSteps.insert(position, cs);
|
||||
}
|
||||
|
||||
///
|
||||
// IBuildConfigurationFactory
|
||||
///
|
||||
|
||||
IBuildConfigurationFactory::IBuildConfigurationFactory(QObject *parent)
|
||||
: QObject(parent)
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
#include "buildstep.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Project;
|
||||
@@ -50,6 +52,7 @@ class PROJECTEXPLORER_EXPORT BuildConfiguration : public QObject
|
||||
public:
|
||||
BuildConfiguration(const QString &name);
|
||||
BuildConfiguration(const QString &name, BuildConfiguration *source);
|
||||
~BuildConfiguration();
|
||||
QString name() const;
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &name);
|
||||
@@ -60,12 +63,25 @@ public:
|
||||
QMap<QString, QVariant> toMap() const;
|
||||
void setValuesFromMap(QMap<QString, QVariant> map);
|
||||
|
||||
QList<BuildStep *> buildSteps() const;
|
||||
void insertBuildStep(int position, BuildStep *step);
|
||||
void removeBuildStep(int position);
|
||||
void moveBuildStepUp(int position);
|
||||
|
||||
QList<BuildStep *> cleanSteps() const;
|
||||
void insertCleanStep(int position, BuildStep *step);
|
||||
void removeCleanStep(int position);
|
||||
void moveCleanStepUp(int position);
|
||||
|
||||
private:
|
||||
void setName(const QString &name);
|
||||
|
||||
QList<BuildStep *> m_buildSteps;
|
||||
QList<BuildStep *> m_cleanSteps;
|
||||
|
||||
QHash<QString, QVariant> m_values;
|
||||
QString m_name;
|
||||
friend class Project;
|
||||
friend class Project; // for setName
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory : public QObject
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "project.h"
|
||||
#include "projectexplorersettings.h"
|
||||
#include "taskwindow.h"
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
@@ -150,7 +151,6 @@ void BuildManager::clearBuildQueue()
|
||||
decrementActiveBuildSteps(bs->project());
|
||||
|
||||
m_buildQueue.clear();
|
||||
m_configurations.clear();
|
||||
m_running = false;
|
||||
m_previousBuildStepProject = 0;
|
||||
|
||||
@@ -285,16 +285,14 @@ void BuildManager::nextStep()
|
||||
{
|
||||
if (!m_buildQueue.empty()) {
|
||||
m_currentBuildStep = m_buildQueue.front();
|
||||
m_currentConfiguration = m_configurations.front();
|
||||
m_buildQueue.pop_front();
|
||||
m_configurations.pop_front();
|
||||
|
||||
connect(m_currentBuildStep, SIGNAL(addToTaskWindow(ProjectExplorer::TaskWindow::Task)),
|
||||
this, SLOT(addToTaskWindow(ProjectExplorer::TaskWindow::Task)));
|
||||
connect(m_currentBuildStep, SIGNAL(addToOutputWindow(QString)),
|
||||
this, SLOT(addToOutputWindow(QString)));
|
||||
|
||||
bool init = m_currentBuildStep->init(m_currentConfiguration);
|
||||
bool init = m_currentBuildStep->init();
|
||||
if (!init) {
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">Error while building project %1</font>").arg(m_currentBuildStep->project()->name()));
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">When executing build step '%1'</font>").arg(m_currentBuildStep->displayName()));
|
||||
@@ -321,12 +319,11 @@ void BuildManager::nextStep()
|
||||
}
|
||||
}
|
||||
|
||||
void BuildManager::buildQueueAppend(BuildStep * bs, const QString &configuration)
|
||||
void BuildManager::buildQueueAppend(BuildStep * bs)
|
||||
{
|
||||
m_buildQueue.append(bs);
|
||||
++m_maxProgress;
|
||||
incrementActiveBuildSteps(bs->project());
|
||||
m_configurations.append(configuration);
|
||||
}
|
||||
|
||||
void BuildManager::buildProjects(const QList<Project *> &projects, const QList<QString> &configurations)
|
||||
@@ -338,9 +335,10 @@ void BuildManager::buildProjects(const QList<Project *> &projects, const QList<Q
|
||||
|
||||
for (it = projects.constBegin(); it != end; ++it, ++cit) {
|
||||
if (*cit != QString::null) {
|
||||
QList<BuildStep *> buildSteps = (*it)->buildSteps();
|
||||
BuildConfiguration *bc = (*it)->buildConfiguration(*cit);
|
||||
QList<BuildStep *> buildSteps = bc->buildSteps();
|
||||
foreach (BuildStep *bs, buildSteps) {
|
||||
buildQueueAppend(bs, *cit);
|
||||
buildQueueAppend(bs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -357,9 +355,12 @@ void BuildManager::cleanProjects(const QList<Project *> &projects, const QList<Q
|
||||
end = projects.constEnd();
|
||||
|
||||
for (it = projects.constBegin(); it != end; ++it, ++cit) {
|
||||
QList<BuildStep *> cleanSteps = (*it)->cleanSteps();
|
||||
foreach (BuildStep *bs, cleanSteps) {
|
||||
buildQueueAppend(bs, *cit);
|
||||
if (*cit != QString::null) {
|
||||
BuildConfiguration *bc = (*it)->buildConfiguration(*cit);
|
||||
QList<BuildStep *> cleanSteps = bc->cleanSteps();
|
||||
foreach (BuildStep *bs, cleanSteps) {
|
||||
buildQueueAppend(bs);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
|
||||
@@ -377,9 +378,9 @@ void BuildManager::cleanProject(Project *p, const QString &configuration)
|
||||
cleanProjects(QList<Project *>() << p, QList<QString>() << configuration);
|
||||
}
|
||||
|
||||
void BuildManager::appendStep(BuildStep *step, const QString &configuration)
|
||||
void BuildManager::appendStep(BuildStep *step)
|
||||
{
|
||||
buildQueueAppend(step, configuration);
|
||||
buildQueueAppend(step);
|
||||
startBuildQueue();
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
bool isBuilding(Project *p);
|
||||
|
||||
// Append any build step to the list of build steps (currently only used to add the QMakeStep)
|
||||
void appendStep(BuildStep *step, const QString& configuration);
|
||||
void appendStep(BuildStep *step);
|
||||
|
||||
public slots:
|
||||
void cancel();
|
||||
@@ -104,7 +104,7 @@ private:
|
||||
void startBuildQueue();
|
||||
void nextStep();
|
||||
void clearBuildQueue();
|
||||
void buildQueueAppend(BuildStep * bs, const QString &configuration);
|
||||
void buildQueueAppend(BuildStep * bs);
|
||||
void incrementActiveBuildSteps(Project *pro);
|
||||
void decrementActiveBuildSteps(Project *pro);
|
||||
|
||||
|
||||
@@ -36,58 +36,46 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
BuildStep::BuildStep(Project * pro)
|
||||
: m_project(pro)
|
||||
BuildStep::BuildStep(Project * pro, BuildConfiguration *bc)
|
||||
: m_project(pro), m_buildConfiguration(bc)
|
||||
{
|
||||
}
|
||||
|
||||
BuildStep::BuildStep(BuildStep *bs, BuildConfiguration *bc)
|
||||
: m_project(bs->m_project), m_buildConfiguration(bc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BuildStep::~BuildStep()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void BuildStep::restoreFromMap(const QMap<QString, QVariant> &map)
|
||||
void BuildStep::restoreFromGlobalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
Q_UNUSED(map)
|
||||
}
|
||||
|
||||
void BuildStep::storeIntoMap(QMap<QString, QVariant> &map)
|
||||
void BuildStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
Q_UNUSED(map)
|
||||
}
|
||||
|
||||
void BuildStep::restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map)
|
||||
void BuildStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
{
|
||||
Q_UNUSED(buildConfiguration)
|
||||
Q_UNUSED(map)
|
||||
}
|
||||
|
||||
void BuildStep::storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map)
|
||||
{
|
||||
Q_UNUSED(buildConfiguration)
|
||||
Q_UNUSED(map)
|
||||
}
|
||||
|
||||
Project * BuildStep::project() const
|
||||
Project *BuildStep::project() const
|
||||
{
|
||||
return m_project;
|
||||
}
|
||||
|
||||
void BuildStep::addBuildConfiguration(const QString &name)
|
||||
BuildConfiguration *BuildStep::buildConfiguration() const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
}
|
||||
|
||||
void BuildStep::removeBuildConfiguration(const QString &name)
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
}
|
||||
|
||||
void BuildStep::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||
{
|
||||
Q_UNUSED(source)
|
||||
Q_UNUSED(dest)
|
||||
return m_buildConfiguration;
|
||||
}
|
||||
|
||||
bool BuildStep::immutable() const
|
||||
|
||||
@@ -72,13 +72,16 @@ class PROJECTEXPLORER_EXPORT BuildStep : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class Project; //for managing BuildConfigurations
|
||||
protected:
|
||||
BuildStep(Project *p, BuildConfiguration *bc);
|
||||
BuildStep(BuildStep *bs, BuildConfiguration *bc);
|
||||
|
||||
public:
|
||||
BuildStep(Project *p);
|
||||
virtual ~BuildStep();
|
||||
|
||||
// This function is run in the gui thread,
|
||||
// use it to retrieve any information that you need in run()
|
||||
virtual bool init(const QString &buildConfiguration) = 0;
|
||||
virtual bool init() = 0;
|
||||
|
||||
// Reimplement this. This function is called when the project is build.
|
||||
// This function is NOT run in the gui thread. It runs in its own thread
|
||||
@@ -101,17 +104,14 @@ public:
|
||||
// the default implementation returns false
|
||||
virtual bool immutable() const;
|
||||
|
||||
virtual void restoreFromMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoMap(QMap<QString, QVariant> &map);
|
||||
// TODO remove after 2.0
|
||||
virtual void restoreFromGlobalMap(const QMap<QString, QVariant> &map);
|
||||
|
||||
virtual void restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map);
|
||||
|
||||
virtual void addBuildConfiguration(const QString & name);
|
||||
virtual void removeBuildConfiguration(const QString & name);
|
||||
virtual void copyBuildConfiguration(const QString &source, const QString &dest);
|
||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
|
||||
Project *project() const;
|
||||
BuildConfiguration *buildConfiguration() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void addToTaskWindow(const ProjectExplorer::TaskWindow::Task &task);
|
||||
@@ -121,6 +121,7 @@ Q_SIGNALS:
|
||||
|
||||
private:
|
||||
Project *m_project;
|
||||
BuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT IBuildStepFactory
|
||||
@@ -131,14 +132,17 @@ class PROJECTEXPLORER_EXPORT IBuildStepFactory
|
||||
public:
|
||||
IBuildStepFactory();
|
||||
virtual ~IBuildStepFactory();
|
||||
// Called to check wheter this factory can restore the named BuildStep
|
||||
/// Called to check wheter this factory can restore the named BuildStep
|
||||
virtual bool canCreate(const QString &name) const = 0;
|
||||
// Called to restore a buildstep
|
||||
virtual BuildStep *create(Project *pro, const QString &name) const = 0;
|
||||
// Caleld by the add BuildStep action to check which BuildSteps could be added
|
||||
// to the project by this factory, should return a list of names
|
||||
/// Called to restore a buildstep
|
||||
virtual BuildStep *create(Project *pro, BuildConfiguration *bc, const QString &name) const = 0;
|
||||
/// Called by the add BuildStep action to check which BuildSteps could be added
|
||||
/// to the project by this factory, should return a list of names
|
||||
virtual QStringList canCreateForProject(Project *pro) const = 0;
|
||||
// Called to convert an internal name to a displayName
|
||||
/// Called to convert an internal name to a displayName
|
||||
|
||||
/// Called to clone a BuildStep
|
||||
virtual BuildStep *clone(BuildStep *bs, BuildConfiguration *bc) const = 0;
|
||||
virtual QString displayNameForName(const QString &name) const = 0;
|
||||
};
|
||||
|
||||
@@ -158,14 +162,16 @@ public:
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT BuildStepConfigWidget
|
||||
: public BuildConfigWidget
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BuildStepConfigWidget()
|
||||
: BuildConfigWidget()
|
||||
: QWidget()
|
||||
{}
|
||||
virtual void init() = 0;
|
||||
virtual QString summaryText() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
signals:
|
||||
void updateSummary();
|
||||
};
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "buildstepspage.h"
|
||||
|
||||
#include "project.h"
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -53,13 +53,8 @@ BuildStepsPage::BuildStepsPage(Project *project, bool clean) :
|
||||
m_vbox = new QVBoxLayout(this);
|
||||
m_vbox->setContentsMargins(0, 0, 0, 0);
|
||||
m_vbox->setSpacing(0);
|
||||
const QList<BuildStep *> &steps = m_clean ? m_pro->cleanSteps() : m_pro->buildSteps();
|
||||
foreach (BuildStep *bs, steps) {
|
||||
addBuildStepWidget(-1, bs);
|
||||
}
|
||||
|
||||
m_noStepsLabel = new QLabel(tr("No Build Steps"), this);
|
||||
m_noStepsLabel->setVisible(steps.isEmpty());
|
||||
m_vbox->addWidget(m_noStepsLabel);
|
||||
|
||||
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
||||
@@ -81,8 +76,6 @@ BuildStepsPage::BuildStepsPage(Project *project, bool clean) :
|
||||
|
||||
m_vbox->addLayout(hboxLayout);
|
||||
|
||||
updateBuildStepButtonsState();
|
||||
|
||||
connect(m_addButton->menu(), SIGNAL(aboutToShow()),
|
||||
this, SLOT(updateAddBuildStepMenu()));
|
||||
|
||||
@@ -102,10 +95,14 @@ BuildStepsPage::~BuildStepsPage()
|
||||
void BuildStepsPage::updateSummary()
|
||||
{
|
||||
BuildStepConfigWidget *widget = qobject_cast<BuildStepConfigWidget *>(sender());
|
||||
if (widget)
|
||||
foreach(const BuildStepsWidgetStruct &s, m_buildSteps)
|
||||
if (s.widget == widget)
|
||||
if (widget) {
|
||||
foreach(const BuildStepsWidgetStruct &s, m_buildSteps) {
|
||||
if (s.widget == widget) {
|
||||
s.detailsWidget->setSummaryText(widget->summaryText());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString BuildStepsPage::displayName() const
|
||||
@@ -115,13 +112,30 @@ QString BuildStepsPage::displayName() const
|
||||
|
||||
void BuildStepsPage::init(const QString &buildConfiguration)
|
||||
{
|
||||
foreach(BuildStepsWidgetStruct s, m_buildSteps) {
|
||||
delete s.widget;
|
||||
delete s.detailsWidget;
|
||||
}
|
||||
m_buildSteps.clear();
|
||||
|
||||
m_configuration = buildConfiguration;
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
int i = 0;
|
||||
foreach (BuildStep *bs, steps) {
|
||||
addBuildStepWidget(i, bs);
|
||||
++i;
|
||||
}
|
||||
|
||||
m_noStepsLabel->setVisible(steps.isEmpty());
|
||||
|
||||
// make sure widget is updated
|
||||
foreach(BuildStepsWidgetStruct s, m_buildSteps) {
|
||||
s.widget->init(m_configuration);
|
||||
s.widget->init();
|
||||
s.detailsWidget->setSummaryText(s.widget->summaryText());
|
||||
}
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::updateAddBuildStepMenu()
|
||||
@@ -184,16 +198,8 @@ void BuildStepsPage::addBuildStepWidget(int pos, BuildStep *step)
|
||||
s.hbox->addWidget(s.downButton);
|
||||
s.detailsWidget->setToolWidget(toolWidget);
|
||||
|
||||
if (pos == -1)
|
||||
m_buildSteps.append(s);
|
||||
else
|
||||
m_buildSteps.insert(pos, s);
|
||||
|
||||
if (pos == -1) {
|
||||
m_vbox->addWidget(s.detailsWidget);
|
||||
} else {
|
||||
m_vbox->insertWidget(pos, s.detailsWidget);
|
||||
}
|
||||
m_buildSteps.insert(pos, s);
|
||||
m_vbox->insertWidget(pos, s.detailsWidget);
|
||||
|
||||
connect(s.widget, SIGNAL(updateSummary()),
|
||||
this, SLOT(updateSummary()));
|
||||
@@ -207,14 +213,15 @@ void BuildStepsPage::addBuildStepWidget(int pos, BuildStep *step)
|
||||
void BuildStepsPage::addBuildStep()
|
||||
{
|
||||
if (QAction *action = qobject_cast<QAction *>(sender())) {
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
QPair<QString, IBuildStepFactory *> pair = m_addBuildStepHash.value(action);
|
||||
BuildStep *newStep = pair.second->create(m_pro, pair.first);
|
||||
int pos = m_clean ? m_pro->cleanSteps().count() : m_pro->buildSteps().count();
|
||||
m_clean ? m_pro->insertCleanStep(pos, newStep) : m_pro->insertBuildStep(pos, newStep);
|
||||
BuildStep *newStep = pair.second->create(m_pro, bc, pair.first);
|
||||
int pos = m_clean ? bc->cleanSteps().count() : bc->buildSteps().count();
|
||||
m_clean ? bc->insertCleanStep(pos, newStep) : bc->insertBuildStep(pos, newStep);
|
||||
|
||||
addBuildStepWidget(pos, newStep);
|
||||
const BuildStepsWidgetStruct s = m_buildSteps.at(pos);
|
||||
s.widget->init(m_configuration);
|
||||
s.widget->init();
|
||||
s.detailsWidget->setSummaryText(s.widget->summaryText());
|
||||
}
|
||||
updateBuildStepButtonsState();
|
||||
@@ -224,7 +231,8 @@ void BuildStepsPage::updateRemoveBuildStepMenu()
|
||||
{
|
||||
QMenu *menu = m_removeButton->menu();
|
||||
menu->clear();
|
||||
const QList<BuildStep *> &steps = m_clean ? m_pro->cleanSteps() : m_pro->buildSteps();
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
foreach(BuildStep *step, steps) {
|
||||
QAction *action = menu->addAction(step->displayName());
|
||||
if (step->immutable())
|
||||
@@ -239,7 +247,8 @@ void BuildStepsPage::removeBuildStep()
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
if (action) {
|
||||
int pos = m_removeButton->menu()->actions().indexOf(action);
|
||||
const QList<BuildStep *> &steps = m_clean ? m_pro->cleanSteps() : m_pro->buildSteps();
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
if (steps.at(pos)->immutable())
|
||||
return;
|
||||
|
||||
@@ -247,7 +256,7 @@ void BuildStepsPage::removeBuildStep()
|
||||
delete s.widget;
|
||||
delete s.detailsWidget;
|
||||
m_buildSteps.removeAt(pos);
|
||||
m_clean ? m_pro->removeCleanStep(pos) : m_pro->removeBuildStep(pos);
|
||||
m_clean ? bc->removeCleanStep(pos) : bc->removeBuildStep(pos);
|
||||
}
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
@@ -294,7 +303,8 @@ void BuildStepsPage::downBuildStep()
|
||||
|
||||
void BuildStepsPage::stepMoveUp(int pos)
|
||||
{
|
||||
m_clean ? m_pro->moveCleanStepUp(pos) : m_pro->moveBuildStepUp(pos);
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
m_clean ? bc->moveCleanStepUp(pos) : bc->moveBuildStepUp(pos);
|
||||
|
||||
m_vbox->insertWidget(pos - 1, m_buildSteps.at(pos).detailsWidget);
|
||||
|
||||
@@ -305,7 +315,8 @@ void BuildStepsPage::stepMoveUp(int pos)
|
||||
|
||||
void BuildStepsPage::updateBuildStepButtonsState()
|
||||
{
|
||||
const QList<BuildStep *> &steps = m_clean ? m_pro->cleanSteps() : m_pro->buildSteps();
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
for(int i=0; i<m_buildSteps.count(); ++i) {
|
||||
BuildStepsWidgetStruct s = m_buildSteps.at(i);
|
||||
s.upButton->setEnabled((i>0) && !(steps.at(i)->immutable() && steps.at(i - 1)));
|
||||
|
||||
@@ -244,7 +244,7 @@ void OutputPane::insertLine()
|
||||
void OutputPane::reRunRunControl()
|
||||
{
|
||||
RunControl *rc = runControlForTab(m_tabWidget->currentIndex());
|
||||
rc->start(); //TODO check for rerun
|
||||
rc->start();
|
||||
}
|
||||
|
||||
void OutputPane::stopRunControl()
|
||||
@@ -282,7 +282,7 @@ void OutputPane::tabChanged(int i)
|
||||
} else {
|
||||
RunControl *rc = runControlForTab(i);
|
||||
m_stopAction->setEnabled(rc->isRunning());
|
||||
m_reRunButton->setEnabled(!rc->isRunning()); // Check for rerun?
|
||||
m_reRunButton->setEnabled(!rc->isRunning());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ void OutputPane::runControlFinished()
|
||||
{
|
||||
RunControl *rc = runControlForTab(m_tabWidget->currentIndex());
|
||||
if (rc == qobject_cast<RunControl *>(sender())) {
|
||||
m_reRunButton->setEnabled(rc); // TODO check for rerun?
|
||||
m_reRunButton->setEnabled(rc);
|
||||
m_stopAction->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,22 +45,32 @@ static const char * const PROCESS_WORKINGDIRECTORY = "abstractProcess.workingDir
|
||||
static const char * const PROCESS_ARGUMENTS = "abstractProcess.arguments";
|
||||
static const char * const PROCESS_ENABLED = "abstractProcess.enabled";
|
||||
|
||||
ProcessStep::ProcessStep(Project *pro)
|
||||
: AbstractProcessStep(pro)
|
||||
ProcessStep::ProcessStep(Project *pro, BuildConfiguration *bc)
|
||||
: AbstractProcessStep(pro, bc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool ProcessStep::init(const QString &buildConfigurationName)
|
||||
ProcessStep::ProcessStep(ProcessStep *bs, BuildConfiguration *bc)
|
||||
: AbstractProcessStep(bs, bc)
|
||||
{
|
||||
BuildConfiguration *bc = project()->buildConfiguration(buildConfigurationName);
|
||||
setEnvironment(project()->environment(bc));
|
||||
QString wd = workingDirectory(buildConfigurationName);
|
||||
m_name = bs->m_name;
|
||||
m_command = bs->m_command;
|
||||
m_arguments = bs->m_arguments;
|
||||
m_workingDirectory = bs->m_workingDirectory;
|
||||
m_env = bs->m_env;
|
||||
m_enabled = bs->m_enabled;
|
||||
}
|
||||
|
||||
bool ProcessStep::init()
|
||||
{
|
||||
setEnvironment(project()->environment(buildConfiguration()));
|
||||
QString wd = workingDirectory();
|
||||
if (wd.isEmpty())
|
||||
wd = "$BUILDDIR";
|
||||
|
||||
AbstractProcessStep::setWorkingDirectory(wd.replace("$BUILDDIR", project()->buildDirectory(bc)));
|
||||
return AbstractProcessStep::init(buildConfigurationName);
|
||||
AbstractProcessStep::setWorkingDirectory(wd.replace("$BUILDDIR", project()->buildDirectory(buildConfiguration())));
|
||||
return AbstractProcessStep::init();
|
||||
}
|
||||
|
||||
void ProcessStep::run(QFutureInterface<bool> & fi)
|
||||
@@ -73,37 +83,37 @@ QString ProcessStep::name()
|
||||
return "projectexplorer.processstep";
|
||||
}
|
||||
|
||||
void ProcessStep::restoreFromMap(const QMap<QString, QVariant> &map)
|
||||
void ProcessStep::restoreFromGlobalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
QMap<QString, QVariant>::const_iterator it = map.constFind("ProjectExplorer.ProcessStep.DisplayName");
|
||||
if (it != map.constEnd())
|
||||
m_name = (*it).toString();
|
||||
ProjectExplorer::AbstractProcessStep::restoreFromMap(map);
|
||||
ProjectExplorer::AbstractProcessStep::restoreFromGlobalMap(map);
|
||||
}
|
||||
|
||||
void ProcessStep::storeIntoMap(QMap<QString, QVariant> &map)
|
||||
{
|
||||
map["ProjectExplorer.ProcessStep.DisplayName"] = m_name;
|
||||
ProjectExplorer::AbstractProcessStep::storeIntoMap(map);
|
||||
}
|
||||
|
||||
void ProcessStep::restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map)
|
||||
void ProcessStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
// TODO checking for PROCESS_*
|
||||
setCommand(buildConfiguration, map.value(PROCESS_COMMAND).toString());
|
||||
setWorkingDirectory(buildConfiguration, map.value(PROCESS_WORKINGDIRECTORY).toString());
|
||||
setArguments(buildConfiguration, map.value(PROCESS_ARGUMENTS).toStringList());
|
||||
setEnabled(buildConfiguration, map.value(PROCESS_ENABLED).toBool());
|
||||
ProjectExplorer::AbstractProcessStep::restoreFromMap(buildConfiguration, map);
|
||||
setCommand(map.value(PROCESS_COMMAND).toString());
|
||||
setWorkingDirectory(map.value(PROCESS_WORKINGDIRECTORY).toString());
|
||||
setArguments(map.value(PROCESS_ARGUMENTS).toStringList());
|
||||
setEnabled(map.value(PROCESS_ENABLED).toBool());
|
||||
|
||||
QMap<QString, QVariant>::const_iterator it = map.constFind("ProjectExplorer.ProcessStep.DisplayName");
|
||||
if (it != map.constEnd())
|
||||
m_name = (*it).toString();
|
||||
|
||||
ProjectExplorer::AbstractProcessStep::restoreFromLocalMap(map);
|
||||
}
|
||||
|
||||
void ProcessStep::storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map)
|
||||
void ProcessStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
{
|
||||
map[PROCESS_COMMAND] = command(buildConfiguration);
|
||||
map[PROCESS_WORKINGDIRECTORY] = workingDirectory(buildConfiguration);
|
||||
map[PROCESS_ARGUMENTS] = arguments(buildConfiguration);
|
||||
map[PROCESS_ENABLED] = enabled(buildConfiguration);
|
||||
ProjectExplorer::AbstractProcessStep::storeIntoMap(buildConfiguration, map);
|
||||
map[PROCESS_COMMAND] = command();
|
||||
map[PROCESS_WORKINGDIRECTORY] = workingDirectory();
|
||||
map[PROCESS_ARGUMENTS] = arguments();
|
||||
map[PROCESS_ENABLED] = enabled();
|
||||
map["ProjectExplorer.ProcessStep.DisplayName"] = m_name;
|
||||
ProjectExplorer::AbstractProcessStep::storeIntoLocalMap(map);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +127,7 @@ void ProcessStep::setDisplayName(const QString &name)
|
||||
|
||||
QString ProcessStep::displayName()
|
||||
{
|
||||
if (!m_name.isNull())
|
||||
if (!m_name.isEmpty())
|
||||
return m_name;
|
||||
else
|
||||
return tr("Custom Process Step");
|
||||
@@ -133,81 +143,44 @@ bool ProcessStep::immutable() const
|
||||
return false;
|
||||
}
|
||||
|
||||
QString ProcessStep::command(const QString &buildConfiguration) const
|
||||
QString ProcessStep::command() const
|
||||
{
|
||||
QMap<QString, ProcessStepSettings>::const_iterator it = m_values.constFind(buildConfiguration);
|
||||
QTC_ASSERT(it != m_values.end(), return QString::null);
|
||||
return (*it).command;
|
||||
return m_command;
|
||||
}
|
||||
|
||||
QStringList ProcessStep::arguments(const QString &buildConfiguration) const
|
||||
QStringList ProcessStep::arguments() const
|
||||
{
|
||||
QMap<QString, ProcessStepSettings>::const_iterator it = m_values.constFind(buildConfiguration);
|
||||
QTC_ASSERT(it != m_values.end(), return QStringList());
|
||||
return (*it).arguments;
|
||||
return m_arguments;
|
||||
}
|
||||
|
||||
bool ProcessStep::enabled(const QString &buildConfiguration) const
|
||||
bool ProcessStep::enabled() const
|
||||
{
|
||||
QMap<QString, ProcessStepSettings>::const_iterator it = m_values.constFind(buildConfiguration);
|
||||
QTC_ASSERT(it != m_values.end(), return false);
|
||||
return (*it).enabled;
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
QString ProcessStep::workingDirectory(const QString &buildConfiguration) const
|
||||
QString ProcessStep::workingDirectory() const
|
||||
{
|
||||
QMap<QString, ProcessStepSettings>::const_iterator it = m_values.constFind(buildConfiguration);
|
||||
QTC_ASSERT(it != m_values.end(), return QString::null);
|
||||
return (*it).workingDirectory;
|
||||
return m_workingDirectory;
|
||||
}
|
||||
|
||||
void ProcessStep::setCommand(const QString &buildConfiguration, const QString &command)
|
||||
void ProcessStep::setCommand(const QString &command)
|
||||
{
|
||||
QMap<QString, ProcessStepSettings>::iterator it = m_values.find(buildConfiguration);
|
||||
QTC_ASSERT(it != m_values.end(), return);
|
||||
it->command = command;
|
||||
m_command = command;
|
||||
}
|
||||
|
||||
void ProcessStep::setArguments(const QString &buildConfiguration, const QStringList &arguments)
|
||||
void ProcessStep::setArguments(const QStringList &arguments)
|
||||
{
|
||||
QMap<QString, ProcessStepSettings>::iterator it = m_values.find(buildConfiguration);
|
||||
QTC_ASSERT(it != m_values.end(), return);
|
||||
it->arguments = arguments;
|
||||
m_arguments = arguments;
|
||||
}
|
||||
|
||||
void ProcessStep::setEnabled(const QString &buildConfiguration, bool enabled)
|
||||
void ProcessStep::setEnabled(bool enabled)
|
||||
{
|
||||
QMap<QString, ProcessStepSettings>::iterator it = m_values.find(buildConfiguration);
|
||||
QTC_ASSERT(it != m_values.end(), return);
|
||||
it->enabled = enabled;
|
||||
m_enabled = enabled;
|
||||
}
|
||||
|
||||
void ProcessStep::setWorkingDirectory(const QString &buildConfiguration, const QString &workingDirectory)
|
||||
void ProcessStep::setWorkingDirectory(const QString &workingDirectory)
|
||||
{
|
||||
QMap<QString, ProcessStepSettings>::iterator it = m_values.find(buildConfiguration);
|
||||
QTC_ASSERT(it != m_values.end(), return);
|
||||
it->workingDirectory = workingDirectory;
|
||||
}
|
||||
|
||||
void ProcessStep::addBuildConfiguration(const QString & name)
|
||||
{
|
||||
QMap<QString, ProcessStepSettings>::const_iterator it = m_values.constFind(name);
|
||||
QTC_ASSERT(it == m_values.constEnd(), return);
|
||||
m_values.insert(name, ProcessStepSettings());
|
||||
}
|
||||
|
||||
void ProcessStep::removeBuildConfiguration(const QString & name)
|
||||
{
|
||||
QMap<QString, ProcessStepSettings>::const_iterator it = m_values.constFind(name);
|
||||
QTC_ASSERT(it != m_values.constEnd(), return);
|
||||
m_values.remove(name);
|
||||
}
|
||||
|
||||
void ProcessStep::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||
{
|
||||
QMap<QString, ProcessStepSettings>::const_iterator it = m_values.constFind(source);
|
||||
QTC_ASSERT(it != m_values.constEnd(), return);
|
||||
m_values.insert(dest, *it);
|
||||
m_workingDirectory = workingDirectory;
|
||||
}
|
||||
|
||||
//*******
|
||||
@@ -224,10 +197,15 @@ bool ProcessStepFactory::canCreate(const QString &name) const
|
||||
return name == "projectexplorer.processstep";
|
||||
}
|
||||
|
||||
BuildStep *ProcessStepFactory::create(Project *pro, const QString &name) const
|
||||
BuildStep *ProcessStepFactory::create(Project *pro, BuildConfiguration *bc, const QString &name) const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
return new ProcessStep(pro);
|
||||
return new ProcessStep(pro, bc);
|
||||
}
|
||||
|
||||
BuildStep *ProcessStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
||||
{
|
||||
return new ProcessStep(static_cast<ProcessStep *>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList ProcessStepFactory::canCreateForProject(Project *pro) const
|
||||
@@ -270,9 +248,9 @@ void ProcessStepConfigWidget::updateDetails()
|
||||
displayName = "Custom Process Step";
|
||||
m_summaryText = tr("<b>%1</b> %2 %3 %4")
|
||||
.arg(displayName,
|
||||
m_step->command(m_buildConfiguration),
|
||||
m_step->arguments(m_buildConfiguration).join(" "),
|
||||
m_step->enabled(m_buildConfiguration) ? "" : tr("(disabled)"));
|
||||
m_step->command(),
|
||||
m_step->arguments().join(" "),
|
||||
m_step->enabled() ? "" : tr("(disabled)"));
|
||||
emit updateSummary();
|
||||
}
|
||||
|
||||
@@ -281,20 +259,18 @@ QString ProcessStepConfigWidget::displayName() const
|
||||
return m_step->name();
|
||||
}
|
||||
|
||||
void ProcessStepConfigWidget::init(const QString &buildConfiguration)
|
||||
void ProcessStepConfigWidget::init()
|
||||
{
|
||||
m_buildConfiguration = buildConfiguration;
|
||||
if (buildConfiguration != QString::null) {
|
||||
m_ui.command->setPath(m_step->command(buildConfiguration));
|
||||
m_ui.command->setPath(m_step->command());
|
||||
|
||||
QString workingDirectory = m_step->workingDirectory(buildConfiguration);
|
||||
if (workingDirectory.isEmpty())
|
||||
workingDirectory = "$BUILDDIR";
|
||||
m_ui.workingDirectory->setPath(workingDirectory);
|
||||
QString workingDirectory = m_step->workingDirectory();
|
||||
if (workingDirectory.isEmpty())
|
||||
workingDirectory = "$BUILDDIR";
|
||||
m_ui.workingDirectory->setPath(workingDirectory);
|
||||
|
||||
m_ui.commandArgumentsLineEdit->setText(m_step->arguments().join(" "));
|
||||
m_ui.enabledCheckBox->setChecked(m_step->enabled());
|
||||
|
||||
m_ui.commandArgumentsLineEdit->setText(m_step->arguments(buildConfiguration).join(" "));
|
||||
m_ui.enabledCheckBox->setChecked(m_step->enabled(buildConfiguration));
|
||||
}
|
||||
m_ui.nameLineEdit->setText(m_step->displayName());
|
||||
updateDetails();
|
||||
}
|
||||
@@ -312,24 +288,24 @@ void ProcessStepConfigWidget::nameLineEditTextEdited()
|
||||
|
||||
void ProcessStepConfigWidget::commandLineEditTextEdited()
|
||||
{
|
||||
m_step->setCommand(m_buildConfiguration, m_ui.command->path());
|
||||
m_step->setCommand(m_ui.command->path());
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void ProcessStepConfigWidget::workingDirectoryLineEditTextEdited()
|
||||
{
|
||||
m_step->setWorkingDirectory(m_buildConfiguration, m_ui.workingDirectory->path());
|
||||
m_step->setWorkingDirectory(m_ui.workingDirectory->path());
|
||||
}
|
||||
|
||||
void ProcessStepConfigWidget::commandArgumentsLineEditTextEdited()
|
||||
{
|
||||
m_step->setArguments(m_buildConfiguration, m_ui.commandArgumentsLineEdit->text().split(" ",
|
||||
m_step->setArguments(m_ui.commandArgumentsLineEdit->text().split(" ",
|
||||
QString::SkipEmptyParts));
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void ProcessStepConfigWidget::enabledCheckBoxClicked(bool)
|
||||
{
|
||||
m_step->setEnabled(m_buildConfiguration, m_ui.enabledCheckBox->isChecked());
|
||||
m_step->setEnabled(m_ui.enabledCheckBox->isChecked());
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
@@ -45,26 +45,19 @@ class ProcessStepFactory : public IBuildStepFactory
|
||||
public:
|
||||
ProcessStepFactory();
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual BuildStep *create(Project *pro, const QString &name) const;
|
||||
virtual BuildStep *create(Project *pro, BuildConfiguration *bc, const QString &name) const;
|
||||
virtual BuildStep *clone(BuildStep *bs, BuildConfiguration *bc) const;
|
||||
virtual QStringList canCreateForProject(Project *pro) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
|
||||
struct ProcessStepSettings
|
||||
{
|
||||
QString command;
|
||||
QStringList arguments;
|
||||
QString workingDirectory;
|
||||
Environment env;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
class ProcessStep : public ProjectExplorer::AbstractProcessStep
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProcessStep(Project *pro);
|
||||
virtual bool init(const QString & name);
|
||||
ProcessStep(Project *pro, BuildConfiguration *bc);
|
||||
ProcessStep(ProcessStep *bs, BuildConfiguration *bc);
|
||||
virtual bool init();
|
||||
virtual void run(QFutureInterface<bool> &);
|
||||
|
||||
virtual QString name();
|
||||
@@ -73,29 +66,28 @@ public:
|
||||
virtual BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
|
||||
virtual void restoreFromMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoMap(QMap<QString, QVariant> &map);
|
||||
virtual void restoreFromGlobalMap(const QMap<QString, QVariant> &map);
|
||||
|
||||
virtual void restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map);
|
||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
|
||||
virtual void addBuildConfiguration(const QString & name);
|
||||
virtual void removeBuildConfiguration(const QString & name);
|
||||
virtual void copyBuildConfiguration(const QString &source, const QString &dest);
|
||||
QString command() const;
|
||||
QStringList arguments() const;
|
||||
bool enabled() const;
|
||||
QString workingDirectory() const;
|
||||
|
||||
QString command(const QString &buildConfiguration) const;
|
||||
QStringList arguments(const QString &buildConfiguration) const;
|
||||
bool enabled(const QString &buildConfiguration) const;
|
||||
QString workingDirectory(const QString &buildConfiguration) const;
|
||||
|
||||
void setCommand(const QString &buildConfiguration, const QString &command);
|
||||
void setArguments(const QString &buildConfiguration, const QStringList &arguments);
|
||||
void setEnabled(const QString &buildConfiguration, bool enabled);
|
||||
void setWorkingDirectory(const QString &buildConfiguration, const QString &workingDirectory);
|
||||
void setCommand(const QString &command);
|
||||
void setArguments(const QStringList &arguments);
|
||||
void setEnabled(bool enabled);
|
||||
void setWorkingDirectory(const QString &workingDirectory);
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QMap<QString, ProcessStepSettings> m_values;
|
||||
QString m_command;
|
||||
QStringList m_arguments;
|
||||
QString m_workingDirectory;
|
||||
Environment m_env;
|
||||
bool m_enabled;
|
||||
};
|
||||
|
||||
class ProcessStepConfigWidget : public BuildStepConfigWidget
|
||||
@@ -104,7 +96,7 @@ class ProcessStepConfigWidget : public BuildStepConfigWidget
|
||||
public:
|
||||
ProcessStepConfigWidget(ProcessStep *step);
|
||||
virtual QString displayName() const;
|
||||
virtual void init(const QString &buildConfiguration);
|
||||
virtual void init();
|
||||
virtual QString summaryText() const;
|
||||
private slots:
|
||||
void nameLineEditTextEdited();
|
||||
@@ -114,7 +106,6 @@ private slots:
|
||||
void enabledCheckBoxClicked(bool);
|
||||
private:
|
||||
void updateDetails();
|
||||
QString m_buildConfiguration;
|
||||
ProcessStep *m_step;
|
||||
Ui::ProcessStepWidget m_ui;
|
||||
QString m_summaryText;
|
||||
|
||||
@@ -56,53 +56,11 @@ Project::Project()
|
||||
|
||||
Project::~Project()
|
||||
{
|
||||
qDeleteAll(m_buildSteps);
|
||||
qDeleteAll(m_cleanSteps);
|
||||
qDeleteAll(m_buildConfigurationValues);
|
||||
qDeleteAll(m_runConfigurations);
|
||||
delete m_editorConfiguration;
|
||||
}
|
||||
|
||||
void Project::insertBuildStep(int position, BuildStep *step)
|
||||
{
|
||||
m_buildSteps.insert(position, step);
|
||||
// add all BuildConfigurations
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations())
|
||||
step->addBuildConfiguration(bc->name());
|
||||
}
|
||||
|
||||
void Project::removeBuildStep(int position)
|
||||
{
|
||||
delete m_buildSteps.at(position);
|
||||
m_buildSteps.removeAt(position);
|
||||
}
|
||||
|
||||
void Project::moveBuildStepUp(int position)
|
||||
{
|
||||
BuildStep *bs = m_buildSteps.takeAt(position);
|
||||
m_buildSteps.insert(position - 1, bs);
|
||||
}
|
||||
|
||||
void Project::insertCleanStep(int position, BuildStep *step)
|
||||
{
|
||||
m_cleanSteps.insert(position, step);
|
||||
// add all BuildConfigurations
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations())
|
||||
step->addBuildConfiguration(bc->name());
|
||||
}
|
||||
|
||||
void Project::removeCleanStep(int position)
|
||||
{
|
||||
delete m_cleanSteps.at(position);
|
||||
m_cleanSteps.removeAt(position);
|
||||
}
|
||||
|
||||
void Project::moveCleanStepUp(int position)
|
||||
{
|
||||
BuildStep *bs = m_cleanSteps.takeAt(position);
|
||||
m_cleanSteps.insert(position - 1, bs);
|
||||
}
|
||||
|
||||
QString Project::makeUnique(const QString &preferedName, const QStringList &usedNames)
|
||||
{
|
||||
if (!usedNames.contains(preferedName))
|
||||
@@ -114,7 +72,6 @@ QString Project::makeUnique(const QString &preferedName, const QStringList &used
|
||||
return tryName;
|
||||
}
|
||||
|
||||
|
||||
void Project::addBuildConfiguration(BuildConfiguration *configuration)
|
||||
{
|
||||
QStringList buildConfigurationNames;
|
||||
@@ -137,12 +94,6 @@ void Project::addBuildConfiguration(BuildConfiguration *configuration)
|
||||
// add it
|
||||
m_buildConfigurationValues.push_back(configuration);
|
||||
|
||||
// update build steps
|
||||
for (int i = 0; i != m_buildSteps.size(); ++i)
|
||||
m_buildSteps.at(i)->addBuildConfiguration(configuration->name());
|
||||
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
||||
m_cleanSteps.at(i)->addBuildConfiguration(configuration->name());
|
||||
|
||||
emit addedBuildConfiguration(this, configuration->name());
|
||||
}
|
||||
|
||||
@@ -154,11 +105,6 @@ void Project::removeBuildConfiguration(BuildConfiguration *configuration)
|
||||
|
||||
m_buildConfigurationValues.removeOne(configuration);
|
||||
|
||||
for (int i = 0; i != m_buildSteps.size(); ++i)
|
||||
m_buildSteps.at(i)->removeBuildConfiguration(configuration->name());
|
||||
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
||||
m_cleanSteps.at(i)->removeBuildConfiguration(configuration->name());
|
||||
|
||||
emit removedBuildConfiguration(this, configuration->name());
|
||||
delete configuration;
|
||||
}
|
||||
@@ -171,11 +117,6 @@ void Project::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||
|
||||
m_buildConfigurationValues.push_back(new BuildConfiguration(dest, sourceConfiguration));
|
||||
|
||||
for (int i = 0; i != m_buildSteps.size(); ++i)
|
||||
m_buildSteps.at(i)->copyBuildConfiguration(source, dest);
|
||||
|
||||
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
||||
m_cleanSteps.at(i)->copyBuildConfiguration(source, dest);
|
||||
emit addedBuildConfiguration(this, dest);
|
||||
}
|
||||
|
||||
@@ -189,16 +130,6 @@ bool Project::hasBuildSettings() const
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<BuildStep *> Project::buildSteps() const
|
||||
{
|
||||
return m_buildSteps;
|
||||
}
|
||||
|
||||
QList<BuildStep *> Project::cleanSteps() const
|
||||
{
|
||||
return m_cleanSteps;
|
||||
}
|
||||
|
||||
void Project::saveSettings()
|
||||
{
|
||||
PersistentSettingsWriter writer;
|
||||
@@ -239,54 +170,36 @@ void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
|
||||
writer.saveValue("buildConfiguration-" + bc->name(), temp);
|
||||
buildConfigurationNames << bc->name();
|
||||
}
|
||||
|
||||
QStringList buildStepNames;
|
||||
foreach (BuildStep *buildStep, buildSteps())
|
||||
buildStepNames << buildStep->name();
|
||||
writer.saveValue("buildsteps", buildStepNames);
|
||||
|
||||
QStringList cleanStepNames;
|
||||
foreach (BuildStep *cleanStep, cleanSteps())
|
||||
cleanStepNames << cleanStep->name();
|
||||
writer.saveValue("cleansteps", cleanStepNames);
|
||||
writer.saveValue("buildconfigurations", buildConfigurationNames );
|
||||
|
||||
//save buildstep configuration
|
||||
int buildstepnr = 0;
|
||||
foreach (BuildStep *buildStep, buildSteps()) {
|
||||
QMap<QString, QVariant> buildStepValues;
|
||||
buildStep->storeIntoMap(buildStepValues);
|
||||
writer.saveValue("buildstep" + QString().setNum(buildstepnr), buildStepValues);
|
||||
++buildstepnr;
|
||||
}
|
||||
writer.saveValue("buildconfigurations", buildConfigurationNames);
|
||||
|
||||
// save each buildstep/buildConfiguration combination
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
buildstepnr = 0;
|
||||
foreach (BuildStep *buildStep, buildSteps()) {
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations()) {
|
||||
QStringList buildStepNames;
|
||||
foreach (BuildStep *buildStep, bc->buildSteps())
|
||||
buildStepNames << buildStep->name();
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-buildsteps", buildStepNames);
|
||||
|
||||
int buildstepnr = 0;
|
||||
foreach (BuildStep *buildStep, bc->buildSteps()) {
|
||||
QMap<QString, QVariant> temp;
|
||||
buildStep->storeIntoMap(temp);
|
||||
writer.saveValue("buildconfiguration-" + buildConfigurationName + "-buildstep" + QString().setNum(buildstepnr), temp);
|
||||
buildStep->storeIntoLocalMap(temp);
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-buildstep" + QString().setNum(buildstepnr), temp);
|
||||
++buildstepnr;
|
||||
}
|
||||
}
|
||||
|
||||
//save cleansteps buildconfiguration
|
||||
int cleanstepnr = 0;
|
||||
foreach (BuildStep *cleanStep, cleanSteps()) {
|
||||
QMap<QString, QVariant> buildStepValues;
|
||||
cleanStep->storeIntoMap(buildStepValues);
|
||||
writer.saveValue("cleanstep" + QString().setNum(cleanstepnr), buildStepValues);
|
||||
++cleanstepnr;
|
||||
}
|
||||
|
||||
// save each cleanstep/buildConfiguration combination
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
cleanstepnr = 0;
|
||||
foreach (BuildStep *cleanStep, cleanSteps()) {
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations()) {
|
||||
QStringList cleanStepNames;
|
||||
foreach (BuildStep *cleanStep, bc->cleanSteps())
|
||||
cleanStepNames << cleanStep->name();
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-cleansteps", cleanStepNames);
|
||||
|
||||
int cleanstepnr = 0;
|
||||
foreach (BuildStep *cleanStep, bc->cleanSteps()) {
|
||||
QMap<QString, QVariant> temp;
|
||||
cleanStep->storeIntoMap(temp);
|
||||
writer.saveValue("buildconfiguration-" + buildConfigurationName + "-cleanstep" + QString().setNum(cleanstepnr), temp);
|
||||
cleanStep->storeIntoLocalMap(temp);
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-cleanstep" + QString().setNum(cleanstepnr), temp);
|
||||
++cleanstepnr;
|
||||
}
|
||||
}
|
||||
@@ -314,6 +227,9 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
|
||||
m_values = reader.restoreValue("project").toMap();
|
||||
|
||||
const QList<IBuildStepFactory *> buildStepFactories =
|
||||
ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
|
||||
|
||||
// restoring BuldConfigurations from settings
|
||||
const QStringList buildConfigurationNames = reader.restoreValue("buildconfigurations").toStringList();
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
@@ -322,66 +238,123 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
QMap<QString, QVariant> temp =
|
||||
reader.restoreValue("buildConfiguration-" + buildConfigurationName).toMap();
|
||||
bc->setValuesFromMap(temp);
|
||||
|
||||
// Restore build steps
|
||||
QVariant buildStepsValueVariant = reader.restoreValue("buildconfiguration-" + bc->name() + "-buildsteps");
|
||||
if(buildStepsValueVariant.isValid()) {
|
||||
int pos = 0;
|
||||
QStringList buildStepNames = buildStepsValueVariant.toStringList();
|
||||
for (int buildstepnr = 0; buildstepnr < buildStepNames.size(); ++buildstepnr) {
|
||||
const QString &buildStepName = buildStepNames.at(buildstepnr);
|
||||
BuildStep *buildStep = 0;
|
||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||
if (factory->canCreate(buildStepName)) {
|
||||
buildStep = factory->create(this, bc, buildStepName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Restoring settings
|
||||
if (buildStep) {
|
||||
// TODO remove restoreFromGlobalMap after 2.0
|
||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromGlobalMap(buildStepValues);
|
||||
buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromLocalMap(buildStepValues);
|
||||
bc->insertBuildStep(pos, buildStep);
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore clean steps
|
||||
QVariant cleanStepsValueVariant = reader.restoreValue("buildconfiguration-" + bc->name() + "-cleansteps");
|
||||
if(cleanStepsValueVariant.isValid()) {
|
||||
int pos = 0;
|
||||
QStringList cleanStepNames = cleanStepsValueVariant.toStringList();
|
||||
for (int cleanstepnr = 0; cleanstepnr < cleanStepNames.size(); ++cleanstepnr) {
|
||||
const QString &cleanStepName = cleanStepNames.at(cleanstepnr);
|
||||
BuildStep *cleanStep = 0;
|
||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||
if (factory->canCreate(cleanStepName)) {
|
||||
cleanStep = factory->create(this, bc, cleanStepName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Restoring settings
|
||||
if (cleanStep) {
|
||||
// TODO remove restoreFromGlobalMap after 2.0
|
||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromGlobalMap(buildStepValues);
|
||||
buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromLocalMap(buildStepValues);
|
||||
bc->insertCleanStep(pos, cleanStep);
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const QList<IBuildStepFactory *> buildStepFactories =
|
||||
ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
|
||||
//Build Settings
|
||||
QVariant buildStepsVariant = reader.restoreValue("buildsteps");
|
||||
if (buildStepsVariant.isValid()) {
|
||||
// Old code path for 1.3 compability
|
||||
// restoring BuildSteps from settings
|
||||
int pos = 0;
|
||||
QStringList buildStepNames = buildStepsVariant.toStringList();
|
||||
for (int buildstepnr = 0; buildstepnr < buildStepNames.size(); ++buildstepnr) {
|
||||
const QString &buildStepName = buildStepNames.at(buildstepnr);
|
||||
BuildStep *buildStep = 0;
|
||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||
if (factory->canCreate(buildStepName)) {
|
||||
buildStep = factory->create(this, buildStepName);
|
||||
insertBuildStep(pos, buildStep);
|
||||
++pos;
|
||||
IBuildStepFactory *factory = 0;
|
||||
foreach (IBuildStepFactory *fac, buildStepFactories) {
|
||||
if (fac->canCreate(buildStepName)) {
|
||||
factory = fac;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Restoring settings
|
||||
if (buildStep) {
|
||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromMap(buildStepValues);
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
//get the buildconfiguration for this build step
|
||||
QMap<QString, QVariant> buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromMap(buildStepValues);
|
||||
if (factory) {
|
||||
foreach(BuildConfiguration *bc, buildConfigurations()) {
|
||||
buildStep = factory->create(this, bc, buildStepName);
|
||||
bc->insertBuildStep(pos, buildStep);
|
||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromGlobalMap(buildStepValues);
|
||||
buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromLocalMap(buildStepValues);
|
||||
}
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QVariant cleanStepsVariant = reader.restoreValue("cleansteps");
|
||||
if (cleanStepsVariant.isValid()) {
|
||||
// Old code path for 1.3 compability
|
||||
QStringList cleanStepNames = cleanStepsVariant.toStringList();
|
||||
// restoring BuildSteps from settings
|
||||
int pos = 0;
|
||||
for (int cleanstepnr = 0; cleanstepnr < cleanStepNames.size(); ++cleanstepnr) {
|
||||
const QString &cleanStepName = cleanStepNames.at(cleanstepnr);
|
||||
BuildStep *cleanStep = 0;
|
||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||
if (factory->canCreate(cleanStepName)) {
|
||||
cleanStep = factory->create(this, cleanStepName);
|
||||
insertCleanStep(pos, cleanStep);
|
||||
++pos;
|
||||
IBuildStepFactory *factory = 0;
|
||||
foreach (IBuildStepFactory *fac, buildStepFactories) {
|
||||
if (fac->canCreate(cleanStepName)) {
|
||||
factory = fac;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Restoring settings
|
||||
if (cleanStep) {
|
||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromMap(buildStepValues);
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
|
||||
if (factory) {
|
||||
foreach(BuildConfiguration *bc, buildConfigurations()) {
|
||||
cleanStep = factory->create(this, bc, cleanStepName);
|
||||
bc->insertCleanStep(pos, cleanStep);
|
||||
QMap<QString, QVariant> cleanStepValues = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromGlobalMap(cleanStepValues);
|
||||
QMap<QString, QVariant> buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromMap(buildStepValues);
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromLocalMap(buildStepValues);
|
||||
}
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,17 +83,6 @@ public:
|
||||
|
||||
virtual bool hasBuildSettings() const;
|
||||
|
||||
// Build/Clean Step functions
|
||||
QList<BuildStep *> buildSteps() const;
|
||||
void insertBuildStep(int position, BuildStep *step);
|
||||
void removeBuildStep(int position);
|
||||
void moveBuildStepUp(int position);
|
||||
|
||||
QList<BuildStep *> cleanSteps() const;
|
||||
void insertCleanStep(int position, BuildStep *step);
|
||||
void removeCleanStep(int position);
|
||||
void moveCleanStepUp(int position);
|
||||
|
||||
// Build configuration
|
||||
void addBuildConfiguration(BuildConfiguration *configuration);
|
||||
void removeBuildConfiguration(BuildConfiguration *configuration);
|
||||
@@ -184,8 +173,6 @@ protected:
|
||||
virtual bool restoreSettingsImpl(PersistentSettingsReader &reader);
|
||||
|
||||
private:
|
||||
QList<BuildStep *> m_buildSteps;
|
||||
QList<BuildStep *> m_cleanSteps;
|
||||
QMap<QString, QVariant> m_values;
|
||||
QList<BuildConfiguration *> m_buildConfigurationValues;
|
||||
QString m_activeBuildConfiguration;
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "qmlmakestep.h"
|
||||
#include "qmlprojectconstants.h"
|
||||
#include "qmlproject.h"
|
||||
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtGui/QGroupBox>
|
||||
#include <QtGui/QCheckBox>
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <QtGui/QListWidget>
|
||||
|
||||
using namespace QmlProjectManager;
|
||||
using namespace QmlProjectManager::Internal;
|
||||
|
||||
QmlMakeStep::QmlMakeStep(QmlProject *pro)
|
||||
: AbstractMakeStep(pro), m_pro(pro)
|
||||
{
|
||||
}
|
||||
|
||||
QmlMakeStep::~QmlMakeStep()
|
||||
{
|
||||
}
|
||||
|
||||
bool QmlMakeStep::init(const QString &buildConfiguration)
|
||||
{
|
||||
return AbstractMakeStep::init(buildConfiguration);
|
||||
}
|
||||
|
||||
void QmlMakeStep::run(QFutureInterface<bool> &fi)
|
||||
{
|
||||
m_futureInterface = &fi;
|
||||
m_futureInterface->setProgressRange(0, 100);
|
||||
AbstractMakeStep::run(fi);
|
||||
m_futureInterface->setProgressValue(100);
|
||||
m_futureInterface = 0;
|
||||
}
|
||||
|
||||
QString QmlMakeStep::name()
|
||||
{
|
||||
return Constants::MAKESTEP;
|
||||
}
|
||||
|
||||
QString QmlMakeStep::displayName()
|
||||
{
|
||||
return QLatin1String("QML Make");
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStepConfigWidget *QmlMakeStep::createConfigWidget()
|
||||
{
|
||||
return new QmlMakeStepConfigWidget(this);
|
||||
}
|
||||
|
||||
bool QmlMakeStep::immutable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void QmlMakeStep::stdOut(const QString &line)
|
||||
{
|
||||
AbstractMakeStep::stdOut(line);
|
||||
}
|
||||
|
||||
QmlProject *QmlMakeStep::project() const
|
||||
{
|
||||
return m_pro;
|
||||
}
|
||||
|
||||
bool QmlMakeStep::buildsTarget(const QString &, const QString &) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void QmlMakeStep::setBuildTarget(const QString &, const QString &, bool)
|
||||
{
|
||||
}
|
||||
|
||||
QStringList QmlMakeStep::additionalArguments(const QString &) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
void QmlMakeStep::setAdditionalArguments(const QString &, const QStringList &)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// QmlMakeStepConfigWidget
|
||||
//
|
||||
|
||||
QmlMakeStepConfigWidget::QmlMakeStepConfigWidget(QmlMakeStep *makeStep)
|
||||
: m_makeStep(makeStep)
|
||||
{
|
||||
}
|
||||
|
||||
QString QmlMakeStepConfigWidget::displayName() const
|
||||
{
|
||||
return QLatin1String("QML Make");
|
||||
}
|
||||
|
||||
void QmlMakeStepConfigWidget::init(const QString &)
|
||||
{
|
||||
}
|
||||
|
||||
QString QmlMakeStepConfigWidget::summaryText() const
|
||||
{
|
||||
return tr("<b>QML Make</b>");
|
||||
}
|
||||
|
||||
//
|
||||
// QmlMakeStepFactory
|
||||
//
|
||||
|
||||
bool QmlMakeStepFactory::canCreate(const QString &name) const
|
||||
{
|
||||
return (Constants::MAKESTEP == name);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *QmlMakeStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
|
||||
{
|
||||
Q_ASSERT(name == Constants::MAKESTEP);
|
||||
QmlProject *pro = qobject_cast<QmlProject *>(project);
|
||||
Q_ASSERT(pro);
|
||||
return new QmlMakeStep(pro);
|
||||
}
|
||||
|
||||
QStringList QmlMakeStepFactory::canCreateForProject(ProjectExplorer::Project *) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QString QmlMakeStepFactory::displayNameForName(const QString &) const
|
||||
{
|
||||
return QLatin1String("QML Make");
|
||||
}
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QMLMAKESTEP_H
|
||||
#define QMLMAKESTEP_H
|
||||
|
||||
#include <projectexplorer/abstractmakestep.h>
|
||||
|
||||
namespace QmlProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QmlProject;
|
||||
|
||||
class QmlMakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmlMakeStep(QmlProject *pro);
|
||||
virtual ~QmlMakeStep();
|
||||
|
||||
virtual bool init(const QString &buildConfiguration);
|
||||
virtual void run(QFutureInterface<bool> &fi);
|
||||
|
||||
virtual QString name();
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
|
||||
QmlProject *project() const;
|
||||
|
||||
bool buildsTarget(const QString &buildConfiguration, const QString &target) const;
|
||||
void setBuildTarget(const QString &buildConfiguration, const QString &target, bool on);
|
||||
|
||||
QStringList additionalArguments(const QString &buildConfiguration) const;
|
||||
void setAdditionalArguments(const QString &buildConfiguration, const QStringList &list);
|
||||
|
||||
protected:
|
||||
virtual void stdOut(const QString &line);
|
||||
|
||||
private:
|
||||
QmlProject *m_pro;
|
||||
QFutureInterface<bool> *m_futureInterface;
|
||||
};
|
||||
|
||||
class QmlMakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmlMakeStepConfigWidget(QmlMakeStep *makeStep);
|
||||
|
||||
virtual QString displayName() const;
|
||||
virtual void init(const QString &buildConfiguration);
|
||||
virtual QString summaryText() const;
|
||||
|
||||
private:
|
||||
QmlMakeStep *m_makeStep;
|
||||
};
|
||||
|
||||
class QmlMakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
public:
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const;
|
||||
virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProjectManager
|
||||
|
||||
#endif // MAKESTEP_H
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include "qmlproject.h"
|
||||
#include "qmlprojectconstants.h"
|
||||
#include "qmlmakestep.h"
|
||||
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/persistentsettings.h>
|
||||
@@ -242,15 +241,6 @@ QStringList QmlProject::targets() const
|
||||
return targets;
|
||||
}
|
||||
|
||||
QmlMakeStep *QmlProject::makeStep() const
|
||||
{
|
||||
foreach (ProjectExplorer::BuildStep *bs, buildSteps()) {
|
||||
if (QmlMakeStep *ms = qobject_cast<QmlMakeStep *>(bs))
|
||||
return ms;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool QmlProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader)
|
||||
{
|
||||
Project::restoreSettingsImpl(reader);
|
||||
@@ -260,11 +250,6 @@ bool QmlProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &
|
||||
addRunConfiguration(runConf);
|
||||
}
|
||||
|
||||
if (buildSteps().isEmpty()) {
|
||||
QmlMakeStep *makeStep = new QmlMakeStep(this);
|
||||
insertBuildStep(0, makeStep);
|
||||
}
|
||||
|
||||
refresh(Everything);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@ public:
|
||||
virtual QStringList files(FilesMode fileMode) const;
|
||||
|
||||
QStringList targets() const;
|
||||
QmlMakeStep *makeStep() const;
|
||||
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
enum RefreshOptions {
|
||||
|
||||
@@ -9,18 +9,16 @@ HEADERS = qmlproject.h \
|
||||
qmlprojectnodes.h \
|
||||
qmlprojectwizard.h \
|
||||
qmlnewprojectwizard.h \
|
||||
qmlprojectfileseditor.h \
|
||||
qmltaskmanager.h \
|
||||
qmlmakestep.h
|
||||
qmlprojectfileseditor.h
|
||||
SOURCES = qmlproject.cpp \
|
||||
qmlprojectplugin.cpp \
|
||||
qmlprojectmanager.cpp \
|
||||
qmlprojectnodes.cpp \
|
||||
qmlprojectwizard.cpp \
|
||||
qmlnewprojectwizard.cpp \
|
||||
qmlprojectfileseditor.cpp \
|
||||
qmltaskmanager.cpp \
|
||||
qmlmakestep.cpp
|
||||
qmlprojectfileseditor.cpp
|
||||
RESOURCES += qmlproject.qrc
|
||||
|
||||
OTHER_FILES += QmlProjectManager.pluginspec
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "qmlprojectconstants.h"
|
||||
#include "qmlprojectfileseditor.h"
|
||||
#include "qmlproject.h"
|
||||
#include "qmlmakestep.h"
|
||||
#include "qmltaskmanager.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -89,8 +88,6 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
||||
addAutoReleasedObject(new QmlRunConfigurationFactory);
|
||||
addAutoReleasedObject(new QmlNewProjectWizard);
|
||||
addAutoReleasedObject(new QmlProjectWizard);
|
||||
addAutoReleasedObject(new QmlMakeStepFactory);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,193 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "deployhelper.h"
|
||||
#include "qt4project.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QEventLoop>
|
||||
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
DeployHelperRunStep::DeployHelperRunStep(Qt4Project *pro)
|
||||
: BuildStep(pro), m_started(false), m_pro(pro)
|
||||
{
|
||||
QDir qtCreatorDir = QCoreApplication::applicationDirPath();
|
||||
qtCreatorDir.cdUp();
|
||||
m_binary = QDir::convertSeparators(qtCreatorDir.absolutePath() + QLatin1String("/qtembeddedtools/qemudeployer"));
|
||||
m_id = "id";
|
||||
|
||||
};
|
||||
|
||||
bool DeployHelperRunStep::init(const QString &configuration)
|
||||
{
|
||||
m_qtdir = m_pro->qtDir(m_pro->buildConfiguration(configuration));
|
||||
QFileInfo fi(m_pro->file()->fileName());
|
||||
m_appdir = fi.absolutePath();
|
||||
//find target
|
||||
m_exec = "";
|
||||
QStringList targets = QStringList(); //TODO fix m_pro->qmakeTarget();
|
||||
foreach (const QString &target, targets) {
|
||||
QFileInfo fi(m_appdir + QLatin1Char('/') + target);
|
||||
if (fi.exists())
|
||||
m_exec = target;
|
||||
break;
|
||||
}
|
||||
m_skin = m_pro->value("VNCSkin").toString();
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeployHelperRunStep::run(QFutureInterface<bool> & fi)
|
||||
{
|
||||
if (m_id.isNull() || m_binary.isNull()) {
|
||||
fi.reportResult(false);
|
||||
return;
|
||||
}
|
||||
if (m_started)
|
||||
stop();
|
||||
|
||||
QStringList args;
|
||||
args << "start" << "-id"<<m_id<<"-qtdir"<<m_qtdir<<"-appdir"<<m_appdir<<"-exec"<<m_exec;
|
||||
if (!m_skin.isEmpty())
|
||||
args<<"-skin"<<m_skin;
|
||||
|
||||
for (int i=0; i<m_extraargs.count(); ++i)
|
||||
args.append(m_extraargs.at(i));
|
||||
|
||||
QProcess proc;
|
||||
connect(&proc, SIGNAL(finished (int,QProcess::ExitStatus)),
|
||||
this, SLOT(processFinished()), Qt::DirectConnection);
|
||||
connect(&proc, SIGNAL(readyRead()), this, SLOT(readyRead()), Qt::DirectConnection);
|
||||
|
||||
QStringList env = QProcess::systemEnvironment();
|
||||
env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH="+QApplication::applicationDirPath()+";\\1");
|
||||
proc.setEnvironment(env);
|
||||
proc.setProcessChannelMode(QProcess::MergedChannels);
|
||||
proc.start(m_binary, args);
|
||||
proc.waitForStarted();
|
||||
m_started = true;
|
||||
|
||||
m_eventLoop = new QEventLoop;
|
||||
m_eventLoop->exec();
|
||||
delete m_eventLoop;
|
||||
m_eventLoop = 0;
|
||||
fi.reportResult(true);
|
||||
return;
|
||||
}
|
||||
|
||||
DeployHelperRunStep::~DeployHelperRunStep()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
QString DeployHelperRunStep::binary()
|
||||
{
|
||||
return m_binary;
|
||||
}
|
||||
|
||||
QString DeployHelperRunStep::id()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
bool DeployHelperRunStep::started()
|
||||
{
|
||||
return m_started;
|
||||
}
|
||||
|
||||
void DeployHelperRunStep::processFinished()
|
||||
{
|
||||
m_eventLoop->exit(0);
|
||||
}
|
||||
|
||||
void DeployHelperRunStep::stop()
|
||||
{
|
||||
if (m_id.isNull() || m_binary.isNull() || !m_started)
|
||||
return;
|
||||
|
||||
QStringList env = QProcess::systemEnvironment();
|
||||
env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH="+QApplication::applicationDirPath()+";\\1");
|
||||
|
||||
QStringList args;
|
||||
args<<"stop"<<"-id"<<m_id;
|
||||
QProcess proc;
|
||||
proc.setEnvironment(env);
|
||||
proc.start(m_binary, args);
|
||||
proc.waitForFinished();
|
||||
m_started = false;
|
||||
}
|
||||
|
||||
void DeployHelperRunStep::cleanup()
|
||||
{
|
||||
if (m_id.isNull() || m_binary.isNull() || !m_started)
|
||||
return;
|
||||
|
||||
QStringList env = QProcess::systemEnvironment();
|
||||
env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH="+QApplication::applicationDirPath()+";\\1");
|
||||
|
||||
QStringList args;
|
||||
args<<"cleanup"<<"-id"<<m_id;
|
||||
QProcess proc;
|
||||
proc.setEnvironment(env);
|
||||
proc.start(m_binary, args);
|
||||
proc.waitForFinished();
|
||||
m_started = false;
|
||||
}
|
||||
|
||||
void DeployHelperRunStep::readyRead()
|
||||
{
|
||||
// TODO Unbreak the application output (this whole thing should be moved to a IRunControlFactory)
|
||||
QProcess * proc = qobject_cast<QProcess *>(sender());
|
||||
while (proc->canReadLine()) {
|
||||
QString line = proc->readLine().trimmed();
|
||||
if (line.startsWith("L:") || line.startsWith("A:")) {
|
||||
//emit addToApplicationOutputWindow(line.mid(2));
|
||||
} else {
|
||||
//emit addToApplicationOutputWindow(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString DeployHelperRunStep::name()
|
||||
{
|
||||
return Constants::DEPLOYHELPERRUNSTEP;
|
||||
}
|
||||
|
||||
QString DeployHelperRunStep::displayName()
|
||||
{
|
||||
return "Linux emulator";
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStepConfigWidget * DeployHelperRunStep::configWidget()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef DEPLOYHELPER_H
|
||||
#define DEPLOYHELPER_H
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QEventLoop;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
|
||||
class Qt4Project;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class DeployHelperRunStep : public ProjectExplorer::BuildStep
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DeployHelperRunStep(Qt4Project * pro);
|
||||
~DeployHelperRunStep();
|
||||
|
||||
virtual bool init(const QString &configuration);
|
||||
virtual void run(QFutureInterface<bool> &);
|
||||
|
||||
virtual QString name();
|
||||
virtual QString displayName();
|
||||
|
||||
virtual QString binary();
|
||||
virtual QString id();
|
||||
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *configWidget();
|
||||
|
||||
private:
|
||||
bool started();
|
||||
|
||||
void stop();
|
||||
void cleanup();
|
||||
|
||||
private slots:
|
||||
void readyRead();
|
||||
void processFinished();
|
||||
|
||||
private:
|
||||
QString m_qtdir;
|
||||
QString m_appdir;
|
||||
QString m_exec;
|
||||
QString m_skin;
|
||||
QString m_binary;
|
||||
QStringList m_extraargs;
|
||||
QString m_id;
|
||||
bool m_started;
|
||||
Qt4Project *m_pro;
|
||||
QEventLoop *m_eventLoop;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
#endif // DEPLOYHELPER_H
|
||||
@@ -44,8 +44,17 @@ using ExtensionSystem::PluginManager;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
MakeStep::MakeStep(Qt4Project * project)
|
||||
: AbstractMakeStep(project), m_clean(false)
|
||||
MakeStep::MakeStep(Qt4Project * project, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(project, bc), m_clean(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MakeStep::MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bs, bc),
|
||||
m_clean(bs->m_clean),
|
||||
m_makeargs(bs->m_makeargs),
|
||||
m_makeCmd(bs->m_makeCmd)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -60,54 +69,34 @@ void MakeStep::setClean(bool clean)
|
||||
m_clean = clean;
|
||||
}
|
||||
|
||||
void MakeStep::restoreFromMap(const QMap<QString, QVariant> &map)
|
||||
void MakeStep::restoreFromGlobalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
if (map.value("clean").isValid() && map.value("clean").toBool())
|
||||
m_clean = true;
|
||||
ProjectExplorer::AbstractMakeStep::restoreFromMap(map);
|
||||
ProjectExplorer::AbstractMakeStep::restoreFromGlobalMap(map);
|
||||
}
|
||||
|
||||
void MakeStep::storeIntoMap(QMap<QString, QVariant> &map)
|
||||
void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
m_makeargs = map.value("makeargs").toStringList();
|
||||
m_makeCmd = map.value("makeCmd").toString();
|
||||
if (map.value("clean").isValid() && map.value("clean").toBool())
|
||||
m_clean = true;
|
||||
ProjectExplorer::AbstractMakeStep::restoreFromLocalMap(map);
|
||||
}
|
||||
|
||||
void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
{
|
||||
map["makeargs"] = m_makeargs;
|
||||
map["makeCmd"] = m_makeCmd;
|
||||
if (m_clean)
|
||||
map["clean"] = true;
|
||||
ProjectExplorer::AbstractMakeStep::storeIntoMap(map);
|
||||
ProjectExplorer::AbstractMakeStep::storeIntoLocalMap(map);
|
||||
}
|
||||
|
||||
void MakeStep::restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map)
|
||||
bool MakeStep::init()
|
||||
{
|
||||
m_values[buildConfiguration].makeargs = map.value("makeargs").toStringList();
|
||||
m_values[buildConfiguration].makeCmd = map.value("makeCmd").toString();
|
||||
ProjectExplorer::AbstractMakeStep::restoreFromMap(buildConfiguration, map);
|
||||
}
|
||||
|
||||
void MakeStep::storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map)
|
||||
{
|
||||
map["makeargs"] = m_values.value(buildConfiguration).makeargs;
|
||||
map["makeCmd"] = m_values.value(buildConfiguration).makeCmd;
|
||||
ProjectExplorer::AbstractMakeStep::storeIntoMap(buildConfiguration, map);
|
||||
}
|
||||
|
||||
void MakeStep::addBuildConfiguration(const QString & name)
|
||||
{
|
||||
m_values.insert(name, MakeStepSettings());
|
||||
}
|
||||
|
||||
void MakeStep::removeBuildConfiguration(const QString & name)
|
||||
{
|
||||
m_values.remove(name);
|
||||
}
|
||||
|
||||
void MakeStep::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||
{
|
||||
m_values.insert(dest, m_values.value(source));
|
||||
}
|
||||
|
||||
|
||||
bool MakeStep::init(const QString &name)
|
||||
{
|
||||
m_buildConfiguration = name;
|
||||
ProjectExplorer::BuildConfiguration *bc = project()->buildConfiguration(name);
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
Environment environment = project()->environment(bc);
|
||||
setEnvironment(environment);
|
||||
|
||||
@@ -116,8 +105,8 @@ bool MakeStep::init(const QString &name)
|
||||
setWorkingDirectory(workingDirectory);
|
||||
|
||||
QString makeCmd = qt4project->makeCommand(bc);
|
||||
if (!m_values.value(name).makeCmd.isEmpty())
|
||||
makeCmd = m_values.value(name).makeCmd;
|
||||
if (!m_makeCmd.isEmpty())
|
||||
makeCmd = m_makeCmd;
|
||||
if (!QFileInfo(makeCmd).isAbsolute()) {
|
||||
// Try to detect command in environment
|
||||
QString tmp = environment.searchInPath(makeCmd);
|
||||
@@ -134,7 +123,7 @@ bool MakeStep::init(const QString &name)
|
||||
// we should stop the clean queue
|
||||
// That is mostly so that rebuild works on a alrady clean project
|
||||
setIgnoreReturnValue(m_clean);
|
||||
QStringList args = m_values.value(name).makeargs;
|
||||
QStringList args = m_makeargs;
|
||||
if (!m_clean) {
|
||||
if (!qt4project->defaultMakeTarget(bc).isEmpty())
|
||||
args << qt4project->defaultMakeTarget(bc);
|
||||
@@ -150,7 +139,7 @@ bool MakeStep::init(const QString &name)
|
||||
if (toolchain)
|
||||
type = toolchain->type();
|
||||
if (type != ProjectExplorer::ToolChain::MSVC && type != ProjectExplorer::ToolChain::WINCE) {
|
||||
if (m_values.value(name).makeCmd.isEmpty())
|
||||
if (m_makeCmd.isEmpty())
|
||||
args << "-w";
|
||||
}
|
||||
|
||||
@@ -169,7 +158,7 @@ bool MakeStep::init(const QString &name)
|
||||
else
|
||||
setBuildParser(ProjectExplorer::Constants::BUILD_PARSER_GCC);
|
||||
|
||||
return AbstractMakeStep::init(name);
|
||||
return AbstractMakeStep::init();
|
||||
}
|
||||
|
||||
void MakeStep::run(QFutureInterface<bool> & fi)
|
||||
@@ -202,14 +191,14 @@ ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget()
|
||||
return new MakeStepConfigWidget(this);
|
||||
}
|
||||
|
||||
QStringList MakeStep::makeArguments(const QString &buildConfiguration)
|
||||
QStringList MakeStep::makeArguments()
|
||||
{
|
||||
return m_values.value(buildConfiguration).makeargs;
|
||||
return m_makeargs;
|
||||
}
|
||||
|
||||
void MakeStep::setMakeArguments(const QString &buildConfiguration, const QStringList &arguments)
|
||||
void MakeStep::setMakeArguments(const QStringList &arguments)
|
||||
{
|
||||
m_values[buildConfiguration].makeargs = arguments;
|
||||
m_makeargs = arguments;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
@@ -237,18 +226,18 @@ void MakeStepConfigWidget::updateMakeOverrideLabel()
|
||||
{
|
||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(m_makeStep->project());
|
||||
m_ui.makeLabel->setText(tr("Override %1:").arg(qt4project->
|
||||
makeCommand(qt4project->buildConfiguration(m_buildConfiguration))));
|
||||
makeCommand(m_makeStep->buildConfiguration())));
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::updateDetails()
|
||||
{
|
||||
Qt4Project *pro = static_cast<Qt4Project *>(m_makeStep->project());
|
||||
ProjectExplorer::BuildConfiguration *bc = pro->buildConfiguration(m_buildConfiguration);
|
||||
ProjectExplorer::BuildConfiguration *bc = m_makeStep->buildConfiguration();
|
||||
QString workingDirectory = pro->buildDirectory(bc);
|
||||
|
||||
QString makeCmd = pro->makeCommand(bc);
|
||||
if (!m_makeStep->m_values.value(m_buildConfiguration).makeCmd.isEmpty())
|
||||
makeCmd = m_makeStep->m_values.value(m_buildConfiguration).makeCmd;
|
||||
if (!m_makeStep->m_makeCmd.isEmpty())
|
||||
makeCmd = m_makeStep->m_makeCmd;
|
||||
if (!QFileInfo(makeCmd).isAbsolute()) {
|
||||
Environment environment = pro->environment(bc);
|
||||
// Try to detect command in environment
|
||||
@@ -265,13 +254,13 @@ void MakeStepConfigWidget::updateDetails()
|
||||
// FIXME doing this without the user having a way to override this is rather bad
|
||||
// so we only do it for unix and if the user didn't override the make command
|
||||
// but for now this is the least invasive change
|
||||
QStringList args = m_makeStep->makeArguments(m_buildConfiguration);
|
||||
QStringList args = m_makeStep->makeArguments();
|
||||
ProjectExplorer::ToolChain::ToolChainType t = ProjectExplorer::ToolChain::UNKNOWN;
|
||||
ProjectExplorer::ToolChain *toolChain = pro->toolChain(bc);
|
||||
if (toolChain)
|
||||
t = toolChain->type();
|
||||
if (t != ProjectExplorer::ToolChain::MSVC && t != ProjectExplorer::ToolChain::WINCE) {
|
||||
if (m_makeStep->m_values.value(m_buildConfiguration).makeCmd.isEmpty())
|
||||
if (m_makeStep->m_makeCmd.isEmpty())
|
||||
args << "-w";
|
||||
}
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2 in %3").arg(QFileInfo(makeCmd).fileName(), args.join(" "),
|
||||
@@ -291,35 +280,31 @@ QString MakeStepConfigWidget::displayName() const
|
||||
|
||||
void MakeStepConfigWidget::update()
|
||||
{
|
||||
init(m_buildConfiguration);
|
||||
init();
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::init(const QString &buildConfiguration)
|
||||
void MakeStepConfigWidget::init()
|
||||
{
|
||||
m_buildConfiguration = buildConfiguration;
|
||||
|
||||
updateMakeOverrideLabel();
|
||||
|
||||
const QString &makeCmd = m_makeStep->m_values.value(buildConfiguration).makeCmd;
|
||||
const QString &makeCmd = m_makeStep->m_makeCmd;
|
||||
m_ui.makeLineEdit->setText(makeCmd);
|
||||
|
||||
const QStringList &makeArguments = m_makeStep->makeArguments(buildConfiguration);
|
||||
const QStringList &makeArguments = m_makeStep->makeArguments();
|
||||
m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::makeLineEditTextEdited()
|
||||
{
|
||||
Q_ASSERT(!m_buildConfiguration.isNull());
|
||||
m_makeStep->m_values[m_buildConfiguration].makeCmd = m_ui.makeLineEdit->text();
|
||||
m_makeStep->m_makeCmd = m_ui.makeLineEdit->text();
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::makeArgumentsLineEditTextEdited()
|
||||
{
|
||||
Q_ASSERT(!m_buildConfiguration.isNull());
|
||||
m_makeStep->setMakeArguments(m_buildConfiguration,
|
||||
ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text()));
|
||||
m_makeStep->setMakeArguments(
|
||||
ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text()));
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
@@ -340,10 +325,15 @@ bool MakeStepFactory::canCreate(const QString & name) const
|
||||
return (name == Constants::MAKESTEP);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep * MakeStepFactory::create(ProjectExplorer::Project * pro, const QString & name) const
|
||||
ProjectExplorer::BuildStep *MakeStepFactory::create(ProjectExplorer::Project *pro, ProjectExplorer::BuildConfiguration *bc, const QString & name) const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
return new MakeStep(static_cast<Qt4Project *>(pro));
|
||||
return new MakeStep(static_cast<Qt4Project *>(pro), bc);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *MakeStepFactory::clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const
|
||||
{
|
||||
return new MakeStep(static_cast<MakeStep *>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList MakeStepFactory::canCreateForProject(ProjectExplorer::Project *pro) const
|
||||
|
||||
@@ -52,7 +52,8 @@ public:
|
||||
MakeStepFactory();
|
||||
virtual ~MakeStepFactory();
|
||||
bool canCreate(const QString & name) const;
|
||||
ProjectExplorer::BuildStep * create(ProjectExplorer::Project * pro, const QString & name) const;
|
||||
ProjectExplorer::BuildStep *create(ProjectExplorer::Project * pro, ProjectExplorer::BuildConfiguration *bc, const QString & name) const;
|
||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
|
||||
QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
@@ -60,46 +61,37 @@ public:
|
||||
|
||||
class Qt4Project;
|
||||
|
||||
struct MakeStepSettings
|
||||
{
|
||||
QStringList makeargs;
|
||||
QString makeCmd;
|
||||
};
|
||||
|
||||
class MakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class MakeStepConfigWidget; // TODO remove this
|
||||
// currently used to access m_values
|
||||
// used to access internal stuff
|
||||
public:
|
||||
MakeStep(Qt4Project * project);
|
||||
MakeStep(Qt4Project * project, ProjectExplorer::BuildConfiguration *bc);
|
||||
MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||
~MakeStep();
|
||||
virtual bool init(const QString & name);
|
||||
virtual bool init();
|
||||
virtual void run(QFutureInterface<bool> &);
|
||||
virtual QString name();
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
QStringList makeArguments(const QString &buildConfiguration);
|
||||
void setMakeArguments(const QString &buildConfiguration, const QStringList &arguments);
|
||||
QStringList makeArguments();
|
||||
void setMakeArguments(const QStringList &arguments);
|
||||
|
||||
virtual void restoreFromMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoMap(QMap<QString, QVariant> &map);
|
||||
virtual void restoreFromGlobalMap(const QMap<QString, QVariant> &map);
|
||||
|
||||
void setClean(bool clean);
|
||||
|
||||
virtual void restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map);
|
||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
|
||||
virtual void addBuildConfiguration(const QString & name);
|
||||
virtual void removeBuildConfiguration(const QString & name);
|
||||
virtual void copyBuildConfiguration(const QString &source, const QString &dest);
|
||||
signals:
|
||||
void changed();
|
||||
private:
|
||||
QString m_buildConfiguration;
|
||||
bool m_clean;
|
||||
QMap<QString, MakeStepSettings> m_values;
|
||||
QStringList m_makeargs;
|
||||
QString m_makeCmd;
|
||||
};
|
||||
|
||||
class MakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
@@ -108,7 +100,7 @@ class MakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
public:
|
||||
MakeStepConfigWidget(MakeStep *makeStep);
|
||||
QString displayName() const;
|
||||
void init(const QString &buildConfiguration);
|
||||
void init();
|
||||
QString summaryText() const;
|
||||
private slots:
|
||||
void makeLineEditTextEdited();
|
||||
@@ -117,7 +109,6 @@ private slots:
|
||||
void updateMakeOverrideLabel();
|
||||
void updateDetails();
|
||||
private:
|
||||
QString m_buildConfiguration;
|
||||
Ui::MakeStep m_ui;
|
||||
MakeStep *m_makeStep;
|
||||
QString m_summaryText;
|
||||
|
||||
@@ -49,19 +49,28 @@ using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
QMakeStep::QMakeStep(Qt4Project *project)
|
||||
: AbstractMakeStep(project), m_pro(project), m_forced(false)
|
||||
QMakeStep::QMakeStep(Qt4Project *project, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(project, bc), m_pro(project), m_forced(false)
|
||||
{
|
||||
}
|
||||
|
||||
QMakeStep::QMakeStep(QMakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bs, bc),
|
||||
m_pro(bs->m_pro),
|
||||
m_forced(false),
|
||||
m_qmakeArgs(bs->m_qmakeArgs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QMakeStep::~QMakeStep()
|
||||
{
|
||||
}
|
||||
|
||||
QStringList QMakeStep::arguments(const QString &buildConfiguration)
|
||||
QStringList QMakeStep::arguments()
|
||||
{
|
||||
QStringList additonalArguments = m_values.value(buildConfiguration).qmakeArgs;
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(buildConfiguration);
|
||||
QStringList additonalArguments = m_qmakeArgs;
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
QStringList arguments;
|
||||
arguments << project()->file()->fileName();
|
||||
arguments << "-r";
|
||||
@@ -99,13 +108,11 @@ QStringList QMakeStep::arguments(const QString &buildConfiguration)
|
||||
return arguments;
|
||||
}
|
||||
|
||||
bool QMakeStep::init(const QString &name)
|
||||
bool QMakeStep::init()
|
||||
{
|
||||
m_buildConfiguration = name;
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(name);
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
const QtVersion *qtVersion = m_pro->qtVersion(bc);
|
||||
|
||||
|
||||
if (!qtVersion->isValid()) {
|
||||
#if defined(Q_WS_MAC)
|
||||
emit addToOutputWindow(tr("\n<font color=\"#ff0000\"><b>No valid Qt version set. Set one in Preferences </b></font>\n"));
|
||||
@@ -115,7 +122,7 @@ bool QMakeStep::init(const QString &name)
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList args = arguments(name);
|
||||
QStringList args = arguments();
|
||||
QString workingDirectory = m_pro->buildDirectory(bc);
|
||||
|
||||
QString program = qtVersion->qmakeCommand();
|
||||
@@ -141,7 +148,7 @@ bool QMakeStep::init(const QString &name)
|
||||
setEnvironment(m_pro->environment(bc));
|
||||
|
||||
setBuildParser(ProjectExplorer::Constants::BUILD_PARSER_QMAKE);
|
||||
return AbstractMakeStep::init(name);
|
||||
return AbstractMakeStep::init();
|
||||
}
|
||||
|
||||
void QMakeStep::run(QFutureInterface<bool> &fi)
|
||||
@@ -203,42 +210,27 @@ bool QMakeStep::processFinished(int exitCode, QProcess::ExitStatus status)
|
||||
return result;
|
||||
}
|
||||
|
||||
void QMakeStep::setQMakeArguments(const QString &buildConfiguration, const QStringList &arguments)
|
||||
void QMakeStep::setQMakeArguments(const QStringList &arguments)
|
||||
{
|
||||
m_values[buildConfiguration].qmakeArgs = arguments;
|
||||
m_qmakeArgs = arguments;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
QStringList QMakeStep::qmakeArguments(const QString &buildConfiguration)
|
||||
QStringList QMakeStep::qmakeArguments()
|
||||
{
|
||||
return m_values[buildConfiguration].qmakeArgs;
|
||||
return m_qmakeArgs;
|
||||
}
|
||||
|
||||
void QMakeStep::restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map)
|
||||
void QMakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
m_values[buildConfiguration].qmakeArgs = map.value("qmakeArgs").toStringList();
|
||||
AbstractProcessStep::restoreFromMap(buildConfiguration, map);
|
||||
m_qmakeArgs = map.value("qmakeArgs").toStringList();
|
||||
AbstractProcessStep::restoreFromLocalMap(map);
|
||||
}
|
||||
|
||||
void QMakeStep::storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map)
|
||||
void QMakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
{
|
||||
map["qmakeArgs"] = m_values.value(buildConfiguration).qmakeArgs;
|
||||
AbstractProcessStep::storeIntoMap(buildConfiguration, map);
|
||||
}
|
||||
|
||||
void QMakeStep::addBuildConfiguration(const QString & name)
|
||||
{
|
||||
m_values.insert(name, QMakeStepSettings());
|
||||
}
|
||||
|
||||
void QMakeStep::removeBuildConfiguration(const QString & name)
|
||||
{
|
||||
m_values.remove(name);
|
||||
}
|
||||
|
||||
void QMakeStep::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||
{
|
||||
m_values.insert(dest, m_values.value(source));
|
||||
map["qmakeArgs"] = m_qmakeArgs;
|
||||
AbstractProcessStep::storeIntoLocalMap(map);
|
||||
}
|
||||
|
||||
QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
|
||||
@@ -261,7 +253,7 @@ QString QMakeStepConfigWidget::summaryText() const
|
||||
|
||||
void QMakeStepConfigWidget::qtVersionChanged(ProjectExplorer::BuildConfiguration *bc)
|
||||
{
|
||||
if (bc && bc->name() == m_buildConfiguration) {
|
||||
if (bc == m_step->buildConfiguration()) {
|
||||
updateTitleLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
}
|
||||
@@ -270,14 +262,14 @@ void QMakeStepConfigWidget::qtVersionChanged(ProjectExplorer::BuildConfiguration
|
||||
void QMakeStepConfigWidget::updateTitleLabel()
|
||||
{
|
||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(m_step->project());
|
||||
const QtVersion *qtVersion = qt4project->qtVersion(qt4project->buildConfiguration(m_buildConfiguration));
|
||||
const QtVersion *qtVersion = qt4project->qtVersion(m_step->buildConfiguration());
|
||||
if (!qtVersion) {
|
||||
m_summaryText = tr("<b>QMake:</b> No Qt version set. QMake can not be run.");
|
||||
emit updateSummary();
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList args = m_step->arguments(m_buildConfiguration);
|
||||
QStringList args = m_step->arguments();
|
||||
// We don't want the full path to the .pro file
|
||||
int index = args.indexOf(m_step->project()->file()->fileName());
|
||||
if (index != -1)
|
||||
@@ -292,8 +284,7 @@ void QMakeStepConfigWidget::updateTitleLabel()
|
||||
|
||||
void QMakeStepConfigWidget::qmakeArgumentsLineEditTextEdited()
|
||||
{
|
||||
Q_ASSERT(!m_buildConfiguration.isNull());
|
||||
m_step->setQMakeArguments(m_buildConfiguration,
|
||||
m_step->setQMakeArguments(
|
||||
ProjectExplorer::Environment::parseCombinedArgString(m_ui.qmakeAdditonalArgumentsLineEdit->text()));
|
||||
|
||||
static_cast<Qt4Project *>(m_step->project())->invalidateCachedTargetInformation();
|
||||
@@ -303,7 +294,7 @@ void QMakeStepConfigWidget::qmakeArgumentsLineEditTextEdited()
|
||||
|
||||
void QMakeStepConfigWidget::buildConfigurationChanged()
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = m_step->project()->buildConfiguration(m_buildConfiguration);
|
||||
ProjectExplorer::BuildConfiguration *bc = m_step->buildConfiguration();
|
||||
QtVersion::QmakeBuildConfigs buildConfiguration = QtVersion::QmakeBuildConfig(bc->value("buildConfiguration").toInt());
|
||||
if (m_ui.buildConfigurationComboBox->currentIndex() == 0) {
|
||||
// debug
|
||||
@@ -327,15 +318,14 @@ QString QMakeStepConfigWidget::displayName() const
|
||||
|
||||
void QMakeStepConfigWidget::update()
|
||||
{
|
||||
init(m_buildConfiguration);
|
||||
init();
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::init(const QString &buildConfiguration)
|
||||
void QMakeStepConfigWidget::init()
|
||||
{
|
||||
m_buildConfiguration = buildConfiguration;
|
||||
QString qmakeArgs = ProjectExplorer::Environment::joinArgumentList(m_step->qmakeArguments(buildConfiguration));
|
||||
QString qmakeArgs = ProjectExplorer::Environment::joinArgumentList(m_step->qmakeArguments());
|
||||
m_ui.qmakeAdditonalArgumentsLineEdit->setText(qmakeArgs);
|
||||
ProjectExplorer::BuildConfiguration *bc = m_step->project()->buildConfiguration(buildConfiguration);
|
||||
ProjectExplorer::BuildConfiguration *bc = m_step->buildConfiguration();
|
||||
bool debug = QtVersion::QmakeBuildConfig(bc->value("buildConfiguration").toInt()) & QtVersion::DebugBuild;
|
||||
m_ui.buildConfigurationComboBox->setCurrentIndex(debug? 0 : 1);
|
||||
updateTitleLabel();
|
||||
@@ -345,10 +335,10 @@ void QMakeStepConfigWidget::init(const QString &buildConfiguration)
|
||||
void QMakeStepConfigWidget::updateEffectiveQMakeCall()
|
||||
{
|
||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(m_step->project());
|
||||
const QtVersion *qtVersion = qt4project->qtVersion(qt4project->buildConfiguration(m_buildConfiguration));
|
||||
const QtVersion *qtVersion = qt4project->qtVersion(m_step->buildConfiguration());
|
||||
if (qtVersion) {
|
||||
QString program = QFileInfo(qtVersion->qmakeCommand()).fileName();
|
||||
m_ui.qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + ProjectExplorer::Environment::joinArgumentList(m_step->arguments(m_buildConfiguration)));
|
||||
m_ui.qmakeArgumentsEdit->setPlainText(program + QLatin1Char(' ') + ProjectExplorer::Environment::joinArgumentList(m_step->arguments()));
|
||||
} else {
|
||||
m_ui.qmakeArgumentsEdit->setPlainText(tr("No valid Qt version set."));
|
||||
}
|
||||
@@ -371,18 +361,20 @@ bool QMakeStepFactory::canCreate(const QString & name) const
|
||||
return (name == Constants::QMAKESTEP);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep * QMakeStepFactory::create(ProjectExplorer::Project * pro, const QString & name) const
|
||||
ProjectExplorer::BuildStep *QMakeStepFactory::create(ProjectExplorer::Project * pro, BuildConfiguration *bc, const QString & name) const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
return new QMakeStep(static_cast<Qt4Project *>(pro));
|
||||
return new QMakeStep(static_cast<Qt4Project *>(pro), bc);
|
||||
}
|
||||
|
||||
QStringList QMakeStepFactory::canCreateForProject(ProjectExplorer::Project *pro) const
|
||||
ProjectExplorer::BuildStep *QMakeStepFactory::clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const
|
||||
{
|
||||
Qt4Project *project = qobject_cast<Qt4Project *>(pro);
|
||||
if (project && !project->qmakeStep())
|
||||
return QStringList() << Constants::QMAKESTEP;
|
||||
return QStringList();
|
||||
return new QMakeStep(static_cast<QMakeStep *>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList QMakeStepFactory::canCreateForProject(ProjectExplorer::Project *) const
|
||||
{
|
||||
return QStringList() << Constants::QMAKESTEP;
|
||||
}
|
||||
|
||||
QString QMakeStepFactory::displayNameForName(const QString &name) const
|
||||
|
||||
@@ -52,7 +52,8 @@ public:
|
||||
QMakeStepFactory();
|
||||
virtual ~QMakeStepFactory();
|
||||
bool canCreate(const QString & name) const;
|
||||
ProjectExplorer::BuildStep * create(ProjectExplorer::Project * pro, const QString & name) const;
|
||||
ProjectExplorer::BuildStep *create(ProjectExplorer::Project * pro, ProjectExplorer::BuildConfiguration *bc, const QString & name) const;
|
||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
|
||||
QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
@@ -60,10 +61,6 @@ public:
|
||||
|
||||
class Qt4Project;
|
||||
|
||||
struct QMakeStepSettings
|
||||
{
|
||||
QStringList qmakeArgs;
|
||||
};
|
||||
|
||||
class QMakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
{
|
||||
@@ -71,27 +68,25 @@ class QMakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
friend class Qt4Project; // TODO remove
|
||||
// Currently used to access qmakeArgs
|
||||
public:
|
||||
QMakeStep(Qt4Project * project);
|
||||
QMakeStep(Qt4Project * project, ProjectExplorer::BuildConfiguration *bc);
|
||||
QMakeStep(QMakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||
~QMakeStep();
|
||||
virtual bool init(const QString &name);
|
||||
virtual bool init();
|
||||
virtual void run(QFutureInterface<bool> &);
|
||||
virtual QString name();
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
QStringList arguments(const QString &buildConfiguration);
|
||||
QStringList arguments();
|
||||
void setForced(bool b);
|
||||
bool forced();
|
||||
|
||||
QStringList qmakeArguments(const QString &buildConfiguration);
|
||||
void setQMakeArguments(const QString &buildConfiguraion, const QStringList &arguments);
|
||||
QStringList qmakeArguments();
|
||||
void setQMakeArguments(const QStringList &arguments);
|
||||
|
||||
virtual void restoreFromMap(const QString &buildConfiguration, const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoMap(const QString &buildConfiguration, QMap<QString, QVariant> &map);
|
||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
|
||||
virtual void addBuildConfiguration(const QString & name);
|
||||
virtual void removeBuildConfiguration(const QString & name);
|
||||
virtual void copyBuildConfiguration(const QString &source, const QString &dest);
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
@@ -102,11 +97,10 @@ protected:
|
||||
private:
|
||||
Qt4Project *m_pro;
|
||||
// last values
|
||||
QString m_buildConfiguration;
|
||||
QStringList m_lastEnv;
|
||||
bool m_forced;
|
||||
bool m_needToRunQMake; // set in init(), read in run()
|
||||
QMap<QString, QMakeStepSettings> m_values;
|
||||
QStringList m_qmakeArgs;
|
||||
};
|
||||
|
||||
|
||||
@@ -116,7 +110,7 @@ class QMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
public:
|
||||
QMakeStepConfigWidget(QMakeStep *step);
|
||||
QString displayName() const;
|
||||
void init(const QString &buildConfiguration);
|
||||
void init();
|
||||
QString summaryText() const;
|
||||
private slots:
|
||||
void qmakeArgumentsLineEditTextEdited();
|
||||
@@ -126,7 +120,6 @@ private slots:
|
||||
private:
|
||||
void updateTitleLabel();
|
||||
void updateEffectiveQMakeCall();
|
||||
QString m_buildConfiguration;
|
||||
Ui::QMakeStep m_ui;
|
||||
QMakeStep *m_step;
|
||||
QString m_summaryText;
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "prowriter.h"
|
||||
#include "makestep.h"
|
||||
#include "qmakestep.h"
|
||||
#include "deployhelper.h"
|
||||
#include "qt4runconfiguration.h"
|
||||
#include "qt4nodes.h"
|
||||
#include "qt4projectconfigwidget.h"
|
||||
@@ -441,21 +440,27 @@ void Qt4Project::addQt4BuildConfiguration(QString buildConfigurationName, QtVers
|
||||
QtVersion::QmakeBuildConfigs qmakeBuildConfiguration,
|
||||
QStringList additionalArguments)
|
||||
{
|
||||
QMakeStep *qmake = qmakeStep();
|
||||
MakeStep *make = makeStep();
|
||||
|
||||
bool debug = qmakeBuildConfiguration & QtVersion::DebugBuild;
|
||||
|
||||
// Add the buildconfiguration
|
||||
ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration(buildConfigurationName);
|
||||
addBuildConfiguration(bc);
|
||||
const QString &finalBuildConfigurationName = bc->name();
|
||||
|
||||
QMakeStep *qmakeStep = new QMakeStep(this, bc);
|
||||
bc->insertBuildStep(0, qmakeStep);
|
||||
|
||||
MakeStep *makeStep = new MakeStep(this, bc);
|
||||
bc->insertBuildStep(1, makeStep);
|
||||
|
||||
MakeStep* cleanStep = new MakeStep(this, bc);
|
||||
cleanStep->setClean(true);
|
||||
bc->insertCleanStep(0, cleanStep);
|
||||
if (!additionalArguments.isEmpty())
|
||||
qmake->m_values[finalBuildConfigurationName].qmakeArgs = additionalArguments;
|
||||
qmakeStep->m_qmakeArgs = additionalArguments;
|
||||
|
||||
// set some options for qmake and make
|
||||
if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets
|
||||
make->setMakeArguments(finalBuildConfigurationName, QStringList() << (debug ? "debug" : "release"));
|
||||
makeStep->setMakeArguments(QStringList() << (debug ? "debug" : "release"));
|
||||
|
||||
bc->setValue("buildConfiguration", int(qmakeBuildConfiguration));
|
||||
|
||||
@@ -818,20 +823,6 @@ QList<ProjectExplorer::Project*> Qt4Project::dependsOn()
|
||||
|
||||
void Qt4Project::addDefaultBuild()
|
||||
{
|
||||
// We don't have any buildconfigurations, so this is a new project
|
||||
QMakeStep *qmakeStep = 0;
|
||||
MakeStep *makeStep = 0;
|
||||
|
||||
qmakeStep = new QMakeStep(this);
|
||||
insertBuildStep(1, qmakeStep);
|
||||
|
||||
makeStep = new MakeStep(this);
|
||||
insertBuildStep(2, makeStep);
|
||||
|
||||
MakeStep* cleanStep = new MakeStep(this);
|
||||
cleanStep->setClean(true);
|
||||
insertCleanStep(1, cleanStep);
|
||||
|
||||
// TODO this could probably refactored
|
||||
// That is the ProjectLoadWizard divided into useful bits
|
||||
// and this code then called here, instead of that strange forwarding
|
||||
@@ -1176,19 +1167,19 @@ void Qt4Project::proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *nod
|
||||
}
|
||||
}
|
||||
|
||||
QMakeStep *Qt4Project::qmakeStep() const
|
||||
QMakeStep *Qt4Project::qmakeStep(ProjectExplorer::BuildConfiguration *bc) const
|
||||
{
|
||||
QMakeStep *qs = 0;
|
||||
foreach(BuildStep *bs, buildSteps())
|
||||
foreach(BuildStep *bs, bc->buildSteps())
|
||||
if ((qs = qobject_cast<QMakeStep *>(bs)) != 0)
|
||||
return qs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
MakeStep *Qt4Project::makeStep() const
|
||||
MakeStep *Qt4Project::makeStep(ProjectExplorer::BuildConfiguration *bc) const
|
||||
{
|
||||
MakeStep *qs = 0;
|
||||
foreach(BuildStep *bs, buildSteps())
|
||||
foreach(BuildStep *bs, bc->buildSteps())
|
||||
if ((qs = qobject_cast<MakeStep *>(bs)) != 0)
|
||||
return qs;
|
||||
return 0;
|
||||
@@ -1266,22 +1257,22 @@ QStringList Qt4Project::removeSpecFromArgumentList(const QStringList &old)
|
||||
}
|
||||
|
||||
// returns true if both are equal
|
||||
bool Qt4Project::compareBuildConfigurationToImportFrom(BuildConfiguration *configuration, const QString &workingDirectory)
|
||||
bool Qt4Project::compareBuildConfigurationToImportFrom(BuildConfiguration *bc, const QString &workingDirectory)
|
||||
{
|
||||
QMakeStep *qs = qmakeStep();
|
||||
QMakeStep *qs = qmakeStep(bc);
|
||||
if (QDir(workingDirectory).exists(QLatin1String("Makefile")) && qs) {
|
||||
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(workingDirectory);
|
||||
QtVersion *version = qtVersion(configuration);
|
||||
QtVersion *version = qtVersion(bc);
|
||||
if (version->qmakeCommand() == qmakePath) {
|
||||
// same qtversion
|
||||
QPair<QtVersion::QmakeBuildConfigs, QStringList> result =
|
||||
QtVersionManager::scanMakeFile(workingDirectory, version->defaultBuildConfig());
|
||||
if (QtVersion::QmakeBuildConfig(configuration->value("buildConfiguration").toInt()) == result.first) {
|
||||
if (QtVersion::QmakeBuildConfig(bc->value("buildConfiguration").toInt()) == result.first) {
|
||||
// The QMake Build Configuration are the same,
|
||||
// now compare arguments lists
|
||||
// we have to compare without the spec/platform cmd argument
|
||||
// and compare that on its own
|
||||
QString actualSpec = extractSpecFromArgumentList(qs->m_values.value(configuration->name()).qmakeArgs, workingDirectory, version);
|
||||
QString actualSpec = extractSpecFromArgumentList(qs->m_qmakeArgs, workingDirectory, version);
|
||||
if (actualSpec.isEmpty()) {
|
||||
// Easy one the user has choosen not to override the settings
|
||||
actualSpec = version->mkspec();
|
||||
@@ -1289,7 +1280,7 @@ bool Qt4Project::compareBuildConfigurationToImportFrom(BuildConfiguration *confi
|
||||
|
||||
|
||||
QString parsedSpec = extractSpecFromArgumentList(result.second, workingDirectory, version);
|
||||
QStringList actualArgs = removeSpecFromArgumentList(qs->m_values.value(configuration->name()).qmakeArgs);
|
||||
QStringList actualArgs = removeSpecFromArgumentList(qs->m_qmakeArgs);
|
||||
QStringList parsedArgs = removeSpecFromArgumentList(result.second);
|
||||
|
||||
if (debug) {
|
||||
|
||||
@@ -211,14 +211,13 @@ public:
|
||||
|
||||
QList<Internal::Qt4ProFileNode *> applicationProFiles() const;
|
||||
|
||||
// Those functions arein a few places.
|
||||
// Those functions are used in a few places.
|
||||
// The drawback is that we shouldn't actually depend on them beeing always there
|
||||
// That is generally the stuff that is asked should normally be transfered to
|
||||
// Qt4Project *
|
||||
// So that we can later enable people to build qt4projects the way they would like
|
||||
QMakeStep *qmakeStep() const;
|
||||
MakeStep *makeStep() const;
|
||||
|
||||
QMakeStep *qmakeStep(ProjectExplorer::BuildConfiguration *bc) const;
|
||||
MakeStep *makeStep(ProjectExplorer::BuildConfiguration *bc) const;
|
||||
void notifyChanged(const QString &name);
|
||||
|
||||
QString makeCommand(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
@@ -232,8 +232,8 @@ void Qt4ProjectConfigWidget::updateImportLabel()
|
||||
bool visible = false;
|
||||
|
||||
// we only show if we actually have a qmake and makestep
|
||||
if (m_pro->qmakeStep() && m_pro->makeStep()) {
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
if (m_pro->qmakeStep(bc) && m_pro->makeStep(bc)) {
|
||||
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(m_pro->buildDirectory(bc));
|
||||
QtVersion *version = m_pro->qtVersion(bc);
|
||||
// check that there's a makefile
|
||||
@@ -271,9 +271,9 @@ void Qt4ProjectConfigWidget::shadowBuildLineEditTextChanged()
|
||||
|
||||
void Qt4ProjectConfigWidget::importLabelClicked()
|
||||
{
|
||||
if (!m_pro->qmakeStep() || !m_pro->makeStep())
|
||||
return;
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
if (!m_pro->qmakeStep(bc) || !m_pro->makeStep(bc))
|
||||
return;
|
||||
QString directory = m_pro->buildDirectory(bc);
|
||||
if (!directory.isEmpty()) {
|
||||
QString qmakePath = QtVersionManager::findQMakeBinaryFromMakefile(directory);
|
||||
@@ -302,16 +302,16 @@ void Qt4ProjectConfigWidget::importLabelClicked()
|
||||
m_pro->setQtVersion(bc, version->uniqueId());
|
||||
// Combo box will be updated at the end
|
||||
|
||||
QMakeStep *qmakeStep = m_pro->qmakeStep();
|
||||
qmakeStep->setQMakeArguments(m_buildConfiguration, additionalArguments);
|
||||
MakeStep *makeStep = m_pro->makeStep();
|
||||
QMakeStep *qmakeStep = m_pro->qmakeStep(bc);
|
||||
qmakeStep->setQMakeArguments(additionalArguments);
|
||||
MakeStep *makeStep = m_pro->makeStep(bc);
|
||||
|
||||
bc->setValue("buildConfiguration", int(qmakeBuildConfig));
|
||||
// Adjust command line arguments, this is ugly as hell
|
||||
// If we are switching to BuildAll we want "release" in there and no "debug"
|
||||
// or "debug" in there and no "release"
|
||||
// If we are switching to not BuildAl we want neither "release" nor "debug" in there
|
||||
QStringList makeCmdArguments = makeStep->makeArguments(m_buildConfiguration);
|
||||
QStringList makeCmdArguments = makeStep->makeArguments();
|
||||
bool debug = qmakeBuildConfig & QtVersion::DebugBuild;
|
||||
if (qmakeBuildConfig & QtVersion::BuildAll) {
|
||||
makeCmdArguments.removeAll(debug ? "release" : "debug");
|
||||
@@ -321,7 +321,7 @@ void Qt4ProjectConfigWidget::importLabelClicked()
|
||||
makeCmdArguments.removeAll("debug");
|
||||
makeCmdArguments.removeAll("release");
|
||||
}
|
||||
makeStep->setMakeArguments(m_buildConfiguration, makeCmdArguments);
|
||||
makeStep->setMakeArguments(makeCmdArguments);
|
||||
}
|
||||
}
|
||||
setupQtVersionsComboBox();
|
||||
|
||||
@@ -257,12 +257,17 @@ void Qt4Manager::runQMakeContextMenu()
|
||||
|
||||
void Qt4Manager::runQMake(ProjectExplorer::Project *p)
|
||||
{
|
||||
QMakeStep *qs = qobject_cast<Qt4Project *>(p)->qmakeStep();
|
||||
ProjectExplorer::BuildConfiguration *bc = p->activeBuildConfiguration();
|
||||
QMakeStep *qs = 0;
|
||||
foreach(BuildStep *bs, bc->buildSteps())
|
||||
if ((qs = qobject_cast<QMakeStep *>(bs)) != 0)
|
||||
break;
|
||||
|
||||
if (!qs)
|
||||
return;
|
||||
//found qmakeStep, now use it
|
||||
qs->setForced(true);
|
||||
m_projectExplorer->buildManager()->appendStep(qs, p->activeBuildConfiguration()->name());
|
||||
m_projectExplorer->buildManager()->appendStep(qs);
|
||||
}
|
||||
|
||||
QString Qt4Manager::fileTypeId(ProjectExplorer::FileType type)
|
||||
|
||||
@@ -28,7 +28,6 @@ HEADERS += qt4projectmanagerplugin.h \
|
||||
qt4projectmanagerconstants.h \
|
||||
makestep.h \
|
||||
qmakestep.h \
|
||||
deployhelper.h \
|
||||
embeddedpropertiespage.h \
|
||||
qt4runconfiguration.h \
|
||||
qtmodulesinfo.h \
|
||||
@@ -64,7 +63,6 @@ SOURCES += qt4projectmanagerplugin.cpp \
|
||||
wizards/qtwizard.cpp \
|
||||
makestep.cpp \
|
||||
qmakestep.cpp \
|
||||
deployhelper.cpp \
|
||||
embeddedpropertiespage.cpp \
|
||||
qt4runconfiguration.cpp \
|
||||
qtmodulesinfo.cpp \
|
||||
|
||||
Reference in New Issue
Block a user