forked from qt-creator/qt-creator
ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.
- Collapse the two lines of constructors similar to what
890c1906e6
did for RunConfigurations
* Deploy* was purely mechanical
* Build* ctors are split in connects() in the ctor body
to create "empty shell for clone" etc
and build step additions in initialize() functions which
are only used in the create() case.
-- Allows to collapse the shared 'ctor()' functions, too.
- Move FooBuildConfigurationFactory::create() implementations
to FooBuildConfiguration() constructor. That was a strange
and unneeded ping-pong between factories and objects, and
furthermore allows one level less of indirection (and for a
later, left out here, some reduction of the
FooBuildConfiguration interfaces that were only used to
accommodate the *Factory::create() functions.
- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
but there wasn't one in the base classses. Have one there.
- Most canHandle() functions were checking simple restrictions on
e.g. project or target types, specify those by setters in the
constructors instead and check them in the base canHandle()
- clone() is generally replaced by a creation of a "shell object"
and a fromMap(source->toMap()), implemented in the base, there
are two cases left for Android and Qbs that needed(?) some extra
polish
- generally use canHandle() in base implementation, instead
of doing that in all Derived::canFoo()
- as a result, canCreate/create/canClone/clone reimplementations
are not needed anymore, keep the base implementation for
now (could be inlined into their only users later), but
de-virtualize them.
- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
'dsym' build step they could create.
- Split the 'mangled' id into the ProjectConfiguration subtype
specific constant identifier, and a QString extraId() bit.
Only maintain the mangled id in saved settings.
- Make ProjectConfiguration::m_id a constant member, adapt
all constructors of derived classe.
Not done in this patch:
- Finish possible cosmetic changes on top
- Add a way to specify restrictions to supported Qt versions
(used in Android/Ios), as the base implementation does not
depend on the qtsupport plugin
- Combine the QList<X> availableFoo() + createFoo(X) function
pairs to somthing like a direct
QList<struct { X; std::function<X()>; }> fooCreators()
to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
pingpong
- Remove the *Factories from the global object pool
- Do something about priority(). Falling back to plain
qmake in android+qmake setup is not helpful.
Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -95,7 +95,7 @@ private:
|
|||||||
this);
|
this);
|
||||||
};
|
};
|
||||||
|
|
||||||
AndroidBuildApkStep::AndroidBuildApkStep(ProjectExplorer::BuildStepList *parent, const Core::Id id)
|
AndroidBuildApkStep::AndroidBuildApkStep(ProjectExplorer::BuildStepList *parent, Core::Id id)
|
||||||
: ProjectExplorer::AbstractProcessStep(parent, id),
|
: ProjectExplorer::AbstractProcessStep(parent, id),
|
||||||
m_buildTargetSdk(AndroidConfig::apiLevelNameFor(AndroidConfigurations::
|
m_buildTargetSdk(AndroidConfig::apiLevelNameFor(AndroidConfigurations::
|
||||||
sdkManager()->latestAndroidSdkPlatform()))
|
sdkManager()->latestAndroidSdkPlatform()))
|
||||||
@@ -104,18 +104,6 @@ AndroidBuildApkStep::AndroidBuildApkStep(ProjectExplorer::BuildStepList *parent,
|
|||||||
setDefaultDisplayName(tr("Build Android APK"));
|
setDefaultDisplayName(tr("Build Android APK"));
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidBuildApkStep::AndroidBuildApkStep(ProjectExplorer::BuildStepList *parent,
|
|
||||||
AndroidBuildApkStep *other)
|
|
||||||
: ProjectExplorer::AbstractProcessStep(parent, other),
|
|
||||||
m_signPackage(other->signPackage()),
|
|
||||||
m_verbose(other->m_verbose),
|
|
||||||
m_useMinistro(other->useMinistro()),
|
|
||||||
m_openPackageLocation(other->m_openPackageLocation),
|
|
||||||
// leave m_openPackageLocationForRun at false
|
|
||||||
m_buildTargetSdk(other->m_buildTargetSdk)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
|
bool AndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
|
||||||
{
|
{
|
||||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||||
|
@@ -38,9 +38,11 @@ namespace Android {
|
|||||||
class ANDROID_EXPORT AndroidBuildApkStep : public ProjectExplorer::AbstractProcessStep
|
class ANDROID_EXPORT AndroidBuildApkStep : public ProjectExplorer::AbstractProcessStep
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
|
||||||
AndroidBuildApkStep(ProjectExplorer::BuildStepList *bc, const Core::Id id);
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
AndroidBuildApkStep(ProjectExplorer::BuildStepList *bc, Core::Id id);
|
||||||
|
|
||||||
|
public:
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
@@ -75,9 +77,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
Q_INVOKABLE void showInGraphicalShell();
|
Q_INVOKABLE void showInGraphicalShell();
|
||||||
|
|
||||||
AndroidBuildApkStep(ProjectExplorer::BuildStepList *bc,
|
|
||||||
AndroidBuildApkStep *other);
|
|
||||||
|
|
||||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||||
bool immutable() const override { return true; }
|
bool immutable() const override { return true; }
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "androiddeployconfiguration.h"
|
#include "androiddeployconfiguration.h"
|
||||||
|
|
||||||
#include "androidconstants.h"
|
#include "androidconstants.h"
|
||||||
#include "androiddeployqtstep.h"
|
#include "androiddeployqtstep.h"
|
||||||
#include "androidmanager.h"
|
#include "androidmanager.h"
|
||||||
@@ -46,92 +47,40 @@ namespace Internal {
|
|||||||
// Qt 5.2 has a new form of deployment
|
// Qt 5.2 has a new form of deployment
|
||||||
const char ANDROID_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.AndroidDeployConfiguration2";
|
const char ANDROID_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.AndroidDeployConfiguration2";
|
||||||
|
|
||||||
AndroidDeployConfiguration::AndroidDeployConfiguration(Target *parent, Core::Id id)
|
AndroidDeployConfiguration::AndroidDeployConfiguration(Target *parent)
|
||||||
: DeployConfiguration(parent, id)
|
: DeployConfiguration(parent, ANDROID_DEPLOYCONFIGURATION_ID)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void AndroidDeployConfiguration::initialize()
|
||||||
{
|
{
|
||||||
setDisplayName(tr("Deploy to Android device"));
|
stepList()->insertStep(0, new AndroidDeployQtStep(stepList()));
|
||||||
setDefaultDisplayName(displayName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidDeployConfiguration::AndroidDeployConfiguration(Target *parent, DeployConfiguration *source)
|
AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory()
|
||||||
: DeployConfiguration(parent, source)
|
|
||||||
{
|
{
|
||||||
cloneSteps(source);
|
setObjectName("AndroidDeployConfigurationFactory");
|
||||||
|
registerDeployConfiguration<AndroidDeployConfiguration>(ANDROID_DEPLOYCONFIGURATION_ID);
|
||||||
|
setSupportedTargetDeviceTypes({Constants::ANDROID_DEVICE_TYPE});
|
||||||
|
setDefaultDisplayName(AndroidDeployConfiguration::tr("Deploy to Android device"));
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory(QObject *parent)
|
QList<QString> AndroidDeployConfigurationFactory::availableBuildTargets(Target *parent) const
|
||||||
: DeployConfigurationFactory(parent)
|
|
||||||
{
|
{
|
||||||
setObjectName(QLatin1String("AndroidDeployConfigurationFactory"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AndroidDeployConfigurationFactory::canCreate(Target *parent, Core::Id id) const
|
|
||||||
{
|
|
||||||
return availableCreationIds(parent).contains(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeployConfiguration *AndroidDeployConfigurationFactory::create(Target *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
AndroidDeployConfiguration *dc = new AndroidDeployConfiguration(parent, id);
|
|
||||||
dc->stepList()->insertStep(0, new AndroidDeployQtStep(dc->stepList()));
|
|
||||||
return dc;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AndroidDeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
|
||||||
{
|
|
||||||
return canCreate(parent, idFromMap(map));
|
|
||||||
}
|
|
||||||
|
|
||||||
DeployConfiguration *AndroidDeployConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
|
||||||
{
|
|
||||||
if (!canRestore(parent, map))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
AndroidDeployConfiguration *dc = new AndroidDeployConfiguration(parent, idFromMap(map));
|
|
||||||
if (dc->fromMap(map))
|
|
||||||
return dc;
|
|
||||||
|
|
||||||
delete dc;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AndroidDeployConfigurationFactory::canClone(Target *parent, DeployConfiguration *source) const
|
|
||||||
{
|
|
||||||
if (!AndroidManager::supportsAndroid(parent))
|
|
||||||
return false;
|
|
||||||
return canCreate(parent, source->id());
|
|
||||||
}
|
|
||||||
|
|
||||||
DeployConfiguration *AndroidDeployConfigurationFactory::clone(Target *parent, DeployConfiguration *source)
|
|
||||||
{
|
|
||||||
if (!canClone(parent, source))
|
|
||||||
return 0;
|
|
||||||
return new AndroidDeployConfiguration(parent, source);
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Core::Id> AndroidDeployConfigurationFactory::availableCreationIds(Target *parent) const
|
|
||||||
{
|
|
||||||
QList<Core::Id> ids;
|
|
||||||
if (!parent->project()->supportsKit(parent->kit()))
|
|
||||||
return ids;
|
|
||||||
|
|
||||||
ToolChain *tc = ToolChainKitInformation::toolChain(parent->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
ToolChain *tc = ToolChainKitInformation::toolChain(parent->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||||
|
|
||||||
if (!tc || tc->targetAbi().osFlavor() != Abi::AndroidLinuxFlavor)
|
if (!tc || tc->targetAbi().osFlavor() != Abi::AndroidLinuxFlavor)
|
||||||
return ids;
|
return {};
|
||||||
|
|
||||||
QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(parent->kit());
|
QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(parent->kit());
|
||||||
if (!qt || qt->type() != QLatin1String(Constants::ANDROIDQT))
|
if (!qt || qt->type() != Constants::ANDROIDQT)
|
||||||
return ids;
|
return {};
|
||||||
ids << Core::Id(ANDROID_DEPLOYCONFIGURATION_ID);
|
return {QString()};
|
||||||
return ids;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AndroidDeployConfigurationFactory::displayNameForId(Core::Id id) const
|
bool AndroidDeployConfigurationFactory::canHandle(Target *parent) const
|
||||||
{
|
{
|
||||||
if (id == Core::Id(ANDROID_DEPLOYCONFIGURATION_ID))
|
return DeployConfigurationFactory::canHandle(parent)
|
||||||
return tr("Deploy on Android");
|
&& AndroidManager::supportsAndroid(parent->kit());
|
||||||
return QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -33,14 +33,10 @@ namespace Internal {
|
|||||||
class AndroidDeployConfiguration : public ProjectExplorer::DeployConfiguration
|
class AndroidDeployConfiguration : public ProjectExplorer::DeployConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class AndroidDeployConfigurationFactory;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AndroidDeployConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
explicit AndroidDeployConfiguration(ProjectExplorer::Target *parent);
|
||||||
|
void initialize() override;
|
||||||
protected:
|
|
||||||
AndroidDeployConfiguration(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AndroidDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
class AndroidDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
||||||
@@ -48,18 +44,10 @@ class AndroidDeployConfigurationFactory : public ProjectExplorer::DeployConfigur
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AndroidDeployConfigurationFactory(QObject *parent = 0);
|
AndroidDeployConfigurationFactory();
|
||||||
|
|
||||||
bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const override;
|
bool canHandle(ProjectExplorer::Target *target) const override;
|
||||||
ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent, Core::Id id) override;
|
QList<QString> availableBuildTargets(ProjectExplorer::Target *parent) const override;
|
||||||
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const override;
|
|
||||||
ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
|
|
||||||
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source) const override;
|
|
||||||
ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source) override;
|
|
||||||
|
|
||||||
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const override;
|
|
||||||
// used to translate the ids to names to display to the user
|
|
||||||
QString displayNameForId(Core::Id id) const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -68,55 +68,28 @@ const QLatin1String InstallFailedPermissionModelDowngrade("INSTALL_FAILED_PERMIS
|
|||||||
const QLatin1String InstallFailedVersionDowngrade("INSTALL_FAILED_VERSION_DOWNGRADE");
|
const QLatin1String InstallFailedVersionDowngrade("INSTALL_FAILED_VERSION_DOWNGRADE");
|
||||||
const Core::Id AndroidDeployQtStep::Id("Qt4ProjectManager.AndroidDeployQtStep");
|
const Core::Id AndroidDeployQtStep::Id("Qt4ProjectManager.AndroidDeployQtStep");
|
||||||
|
|
||||||
//////////////////
|
|
||||||
// AndroidDeployQtStepFactory
|
// AndroidDeployQtStepFactory
|
||||||
/////////////////
|
|
||||||
|
|
||||||
|
AndroidDeployQtStepFactory::AndroidDeployQtStepFactory()
|
||||||
AndroidDeployQtStepFactory::AndroidDeployQtStepFactory(QObject *parent)
|
|
||||||
: IBuildStepFactory(parent)
|
|
||||||
{
|
{
|
||||||
|
registerStep<AndroidDeployQtStep>(AndroidDeployQtStep::Id);
|
||||||
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||||
|
setRepeatable(false);
|
||||||
|
setDisplayName(tr("Deploy to Android device or emulator"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildStepInfo> AndroidDeployQtStepFactory::availableSteps(BuildStepList *parent) const
|
bool AndroidDeployQtStepFactory::canHandle(BuildStepList *parent) const
|
||||||
{
|
{
|
||||||
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY
|
return BuildStepFactory::canHandle(parent)
|
||||||
|| !AndroidManager::supportsAndroid(parent->target())
|
&& AndroidManager::supportsAndroid(parent->target());
|
||||||
|| parent->contains(AndroidDeployQtStep::Id))
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return {{AndroidDeployQtStep::Id, tr("Deploy to Android device or emulator")}};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *AndroidDeployQtStepFactory::create(ProjectExplorer::BuildStepList *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
Q_UNUSED(id);
|
|
||||||
return new AndroidDeployQtStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *AndroidDeployQtStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
|
|
||||||
{
|
|
||||||
return new AndroidDeployQtStep(parent, static_cast<AndroidDeployQtStep *>(product));
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////
|
|
||||||
// AndroidDeployQtStep
|
// AndroidDeployQtStep
|
||||||
/////////////////
|
|
||||||
|
|
||||||
AndroidDeployQtStep::AndroidDeployQtStep(ProjectExplorer::BuildStepList *parent)
|
AndroidDeployQtStep::AndroidDeployQtStep(ProjectExplorer::BuildStepList *parent)
|
||||||
: ProjectExplorer::BuildStep(parent, Id)
|
: ProjectExplorer::BuildStep(parent, Id)
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
AndroidDeployQtStep::AndroidDeployQtStep(ProjectExplorer::BuildStepList *parent,
|
|
||||||
AndroidDeployQtStep *other)
|
|
||||||
: ProjectExplorer::BuildStep(parent, other)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AndroidDeployQtStep::ctor()
|
|
||||||
{
|
{
|
||||||
m_uninstallPreviousPackage = QtSupport::QtKitInformation::qtVersion(target()->kit())->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0);
|
m_uninstallPreviousPackage = QtSupport::QtKitInformation::qtVersion(target()->kit())->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0);
|
||||||
m_uninstallPreviousPackageRun = false;
|
m_uninstallPreviousPackageRun = false;
|
||||||
|
@@ -41,18 +41,12 @@ QT_END_NAMESPACE
|
|||||||
namespace Android {
|
namespace Android {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class AndroidDeployQtStepFactory : public ProjectExplorer::IBuildStepFactory
|
class AndroidDeployQtStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AndroidDeployQtStepFactory(QObject *parent = 0);
|
AndroidDeployQtStepFactory();
|
||||||
|
bool canHandle(ProjectExplorer::BuildStepList *bsl) const;
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
|
|
||||||
ProjectExplorer::BuildStep *product) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AndroidDeployQtStep : public ProjectExplorer::BuildStep
|
class AndroidDeployQtStep : public ProjectExplorer::BuildStep
|
||||||
@@ -95,8 +89,6 @@ signals:
|
|||||||
void setSerialNumber(const QString &serialNumber);
|
void setSerialNumber(const QString &serialNumber);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AndroidDeployQtStep(ProjectExplorer::BuildStepList *bc, AndroidDeployQtStep *other);
|
|
||||||
void ctor();
|
|
||||||
void runCommand(const QString &program, const QStringList &arguments);
|
void runCommand(const QString &program, const QStringList &arguments);
|
||||||
|
|
||||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||||
|
@@ -45,8 +45,8 @@ const char amStartArgsKey[] = "Android.AmStartArgsKey";
|
|||||||
const char preStartShellCmdsKey[] = "Android.PreStartShellCmdListKey";
|
const char preStartShellCmdsKey[] = "Android.PreStartShellCmdListKey";
|
||||||
const char postFinishShellCmdsKey[] = "Android.PostFinishShellCmdListKey";
|
const char postFinishShellCmdsKey[] = "Android.PostFinishShellCmdListKey";
|
||||||
|
|
||||||
AndroidRunConfiguration::AndroidRunConfiguration(Target *target)
|
AndroidRunConfiguration::AndroidRunConfiguration(Target *target, Core::Id id)
|
||||||
: RunConfiguration(target)
|
: RunConfiguration(target, id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,10 +87,12 @@ Utils::OutputFormatter *AndroidRunConfiguration::createOutputFormatter() const
|
|||||||
|
|
||||||
bool AndroidRunConfiguration::fromMap(const QVariantMap &map)
|
bool AndroidRunConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
|
if (!RunConfiguration::fromMap(map))
|
||||||
|
return false;
|
||||||
m_preStartShellCommands = map.value(preStartShellCmdsKey).toStringList();
|
m_preStartShellCommands = map.value(preStartShellCmdsKey).toStringList();
|
||||||
m_postFinishShellCommands = map.value(postFinishShellCmdsKey).toStringList();
|
m_postFinishShellCommands = map.value(postFinishShellCmdsKey).toStringList();
|
||||||
m_amStartExtraArgs = map.value(amStartArgsKey).toStringList();
|
m_amStartExtraArgs = map.value(amStartArgsKey).toStringList();
|
||||||
return RunConfiguration::fromMap(map);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap AndroidRunConfiguration::toMap() const
|
QVariantMap AndroidRunConfiguration::toMap() const
|
||||||
|
@@ -35,7 +35,7 @@ class ANDROID_EXPORT AndroidRunConfiguration : public ProjectExplorer::RunConfig
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AndroidRunConfiguration(ProjectExplorer::Target *target);
|
explicit AndroidRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||||
|
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
Utils::OutputFormatter *createOutputFormatter() const override;
|
Utils::OutputFormatter *createOutputFormatter() const override;
|
||||||
|
@@ -47,9 +47,8 @@ class TestRunConfiguration : public ProjectExplorer::RunConfiguration
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
TestRunConfiguration(ProjectExplorer::Target *parent, TestConfiguration *config)
|
TestRunConfiguration(ProjectExplorer::Target *parent, TestConfiguration *config)
|
||||||
: ProjectExplorer::RunConfiguration(parent)
|
: ProjectExplorer::RunConfiguration(parent, "AutoTest.TestRunConfig")
|
||||||
{
|
{
|
||||||
initialize("AutoTest.TestRunConfig");
|
|
||||||
setDefaultDisplayName(tr("AutoTest Debug"));
|
setDefaultDisplayName(tr("AutoTest Debug"));
|
||||||
|
|
||||||
bool enableQuick = false;
|
bool enableQuick = false;
|
||||||
|
@@ -50,53 +50,21 @@ using namespace ProjectExplorer;
|
|||||||
const char AUTOGEN_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.AutogenStep.AdditionalArguments";
|
const char AUTOGEN_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.AutogenStep.AdditionalArguments";
|
||||||
const char AUTOGEN_STEP_ID[] = "AutotoolsProjectManager.AutogenStep";
|
const char AUTOGEN_STEP_ID[] = "AutotoolsProjectManager.AutogenStep";
|
||||||
|
|
||||||
/////////////////////////////
|
|
||||||
// AutogenStepFactory class
|
|
||||||
/////////////////////////////
|
|
||||||
AutogenStepFactory::AutogenStepFactory(QObject *parent) : IBuildStepFactory(parent)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QList<BuildStepInfo> AutogenStepFactory::availableSteps(BuildStepList *parent) const
|
// AutogenStepFactory
|
||||||
|
|
||||||
|
AutogenStepFactory::AutogenStepFactory()
|
||||||
{
|
{
|
||||||
if (parent->target()->project()->id() != Constants::AUTOTOOLS_PROJECT_ID
|
registerStep<AutogenStep>(AUTOGEN_STEP_ID);
|
||||||
|| parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD)
|
setDisplayName(tr("Autogen", "Display name for AutotoolsProjectManager::AutogenStep id."));
|
||||||
return {};
|
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
|
||||||
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
QString display = tr("Autogen", "Display name for AutotoolsProjectManager::AutogenStep id.");
|
|
||||||
return {{AUTOGEN_STEP_ID, display}};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStep *AutogenStepFactory::create(BuildStepList *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
Q_UNUSED(id)
|
|
||||||
return new AutogenStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *AutogenStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
// AutogenStep
|
||||||
{
|
|
||||||
return new AutogenStep(parent, static_cast<AutogenStep *>(source));
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////
|
AutogenStep::AutogenStep(BuildStepList *bsl) : AbstractProcessStep(bsl, AUTOGEN_STEP_ID)
|
||||||
// AutogenStep class
|
|
||||||
////////////////////////
|
|
||||||
AutogenStep::AutogenStep(BuildStepList *bsl) : AbstractProcessStep(bsl, Core::Id(AUTOGEN_STEP_ID))
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
AutogenStep::AutogenStep(BuildStepList *bsl, Core::Id id) : AbstractProcessStep(bsl, id)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
AutogenStep::AutogenStep(BuildStepList *bsl, AutogenStep *bs) : AbstractProcessStep(bsl, bs),
|
|
||||||
m_additionalArguments(bs->additionalArguments())
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AutogenStep::ctor()
|
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(tr("Autogen"));
|
setDefaultDisplayName(tr("Autogen"));
|
||||||
}
|
}
|
||||||
|
@@ -48,18 +48,12 @@ class AutogenStepConfigWidget;
|
|||||||
*
|
*
|
||||||
* This factory is used to create instances of AutogenStep.
|
* This factory is used to create instances of AutogenStep.
|
||||||
*/
|
*/
|
||||||
class AutogenStepFactory : public ProjectExplorer::IBuildStepFactory
|
class AutogenStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AutogenStepFactory(QObject *parent = 0);
|
AutogenStepFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
@@ -97,14 +91,8 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void additionalArgumentsChanged(const QString &);
|
void additionalArgumentsChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
|
||||||
AutogenStep(ProjectExplorer::BuildStepList *bsl, AutogenStep *bs);
|
|
||||||
AutogenStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
|
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
QString m_additionalArguments;
|
QString m_additionalArguments;
|
||||||
bool m_runAutogen = false;
|
bool m_runAutogen = false;
|
||||||
|
@@ -49,55 +49,21 @@ using namespace ProjectExplorer;
|
|||||||
const char AUTORECONF_STEP_ID[] = "AutotoolsProjectManager.AutoreconfStep";
|
const char AUTORECONF_STEP_ID[] = "AutotoolsProjectManager.AutoreconfStep";
|
||||||
const char AUTORECONF_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.AutoreconfStep.AdditionalArguments";
|
const char AUTORECONF_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.AutoreconfStep.AdditionalArguments";
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
// AutoreconfStepFactory class
|
// AutoreconfStepFactory class
|
||||||
////////////////////////////////
|
|
||||||
AutoreconfStepFactory::AutoreconfStepFactory(QObject *parent) : IBuildStepFactory(parent)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QList<BuildStepInfo> AutoreconfStepFactory::availableSteps(BuildStepList *parent) const
|
AutoreconfStepFactory::AutoreconfStepFactory()
|
||||||
{
|
{
|
||||||
if (parent->target()->project()->id() != Constants::AUTOTOOLS_PROJECT_ID
|
registerStep<AutoreconfStep>(AUTORECONF_STEP_ID);
|
||||||
|| parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD)
|
setDisplayName(tr("Autoreconf", "Display name for AutotoolsProjectManager::AutoreconfStep id."));
|
||||||
return {};
|
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
|
||||||
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
QString display = tr("Autoreconf", "Display name for AutotoolsProjectManager::AutoreconfStep id.");
|
|
||||||
return {{AUTORECONF_STEP_ID, display}};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStep *AutoreconfStepFactory::create(BuildStepList *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
Q_UNUSED(id);
|
|
||||||
return new AutoreconfStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *AutoreconfStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
|
||||||
{
|
|
||||||
return new AutoreconfStep(parent, static_cast<AutoreconfStep *>(source));
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////
|
|
||||||
// AutoreconfStep class
|
// AutoreconfStep class
|
||||||
/////////////////////////
|
|
||||||
AutoreconfStep::AutoreconfStep(BuildStepList *bsl) :
|
|
||||||
AbstractProcessStep(bsl, Core::Id(AUTORECONF_STEP_ID))
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoreconfStep::AutoreconfStep(BuildStepList *bsl, Core::Id id) : AbstractProcessStep(bsl, id)
|
AutoreconfStep::AutoreconfStep(BuildStepList *bsl) : AbstractProcessStep(bsl, AUTORECONF_STEP_ID)
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoreconfStep::AutoreconfStep(BuildStepList *bsl, AutoreconfStep *bs) :
|
|
||||||
AbstractProcessStep(bsl, bs),
|
|
||||||
m_additionalArguments(bs->additionalArguments())
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AutoreconfStep::ctor()
|
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(tr("Autoreconf"));
|
setDefaultDisplayName(tr("Autoreconf"));
|
||||||
}
|
}
|
||||||
|
@@ -47,18 +47,12 @@ class AutoreconfStep;
|
|||||||
*
|
*
|
||||||
* The factory is used to create instances of AutoreconfStep.
|
* The factory is used to create instances of AutoreconfStep.
|
||||||
*/
|
*/
|
||||||
class AutoreconfStepFactory : public ProjectExplorer::IBuildStepFactory
|
class AutoreconfStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AutoreconfStepFactory(QObject *parent = 0);
|
AutoreconfStepFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
@@ -96,14 +90,8 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void additionalArgumentsChanged(const QString &);
|
void additionalArgumentsChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
|
||||||
AutoreconfStep(ProjectExplorer::BuildStepList *bsl, AutoreconfStep *bs);
|
|
||||||
AutoreconfStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
|
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
QString m_additionalArguments;
|
QString m_additionalArguments;
|
||||||
bool m_runAutoreconf = false;
|
bool m_runAutoreconf = false;
|
||||||
|
@@ -53,11 +53,11 @@ using namespace Internal;
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ProjectExplorer::Constants;
|
using namespace ProjectExplorer::Constants;
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// AutotoolsBuildConfiguration class
|
// AutotoolsBuildConfiguration
|
||||||
//////////////////////////////////////
|
|
||||||
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(Target *parent) :
|
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(Target *parent)
|
||||||
BuildConfiguration(parent, Core::Id(AUTOTOOLS_BC_ID))
|
: BuildConfiguration(parent, Constants::AUTOTOOLS_BC_ID)
|
||||||
{
|
{
|
||||||
// /<foobar> is used so the un-changed check in setBuildDirectory() works correctly.
|
// /<foobar> is used so the un-changed check in setBuildDirectory() works correctly.
|
||||||
// The leading / is to avoid the relative the path expansion in BuildConfiguration::buildDirectory.
|
// The leading / is to avoid the relative the path expansion in BuildConfiguration::buildDirectory.
|
||||||
@@ -69,82 +69,21 @@ AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(Target *parent) :
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
NamedWidget *AutotoolsBuildConfiguration::createConfigWidget()
|
void AutotoolsBuildConfiguration::initialize(const BuildInfo *info)
|
||||||
{
|
{
|
||||||
return new AutotoolsBuildSettingsWidget(this);
|
BuildConfiguration::initialize(info);
|
||||||
}
|
|
||||||
|
|
||||||
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(Target *parent, Core::Id id) :
|
BuildStepList *buildSteps = stepList(BUILDSTEPS_BUILD);
|
||||||
BuildConfiguration(parent, id)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(Target *parent,
|
|
||||||
AutotoolsBuildConfiguration *source) :
|
|
||||||
BuildConfiguration(parent, source)
|
|
||||||
{
|
|
||||||
cloneSteps(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// AutotoolsBuildConfiguration class
|
|
||||||
//////////////////////////////////////
|
|
||||||
AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory(QObject *parent) :
|
|
||||||
IBuildConfigurationFactory(parent)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
int AutotoolsBuildConfigurationFactory::priority(const Target *parent) const
|
|
||||||
{
|
|
||||||
return canHandle(parent) ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
|
||||||
{
|
|
||||||
QList<BuildInfo *> result;
|
|
||||||
result << createBuildInfo(parent->kit(), parent->project()->projectDirectory());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AutotoolsBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
|
||||||
{
|
|
||||||
if (k && Utils::mimeTypeForFile(projectPath).matchesName(QLatin1String(Constants::MAKEFILE_MIMETYPE)))
|
|
||||||
return 0;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
|
||||||
{
|
|
||||||
QList<BuildInfo *> result;
|
|
||||||
BuildInfo *info = createBuildInfo(k,
|
|
||||||
Utils::FileName::fromString(AutotoolsProject::defaultBuildDirectory(projectPath)));
|
|
||||||
//: The name of the build configuration created by default for a autotools project.
|
|
||||||
info->displayName = tr("Default");
|
|
||||||
result << info;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *AutotoolsBuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
|
||||||
{
|
|
||||||
QTC_ASSERT(parent, return 0);
|
|
||||||
QTC_ASSERT(info->factory() == this, return 0);
|
|
||||||
QTC_ASSERT(info->kitId == parent->kit()->id(), return 0);
|
|
||||||
QTC_ASSERT(!info->displayName.isEmpty(), return 0);
|
|
||||||
|
|
||||||
AutotoolsBuildConfiguration *bc = new AutotoolsBuildConfiguration(parent);
|
|
||||||
bc->setDisplayName(info->displayName);
|
|
||||||
bc->setDefaultDisplayName(info->displayName);
|
|
||||||
bc->setBuildDirectory(info->buildDirectory);
|
|
||||||
|
|
||||||
BuildStepList *buildSteps = bc->stepList(Core::Id(BUILDSTEPS_BUILD));
|
|
||||||
|
|
||||||
// ### Build Steps Build ###
|
// ### Build Steps Build ###
|
||||||
// autogen.sh or autoreconf
|
// autogen.sh or autoreconf
|
||||||
QFile autogenFile(parent->project()->projectDirectory().toString() + QLatin1String("/autogen.sh"));
|
QFile autogenFile(target()->project()->projectDirectory().toString() + "/autogen.sh");
|
||||||
if (autogenFile.exists()) {
|
if (autogenFile.exists()) {
|
||||||
AutogenStep *autogenStep = new AutogenStep(buildSteps);
|
AutogenStep *autogenStep = new AutogenStep(buildSteps);
|
||||||
buildSteps->insertStep(0, autogenStep);
|
buildSteps->insertStep(0, autogenStep);
|
||||||
} else {
|
} else {
|
||||||
AutoreconfStep *autoreconfStep = new AutoreconfStep(buildSteps);
|
AutoreconfStep *autoreconfStep = new AutoreconfStep(buildSteps);
|
||||||
autoreconfStep->setAdditionalArguments(QLatin1String("--force --install"));
|
autoreconfStep->setAdditionalArguments("--force --install");
|
||||||
buildSteps->insertStep(0, autoreconfStep);
|
buildSteps->insertStep(0, autoreconfStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,22 +97,42 @@ BuildConfiguration *AutotoolsBuildConfigurationFactory::create(Target *parent, c
|
|||||||
makeStep->setBuildTarget(QLatin1String("all"), /*on =*/ true);
|
makeStep->setBuildTarget(QLatin1String("all"), /*on =*/ true);
|
||||||
|
|
||||||
// ### Build Steps Clean ###
|
// ### Build Steps Clean ###
|
||||||
BuildStepList *cleanSteps = bc->stepList(Core::Id(BUILDSTEPS_CLEAN));
|
BuildStepList *cleanSteps = stepList(BUILDSTEPS_CLEAN);
|
||||||
MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
|
MakeStep *cleanMakeStep = new MakeStep(cleanSteps);
|
||||||
cleanMakeStep->setAdditionalArguments(QLatin1String("clean"));
|
cleanMakeStep->setAdditionalArguments("clean");
|
||||||
cleanMakeStep->setClean(true);
|
cleanMakeStep->setClean(true);
|
||||||
cleanSteps->insertStep(0, cleanMakeStep);
|
cleanSteps->insertStep(0, cleanMakeStep);
|
||||||
|
|
||||||
return bc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutotoolsBuildConfigurationFactory::canHandle(const Target *t) const
|
NamedWidget *AutotoolsBuildConfiguration::createConfigWidget()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(t, return false);
|
return new AutotoolsBuildSettingsWidget(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (!t->project()->supportsKit(t->kit()))
|
|
||||||
return false;
|
// AutotoolsBuildConfiguration class
|
||||||
return t->project()->id() == Constants::AUTOTOOLS_PROJECT_ID;
|
|
||||||
|
AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory()
|
||||||
|
{
|
||||||
|
registerBuildConfiguration<AutotoolsBuildConfiguration>(AUTOTOOLS_BC_ID);
|
||||||
|
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
|
||||||
|
setSupportedProjectMimeTypeName(Constants::MAKEFILE_MIMETYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
||||||
|
{
|
||||||
|
return {createBuildInfo(parent->kit(), parent->project()->projectDirectory())};
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<BuildInfo *> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
QList<BuildInfo *> result;
|
||||||
|
BuildInfo *info = createBuildInfo(k,
|
||||||
|
Utils::FileName::fromString(AutotoolsProject::defaultBuildDirectory(projectPath)));
|
||||||
|
//: The name of the build configuration created by default for a autotools project.
|
||||||
|
info->displayName = tr("Default");
|
||||||
|
result << info;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildInfo *AutotoolsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
BuildInfo *AutotoolsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||||
@@ -187,40 +146,6 @@ BuildInfo *AutotoolsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutotoolsBuildConfigurationFactory::canClone(const Target *parent, BuildConfiguration *source) const
|
|
||||||
{
|
|
||||||
if (!canHandle(parent))
|
|
||||||
return false;
|
|
||||||
return source->id() == AUTOTOOLS_BC_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::clone(Target *parent, BuildConfiguration *source)
|
|
||||||
{
|
|
||||||
if (!canClone(parent, source))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
AutotoolsBuildConfiguration *origin = static_cast<AutotoolsBuildConfiguration *>(source);
|
|
||||||
return new AutotoolsBuildConfiguration(parent, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AutotoolsBuildConfigurationFactory::canRestore(const Target *parent, const QVariantMap &map) const
|
|
||||||
{
|
|
||||||
if (!canHandle(parent))
|
|
||||||
return false;
|
|
||||||
return idFromMap(map) == AUTOTOOLS_BC_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
|
||||||
{
|
|
||||||
if (!canRestore(parent, map))
|
|
||||||
return 0;
|
|
||||||
AutotoolsBuildConfiguration *bc = new AutotoolsBuildConfiguration(parent);
|
|
||||||
if (bc->fromMap(map))
|
|
||||||
return bc;
|
|
||||||
delete bc;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration::BuildType AutotoolsBuildConfiguration::buildType() const
|
BuildConfiguration::BuildType AutotoolsBuildConfiguration::buildType() const
|
||||||
{
|
{
|
||||||
// TODO: Should I return something different from Unknown?
|
// TODO: Should I return something different from Unknown?
|
||||||
|
@@ -34,24 +34,16 @@ namespace Utils { class FileName; }
|
|||||||
namespace AutotoolsProjectManager {
|
namespace AutotoolsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class AutotoolsTarget;
|
|
||||||
class AutotoolsBuildConfigurationFactory;
|
|
||||||
|
|
||||||
class AutotoolsBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
class AutotoolsBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class AutotoolsBuildConfigurationFactory;
|
|
||||||
|
|
||||||
public:
|
friend class ProjectExplorer::IBuildConfigurationFactory;
|
||||||
explicit AutotoolsBuildConfiguration(ProjectExplorer::Target *parent);
|
explicit AutotoolsBuildConfiguration(ProjectExplorer::Target *parent);
|
||||||
|
|
||||||
|
void initialize(const ProjectExplorer::BuildInfo *info) override;
|
||||||
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
||||||
|
|
||||||
BuildType buildType() const override;
|
BuildType buildType() const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
AutotoolsBuildConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
|
||||||
AutotoolsBuildConfiguration(ProjectExplorer::Target *parent, AutotoolsBuildConfiguration *source);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AutotoolsBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
class AutotoolsBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
||||||
@@ -59,23 +51,13 @@ class AutotoolsBuildConfigurationFactory : public ProjectExplorer::IBuildConfigu
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AutotoolsBuildConfigurationFactory(QObject *parent = 0);
|
AutotoolsBuildConfigurationFactory();
|
||||||
|
|
||||||
int priority(const ProjectExplorer::Target *parent) const override;
|
|
||||||
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
|
||||||
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
|
|
||||||
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
|
||||||
const QString &projectPath) const override;
|
|
||||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
|
||||||
const ProjectExplorer::BuildInfo *info) const override;
|
|
||||||
|
|
||||||
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const override;
|
|
||||||
AutotoolsBuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) override;
|
|
||||||
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const override;
|
|
||||||
AutotoolsBuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool canHandle(const ProjectExplorer::Target *t) const;
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
||||||
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
||||||
|
const QString &projectPath) const override;
|
||||||
|
|
||||||
ProjectExplorer::BuildInfo *createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FileName &buildDir) const;
|
ProjectExplorer::BuildInfo *createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FileName &buildDir) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -64,55 +64,21 @@ static QString projectDirRelativeToBuildDir(BuildConfiguration *bc) {
|
|||||||
return projDirToBuildDir;
|
return projDirToBuildDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
// ConfigureStepFactory Class
|
|
||||||
////////////////////////////////
|
|
||||||
ConfigureStepFactory::ConfigureStepFactory(QObject *parent) : IBuildStepFactory(parent)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QList<BuildStepInfo> ConfigureStepFactory::availableSteps(BuildStepList *parent) const
|
// ConfigureStepFactory
|
||||||
|
|
||||||
|
ConfigureStepFactory::ConfigureStepFactory()
|
||||||
{
|
{
|
||||||
if (parent->target()->project()->id() != Constants::AUTOTOOLS_PROJECT_ID
|
registerStep<ConfigureStep>(CONFIGURE_STEP_ID);
|
||||||
|| parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD)
|
setDisplayName(tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id."));
|
||||||
return {};
|
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
|
||||||
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
QString display = tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id.");
|
|
||||||
return {{CONFIGURE_STEP_ID, display}};
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *ConfigureStepFactory::create(BuildStepList *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
Q_UNUSED(id)
|
|
||||||
return new ConfigureStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *ConfigureStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
|
||||||
{
|
|
||||||
return new ConfigureStep(parent, static_cast<ConfigureStep *>(source));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////
|
// ConfigureStep
|
||||||
// ConfigureStep class
|
|
||||||
////////////////////////
|
|
||||||
ConfigureStep::ConfigureStep(BuildStepList* bsl) :
|
|
||||||
AbstractProcessStep(bsl, Core::Id(CONFIGURE_STEP_ID))
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigureStep::ConfigureStep(BuildStepList *bsl, Core::Id id) : AbstractProcessStep(bsl, id)
|
ConfigureStep::ConfigureStep(BuildStepList *bsl) : AbstractProcessStep(bsl, CONFIGURE_STEP_ID)
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigureStep::ConfigureStep(BuildStepList *bsl, ConfigureStep *bs) : AbstractProcessStep(bsl, bs),
|
|
||||||
m_additionalArguments(bs->additionalArguments())
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigureStep::ctor()
|
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(tr("Configure"));
|
setDefaultDisplayName(tr("Configure"));
|
||||||
}
|
}
|
||||||
|
@@ -47,18 +47,12 @@ class ConfigureStepConfigWidget;
|
|||||||
*
|
*
|
||||||
* The factory is used to create instances of ConfigureStep.
|
* The factory is used to create instances of ConfigureStep.
|
||||||
*/
|
*/
|
||||||
class ConfigureStepFactory : public ProjectExplorer::IBuildStepFactory
|
class ConfigureStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConfigureStepFactory(QObject *parent = 0);
|
ConfigureStepFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
@@ -97,14 +91,8 @@ signals:
|
|||||||
void additionalArgumentsChanged(const QString &);
|
void additionalArgumentsChanged(const QString &);
|
||||||
void buildDirectoryChanged();
|
void buildDirectoryChanged();
|
||||||
|
|
||||||
protected:
|
|
||||||
ConfigureStep(ProjectExplorer::BuildStepList *bsl, ConfigureStep *bs);
|
|
||||||
ConfigureStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
|
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
QString m_additionalArguments;
|
QString m_additionalArguments;
|
||||||
bool m_runConfigure = false;
|
bool m_runConfigure = false;
|
||||||
|
@@ -56,53 +56,23 @@ const char CLEAN_KEY[] = "AutotoolsProjectManager.MakeStep.Clean";
|
|||||||
const char BUILD_TARGETS_KEY[] = "AutotoolsProjectManager.MakeStep.BuildTargets";
|
const char BUILD_TARGETS_KEY[] = "AutotoolsProjectManager.MakeStep.BuildTargets";
|
||||||
const char MAKE_STEP_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.MakeStep.AdditionalArguments";
|
const char MAKE_STEP_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.MakeStep.AdditionalArguments";
|
||||||
|
|
||||||
//////////////////////////
|
|
||||||
// MakeStepFactory class
|
|
||||||
//////////////////////////
|
|
||||||
MakeStepFactory::MakeStepFactory(QObject *parent) : IBuildStepFactory(parent)
|
|
||||||
{ setObjectName("Autotools::MakeStepFactory"); }
|
|
||||||
|
|
||||||
QList<BuildStepInfo> MakeStepFactory::availableSteps(BuildStepList *parent) const
|
// MakeStepFactory
|
||||||
|
|
||||||
|
MakeStepFactory::MakeStepFactory()
|
||||||
{
|
{
|
||||||
if (parent->target()->project()->id() != AUTOTOOLS_PROJECT_ID)
|
setObjectName("Autotools::MakeStepFactory");
|
||||||
return {};
|
registerStep<MakeStep>(MAKE_STEP_ID);
|
||||||
|
setDisplayName(tr("Make", "Display name for AutotoolsProjectManager::MakeStep id."));
|
||||||
return {{MAKE_STEP_ID, tr("Make", "Display name for AutotoolsProjectManager::MakeStep id.")}};
|
setSupportedProjectType(AUTOTOOLS_PROJECT_ID);
|
||||||
|
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD,
|
||||||
|
ProjectExplorer::Constants::BUILDSTEPS_CLEAN,
|
||||||
|
ProjectExplorer::Constants::BUILDSTEPS_DEPLOY});
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStep *MakeStepFactory::create(BuildStepList *parent, Core::Id id)
|
// MakeStep
|
||||||
{
|
|
||||||
Q_UNUSED(id)
|
|
||||||
return new MakeStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *MakeStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
MakeStep::MakeStep(BuildStepList *bsl) : AbstractProcessStep(bsl, MAKE_STEP_ID)
|
||||||
{
|
|
||||||
return new MakeStep(parent, static_cast<MakeStep *>(source));
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////
|
|
||||||
// MakeStep class
|
|
||||||
/////////////////////
|
|
||||||
MakeStep::MakeStep(BuildStepList* bsl) : AbstractProcessStep(bsl, Core::Id(MAKE_STEP_ID))
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
MakeStep::MakeStep(BuildStepList *bsl, Core::Id id) : AbstractProcessStep(bsl, id)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
MakeStep::MakeStep(BuildStepList *bsl, MakeStep *bs) : AbstractProcessStep(bsl, bs),
|
|
||||||
m_buildTargets(bs->m_buildTargets),
|
|
||||||
m_additionalArguments(bs->additionalArguments()),
|
|
||||||
m_clean(bs->m_clean)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MakeStep::ctor()
|
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(tr("Make"));
|
setDefaultDisplayName(tr("Make"));
|
||||||
}
|
}
|
||||||
|
@@ -48,18 +48,12 @@ class MakeStep;
|
|||||||
*
|
*
|
||||||
* The factory is used to create instances of MakeStep.
|
* The factory is used to create instances of MakeStep.
|
||||||
*/
|
*/
|
||||||
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
class MakeStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MakeStepFactory(QObject *parent = 0);
|
MakeStepFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
@@ -98,14 +92,8 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void additionalArgumentsChanged(const QString &);
|
void additionalArgumentsChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
|
||||||
MakeStep(ProjectExplorer::BuildStepList *bsl, MakeStep *bs);
|
|
||||||
MakeStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
|
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
QStringList m_buildTargets;
|
QStringList m_buildTargets;
|
||||||
QString m_additionalArguments;
|
QString m_additionalArguments;
|
||||||
|
@@ -117,11 +117,6 @@ BareMetalCustomRunConfiguration::BareMetalCustomRunConfiguration(ProjectExplorer
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void BareMetalCustomRunConfiguration::initialize(Core::Id)
|
|
||||||
{
|
|
||||||
BareMetalRunConfiguration::initialize(runConfigId());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BareMetalCustomRunConfiguration::isConfigured() const
|
bool BareMetalCustomRunConfiguration::isConfigured() const
|
||||||
{
|
{
|
||||||
return !m_localExecutable.isEmpty();
|
return !m_localExecutable.isEmpty();
|
||||||
|
@@ -38,8 +38,6 @@ class BareMetalCustomRunConfiguration : public BareMetalRunConfiguration
|
|||||||
public:
|
public:
|
||||||
explicit BareMetalCustomRunConfiguration(ProjectExplorer::Target *parent);
|
explicit BareMetalCustomRunConfiguration(ProjectExplorer::Target *parent);
|
||||||
|
|
||||||
void initialize(Core::Id) override;
|
|
||||||
|
|
||||||
bool isConfigured() const override;
|
bool isConfigured() const override;
|
||||||
ConfigurationState ensureConfigured(QString *errorMessage) override;
|
ConfigurationState ensureConfigured(QString *errorMessage) override;
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
|
@@ -62,21 +62,8 @@ QString BareMetalGdbCommandsDeployStepWidget::summaryText() const
|
|||||||
return displayName();
|
return displayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
BareMetalGdbCommandsDeployStep::BareMetalGdbCommandsDeployStep(BuildStepList *bsl,
|
BareMetalGdbCommandsDeployStep::BareMetalGdbCommandsDeployStep(BuildStepList *bsl)
|
||||||
const Core::Id id)
|
: BuildStep(bsl, stepId())
|
||||||
: BuildStep(bsl, id)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
BareMetalGdbCommandsDeployStep::BareMetalGdbCommandsDeployStep(BuildStepList *bsl,
|
|
||||||
BareMetalGdbCommandsDeployStep *other)
|
|
||||||
: BuildStep(bsl, other)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BareMetalGdbCommandsDeployStep::ctor()
|
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(displayName());
|
setDefaultDisplayName(displayName());
|
||||||
}
|
}
|
||||||
|
@@ -38,9 +38,7 @@ class BareMetalGdbCommandsDeployStep : public ProjectExplorer::BuildStep
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BareMetalGdbCommandsDeployStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
|
explicit BareMetalGdbCommandsDeployStep(ProjectExplorer::BuildStepList *bsl);
|
||||||
BareMetalGdbCommandsDeployStep(ProjectExplorer::BuildStepList *bsl,
|
|
||||||
BareMetalGdbCommandsDeployStep *other);
|
|
||||||
|
|
||||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||||
void run(QFutureInterface<bool> &fi) override;
|
void run(QFutureInterface<bool> &fi) override;
|
||||||
@@ -58,7 +56,6 @@ public:
|
|||||||
QString gdbCommands() const;
|
QString gdbCommands() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
|
||||||
QString m_gdbCommands;
|
QString m_gdbCommands;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -45,19 +45,8 @@ namespace Internal {
|
|||||||
const char ProFileKey[] = "Qt4ProjectManager.MaemoRunConfiguration.ProFile";
|
const char ProFileKey[] = "Qt4ProjectManager.MaemoRunConfiguration.ProFile";
|
||||||
const char WorkingDirectoryKey[] = "BareMetal.RunConfig.WorkingDirectory";
|
const char WorkingDirectoryKey[] = "BareMetal.RunConfig.WorkingDirectory";
|
||||||
|
|
||||||
static QString pathFromId(Core::Id id)
|
|
||||||
{
|
|
||||||
if (id == BareMetalCustomRunConfiguration::runConfigId())
|
|
||||||
return QString();
|
|
||||||
|
|
||||||
QByteArray idStr = id.name();
|
|
||||||
if (!idStr.startsWith(BareMetalRunConfiguration::IdPrefix))
|
|
||||||
return QString();
|
|
||||||
return QString::fromUtf8(idStr.mid(int(strlen(BareMetalRunConfiguration::IdPrefix))));
|
|
||||||
}
|
|
||||||
|
|
||||||
BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target)
|
BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target)
|
||||||
: RunConfiguration(target)
|
: RunConfiguration(target, IdPrefix)
|
||||||
{
|
{
|
||||||
addExtraAspect(new ArgumentsAspect(this, "Qt4ProjectManager.MaemoRunConfiguration.Arguments"));
|
addExtraAspect(new ArgumentsAspect(this, "Qt4ProjectManager.MaemoRunConfiguration.Arguments"));
|
||||||
connect(target, &Target::deploymentDataChanged,
|
connect(target, &Target::deploymentDataChanged,
|
||||||
@@ -68,17 +57,9 @@ BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target)
|
|||||||
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated); // Handles device changes, etc.
|
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated); // Handles device changes, etc.
|
||||||
}
|
}
|
||||||
|
|
||||||
void BareMetalRunConfiguration::initialize(const Core::Id id)
|
QString BareMetalRunConfiguration::extraId() const
|
||||||
{
|
{
|
||||||
RunConfiguration::initialize(id);
|
return m_projectFilePath;
|
||||||
m_projectFilePath = pathFromId(id);
|
|
||||||
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BareMetalRunConfiguration::targetNameFromId(Core::Id id)
|
|
||||||
{
|
|
||||||
return QFileInfo(pathFromId(id)).fileName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *BareMetalRunConfiguration::createConfigurationWidget()
|
QWidget *BareMetalRunConfiguration::createConfigurationWidget()
|
||||||
@@ -110,8 +91,11 @@ bool BareMetalRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
= QDir::cleanPath(dir.filePath(map.value(QLatin1String(ProFileKey)).toString()));
|
= QDir::cleanPath(dir.filePath(map.value(QLatin1String(ProFileKey)).toString()));
|
||||||
m_workingDirectory = map.value(QLatin1String(WorkingDirectoryKey)).toString();
|
m_workingDirectory = map.value(QLatin1String(WorkingDirectoryKey)).toString();
|
||||||
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
// Hack for old-style mangled ids. FIXME: Remove.
|
||||||
|
if (m_projectFilePath.isEmpty())
|
||||||
|
m_projectFilePath = ProjectExplorer::idFromMap(map).suffixAfter(id());
|
||||||
|
|
||||||
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,7 +57,6 @@ public:
|
|||||||
|
|
||||||
QString buildSystemTarget() const final;
|
QString buildSystemTarget() const final;
|
||||||
|
|
||||||
static QString targetNameFromId(Core::Id id);
|
|
||||||
static const char *IdPrefix;
|
static const char *IdPrefix;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -66,8 +65,9 @@ signals:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
QString extraId() const final;
|
||||||
|
|
||||||
QString defaultDisplayName();
|
QString defaultDisplayName();
|
||||||
void initialize(Core::Id id) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleBuildSystemDataUpdated();
|
void handleBuildSystemDataUpdated();
|
||||||
|
@@ -51,9 +51,6 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
#include <QHash>
|
|
||||||
#include <QInputDialog>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
@@ -63,10 +60,33 @@ namespace Internal {
|
|||||||
const char INITIAL_ARGUMENTS[] = "CMakeProjectManager.CMakeBuildConfiguration.InitialArgument"; // Obsolete since QtC 3.7
|
const char INITIAL_ARGUMENTS[] = "CMakeProjectManager.CMakeBuildConfiguration.InitialArgument"; // Obsolete since QtC 3.7
|
||||||
const char CONFIGURATION_KEY[] = "CMake.Configuration";
|
const char CONFIGURATION_KEY[] = "CMake.Configuration";
|
||||||
|
|
||||||
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) :
|
CMakeBuildConfiguration::CMakeBuildConfiguration(Target *parent)
|
||||||
BuildConfiguration(parent, Core::Id(Constants::CMAKE_BC_ID))
|
: BuildConfiguration(parent, Constants::CMAKE_BC_ID)
|
||||||
{
|
{
|
||||||
ctor();
|
CMakeProject *project = static_cast<CMakeProject *>(target()->project());
|
||||||
|
setBuildDirectory(shadowBuildDirectory(project->projectFilePath(),
|
||||||
|
target()->kit(),
|
||||||
|
displayName(), BuildConfiguration::Unknown));
|
||||||
|
connect(project, &Project::parsingFinished, this, &BuildConfiguration::enabledChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeBuildConfiguration::initialize(const BuildInfo *info)
|
||||||
|
{
|
||||||
|
BuildConfiguration::initialize(info);
|
||||||
|
|
||||||
|
BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
|
buildSteps->appendStep(new CMakeBuildStep(buildSteps));
|
||||||
|
|
||||||
|
BuildStepList *cleanSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||||
|
cleanSteps->appendStep(new CMakeBuildStep(cleanSteps));
|
||||||
|
|
||||||
|
if (info->buildDirectory.isEmpty()) {
|
||||||
|
CMakeProject *project = static_cast<CMakeProject *>(target()->project());
|
||||||
|
setBuildDirectory(CMakeBuildConfiguration::shadowBuildDirectory(project->projectFilePath(),
|
||||||
|
target()->kit(),
|
||||||
|
info->displayName, info->buildType));
|
||||||
|
}
|
||||||
|
setConfigurationForCMake(static_cast<const CMakeBuildInfo *>(info)->configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeBuildConfiguration::isEnabled() const
|
bool CMakeBuildConfiguration::isEnabled() const
|
||||||
@@ -79,15 +99,6 @@ QString CMakeBuildConfiguration::disabledReason() const
|
|||||||
return error();
|
return error();
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent,
|
|
||||||
CMakeBuildConfiguration *source) :
|
|
||||||
BuildConfiguration(parent, source),
|
|
||||||
m_configurationForCMake(source->m_configurationForCMake)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
cloneSteps(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap CMakeBuildConfiguration::toMap() const
|
QVariantMap CMakeBuildConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map(ProjectExplorer::BuildConfiguration::toMap());
|
QVariantMap map(ProjectExplorer::BuildConfiguration::toMap());
|
||||||
@@ -128,15 +139,6 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildConfiguration::ctor()
|
|
||||||
{
|
|
||||||
auto p = static_cast<CMakeProject *>(project());
|
|
||||||
setBuildDirectory(shadowBuildDirectory(p->projectFilePath(),
|
|
||||||
target()->kit(),
|
|
||||||
displayName(), BuildConfiguration::Unknown));
|
|
||||||
connect(p, &Project::parsingFinished, this, &BuildConfiguration::enabledChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CMakeBuildConfiguration::isParsing() const
|
bool CMakeBuildConfiguration::isParsing() const
|
||||||
{
|
{
|
||||||
return project()->isParsing() && isActive();
|
return project()->isParsing() && isActive();
|
||||||
@@ -331,9 +333,12 @@ ProjectExplorer::NamedWidget *CMakeBuildConfiguration::createConfigWidget()
|
|||||||
\class CMakeBuildConfigurationFactory
|
\class CMakeBuildConfigurationFactory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CMakeBuildConfigurationFactory::CMakeBuildConfigurationFactory(QObject *parent) :
|
CMakeBuildConfigurationFactory::CMakeBuildConfigurationFactory()
|
||||||
ProjectExplorer::IBuildConfigurationFactory(parent)
|
{
|
||||||
{ }
|
registerBuildConfiguration<CMakeBuildConfiguration>(Constants::CMAKE_BC_ID);
|
||||||
|
setSupportedProjectType(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
|
||||||
|
setSupportedProjectMimeTypeName(Constants::CMAKEPROJECTMIMETYPE);
|
||||||
|
}
|
||||||
|
|
||||||
CMakeBuildConfigurationFactory::BuildType CMakeBuildConfigurationFactory::buildTypeFromByteArray(const QByteArray &in)
|
CMakeBuildConfigurationFactory::BuildType CMakeBuildConfigurationFactory::buildTypeFromByteArray(const QByteArray &in)
|
||||||
{
|
{
|
||||||
@@ -362,11 +367,6 @@ BuildConfiguration::BuildType CMakeBuildConfigurationFactory::cmakeBuildTypeToBu
|
|||||||
return BuildConfiguration::Unknown;
|
return BuildConfiguration::Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Target *parent) const
|
|
||||||
{
|
|
||||||
return canHandle(parent) ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBuilds(const ProjectExplorer::Target *parent) const
|
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBuilds(const ProjectExplorer::Target *parent) const
|
||||||
{
|
{
|
||||||
QList<ProjectExplorer::BuildInfo *> result;
|
QList<ProjectExplorer::BuildInfo *> result;
|
||||||
@@ -380,13 +380,6 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBui
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
|
||||||
{
|
|
||||||
if (k && Utils::mimeTypeForFile(projectPath).matchesName(Constants::CMAKEPROJECTMIMETYPE))
|
|
||||||
return 0;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k,
|
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k,
|
||||||
const QString &projectPath) const
|
const QString &projectPath) const
|
||||||
{
|
{
|
||||||
@@ -410,82 +403,6 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSet
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer::Target *parent,
|
|
||||||
const ProjectExplorer::BuildInfo *info) const
|
|
||||||
{
|
|
||||||
QTC_ASSERT(info->factory() == this, return nullptr);
|
|
||||||
QTC_ASSERT(info->kitId == parent->kit()->id(), return nullptr);
|
|
||||||
QTC_ASSERT(!info->displayName.isEmpty(), return nullptr);
|
|
||||||
|
|
||||||
CMakeBuildInfo copy(*static_cast<const CMakeBuildInfo *>(info));
|
|
||||||
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
|
||||||
|
|
||||||
if (copy.buildDirectory.isEmpty()) {
|
|
||||||
copy.buildDirectory
|
|
||||||
= CMakeBuildConfiguration::shadowBuildDirectory(project->projectFilePath(),
|
|
||||||
parent->kit(),
|
|
||||||
copy.displayName, info->buildType);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto bc = new CMakeBuildConfiguration(parent);
|
|
||||||
bc->setDisplayName(copy.displayName);
|
|
||||||
bc->setDefaultDisplayName(copy.displayName);
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
||||||
ProjectExplorer::BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
|
||||||
|
|
||||||
auto buildStep = new CMakeBuildStep(buildSteps);
|
|
||||||
buildSteps->insertStep(0, buildStep);
|
|
||||||
|
|
||||||
auto cleanStep = new CMakeBuildStep(cleanSteps);
|
|
||||||
cleanSteps->insertStep(0, cleanStep);
|
|
||||||
|
|
||||||
bc->setBuildDirectory(copy.buildDirectory);
|
|
||||||
bc->setConfigurationForCMake(copy.configuration);
|
|
||||||
|
|
||||||
return bc;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CMakeBuildConfigurationFactory::canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const
|
|
||||||
{
|
|
||||||
if (!canHandle(parent))
|
|
||||||
return false;
|
|
||||||
return source->id() == Constants::CMAKE_BC_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
CMakeBuildConfiguration *CMakeBuildConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source)
|
|
||||||
{
|
|
||||||
if (!canClone(parent, source))
|
|
||||||
return nullptr;
|
|
||||||
auto old = static_cast<CMakeBuildConfiguration *>(source);
|
|
||||||
return new CMakeBuildConfiguration(parent, old);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CMakeBuildConfigurationFactory::canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const
|
|
||||||
{
|
|
||||||
if (!canHandle(parent))
|
|
||||||
return false;
|
|
||||||
return ProjectExplorer::idFromMap(map) == Constants::CMAKE_BC_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
CMakeBuildConfiguration *CMakeBuildConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
|
||||||
{
|
|
||||||
if (!canRestore(parent, map))
|
|
||||||
return nullptr;
|
|
||||||
auto bc = std::make_unique<CMakeBuildConfiguration>(parent);
|
|
||||||
if (bc->fromMap(map))
|
|
||||||
return bc.release();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CMakeBuildConfigurationFactory::canHandle(const ProjectExplorer::Target *t) const
|
|
||||||
{
|
|
||||||
QTC_ASSERT(t, return false);
|
|
||||||
if (!t->project()->supportsKit(t->kit()))
|
|
||||||
return false;
|
|
||||||
return qobject_cast<CMakeProject *>(t->project());
|
|
||||||
}
|
|
||||||
|
|
||||||
CMakeBuildInfo *CMakeBuildConfigurationFactory::createBuildInfo(const ProjectExplorer::Kit *k,
|
CMakeBuildInfo *CMakeBuildConfigurationFactory::createBuildInfo(const ProjectExplorer::Kit *k,
|
||||||
const QString &sourceDir,
|
const QString &sourceDir,
|
||||||
BuildType buildType) const
|
BuildType buildType) const
|
||||||
|
@@ -32,11 +32,6 @@
|
|||||||
#include <cpptools/cpprawprojectpart.h>
|
#include <cpptools/cpprawprojectpart.h>
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/abi.h>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace ProjectExplorer { class ToolChain; }
|
|
||||||
|
|
||||||
namespace CMakeProjectManager {
|
namespace CMakeProjectManager {
|
||||||
class CMakeBuildInfo;
|
class CMakeBuildInfo;
|
||||||
@@ -45,27 +40,19 @@ class CMakeProject;
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BuildDirManager;
|
class BuildDirManager;
|
||||||
class CMakeBuildConfigurationFactory;
|
|
||||||
class CMakeBuildSettingsWidget;
|
class CMakeBuildSettingsWidget;
|
||||||
class CMakeProjectNode;
|
|
||||||
|
|
||||||
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
friend class ProjectExplorer::IBuildConfigurationFactory;
|
||||||
|
explicit CMakeBuildConfiguration(ProjectExplorer::Target *parent);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMakeBuildConfiguration(ProjectExplorer::Target *parent);
|
void emitBuildTypeChanged();
|
||||||
|
|
||||||
bool isEnabled() const override;
|
bool isEnabled() const override;
|
||||||
QString disabledReason() const override;
|
|
||||||
|
|
||||||
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
|
||||||
|
|
||||||
QVariantMap toMap() const override;
|
|
||||||
|
|
||||||
BuildType buildType() const override;
|
|
||||||
|
|
||||||
void emitBuildTypeChanged();
|
|
||||||
|
|
||||||
CMakeConfig configurationForCMake() const;
|
CMakeConfig configurationForCMake() const;
|
||||||
CMakeConfig configurationFromCMake() const;
|
CMakeConfig configurationFromCMake() const;
|
||||||
@@ -88,12 +75,16 @@ signals:
|
|||||||
|
|
||||||
void configurationForCMakeChanged();
|
void configurationForCMakeChanged();
|
||||||
|
|
||||||
protected:
|
|
||||||
CMakeBuildConfiguration(ProjectExplorer::Target *parent, CMakeBuildConfiguration *source);
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
QVariantMap toMap() const override;
|
||||||
|
BuildType buildType() const override;
|
||||||
|
|
||||||
|
void initialize(const ProjectExplorer::BuildInfo *info) override;
|
||||||
|
QString disabledReason() const override;
|
||||||
|
|
||||||
|
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
||||||
|
|
||||||
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
bool isParsing() const;
|
bool isParsing() const;
|
||||||
|
|
||||||
@@ -115,7 +106,6 @@ private:
|
|||||||
CMakeConfig m_configurationFromCMake;
|
CMakeConfig m_configurationFromCMake;
|
||||||
QList<CMakeBuildTarget> m_buildTargets;
|
QList<CMakeBuildTarget> m_buildTargets;
|
||||||
|
|
||||||
friend class CMakeBuildConfigurationFactory;
|
|
||||||
friend class CMakeBuildSettingsWidget;
|
friend class CMakeBuildSettingsWidget;
|
||||||
friend class CMakeProjectManager::CMakeProject;
|
friend class CMakeProjectManager::CMakeProject;
|
||||||
friend class BuildDirManager;
|
friend class BuildDirManager;
|
||||||
@@ -128,7 +118,7 @@ class CMakeBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurati
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMakeBuildConfigurationFactory(QObject *parent = 0);
|
CMakeBuildConfigurationFactory();
|
||||||
|
|
||||||
enum BuildType { BuildTypeNone = 0,
|
enum BuildType { BuildTypeNone = 0,
|
||||||
BuildTypeDebug = 1,
|
BuildTypeDebug = 1,
|
||||||
@@ -139,22 +129,11 @@ public:
|
|||||||
static BuildType buildTypeFromByteArray(const QByteArray &in);
|
static BuildType buildTypeFromByteArray(const QByteArray &in);
|
||||||
static ProjectExplorer::BuildConfiguration::BuildType cmakeBuildTypeToBuildType(const BuildType &in);
|
static ProjectExplorer::BuildConfiguration::BuildType cmakeBuildTypeToBuildType(const BuildType &in);
|
||||||
|
|
||||||
int priority(const ProjectExplorer::Target *parent) const override;
|
|
||||||
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
||||||
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
|
|
||||||
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
||||||
const QString &projectPath) const override;
|
const QString &projectPath) const override;
|
||||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
|
||||||
const ProjectExplorer::BuildInfo *info) const override;
|
|
||||||
|
|
||||||
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const override;
|
|
||||||
CMakeBuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) override;
|
|
||||||
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const override;
|
|
||||||
CMakeBuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool canHandle(const ProjectExplorer::Target *t) const;
|
|
||||||
|
|
||||||
CMakeBuildInfo *createBuildInfo(const ProjectExplorer::Kit *k,
|
CMakeBuildInfo *createBuildInfo(const ProjectExplorer::Kit *k,
|
||||||
const QString &sourceDir,
|
const QString &sourceDir,
|
||||||
BuildType buildType) const;
|
BuildType buildType) const;
|
||||||
|
@@ -75,25 +75,7 @@ static bool isCurrentExecutableTarget(const QString &target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl) :
|
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl) :
|
||||||
AbstractProcessStep(bsl, Core::Id(Constants::CMAKE_BUILD_STEP_ID))
|
AbstractProcessStep(bsl, Constants::CMAKE_BUILD_STEP_ID)
|
||||||
{
|
|
||||||
ctor(bsl);
|
|
||||||
}
|
|
||||||
|
|
||||||
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Core::Id id) : AbstractProcessStep(bsl, id)
|
|
||||||
{
|
|
||||||
ctor(bsl);
|
|
||||||
}
|
|
||||||
|
|
||||||
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, CMakeBuildStep *bs) :
|
|
||||||
AbstractProcessStep(bsl, bs),
|
|
||||||
m_buildTarget(bs->m_buildTarget),
|
|
||||||
m_toolArguments(bs->m_toolArguments)
|
|
||||||
{
|
|
||||||
ctor(bsl);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMakeBuildStep::ctor(BuildStepList *bsl)
|
|
||||||
{
|
{
|
||||||
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
||||||
m_ninjaProgress = QRegExp("^\\[\\s*(\\d*)/\\s*(\\d*)");
|
m_ninjaProgress = QRegExp("^\\[\\s*(\\d*)/\\s*(\\d*)");
|
||||||
@@ -586,27 +568,12 @@ QString CMakeBuildStepConfigWidget::summaryText() const
|
|||||||
// CMakeBuildStepFactory
|
// CMakeBuildStepFactory
|
||||||
//
|
//
|
||||||
|
|
||||||
CMakeBuildStepFactory::CMakeBuildStepFactory(QObject *parent) : IBuildStepFactory(parent)
|
CMakeBuildStepFactory::CMakeBuildStepFactory()
|
||||||
{ }
|
|
||||||
|
|
||||||
QList<BuildStepInfo> CMakeBuildStepFactory::availableSteps(BuildStepList *parent) const
|
|
||||||
{
|
{
|
||||||
if (parent->target()->project()->id() != Constants::CMAKEPROJECT_ID)
|
registerStep<CMakeBuildStep>(Constants::CMAKE_BUILD_STEP_ID);
|
||||||
return {};
|
setDisplayName(tr("Build", "Display name for CMakeProjectManager::CMakeBuildStep id."));
|
||||||
|
setSupportedProjectType(Constants::CMAKEPROJECT_ID);
|
||||||
return {{Constants::CMAKE_BUILD_STEP_ID,
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
tr("Build", "Display name for CMakeProjectManager::CMakeBuildStep id.")}};
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *CMakeBuildStepFactory::create(BuildStepList *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
Q_UNUSED(id);
|
|
||||||
return new CMakeBuildStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *CMakeBuildStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
|
||||||
{
|
|
||||||
return new CMakeBuildStep(parent, static_cast<CMakeBuildStep *>(source));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildStep::processStarted()
|
void CMakeBuildStep::processStarted()
|
||||||
|
@@ -92,9 +92,6 @@ protected:
|
|||||||
void processStarted() override;
|
void processStarted() override;
|
||||||
void processFinished(int exitCode, QProcess::ExitStatus status) override;
|
void processFinished(int exitCode, QProcess::ExitStatus status) override;
|
||||||
|
|
||||||
CMakeBuildStep(ProjectExplorer::BuildStepList *bsl, CMakeBuildStep *bs);
|
|
||||||
CMakeBuildStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
|
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
// For parsing [ 76%]
|
// For parsing [ 76%]
|
||||||
@@ -140,18 +137,12 @@ private:
|
|||||||
QString m_summaryText;
|
QString m_summaryText;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory
|
class CMakeBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CMakeBuildStepFactory(QObject *parent = 0);
|
CMakeBuildStepFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -63,7 +63,7 @@ const char TITLE_KEY[] = "CMakeProjectManager.CMakeRunConfiguation.Title";
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
CMakeRunConfiguration::CMakeRunConfiguration(Target *target)
|
CMakeRunConfiguration::CMakeRunConfiguration(Target *target)
|
||||||
: RunConfiguration(target)
|
: RunConfiguration(target, CMAKE_RC_PREFIX)
|
||||||
{
|
{
|
||||||
// Workaround for QTCREATORBUG-19354:
|
// Workaround for QTCREATORBUG-19354:
|
||||||
auto cmakeRunEnvironmentModifier = [](RunConfiguration *rc, Utils::Environment &env) {
|
auto cmakeRunEnvironmentModifier = [](RunConfiguration *rc, Utils::Environment &env) {
|
||||||
@@ -81,23 +81,9 @@ CMakeRunConfiguration::CMakeRunConfiguration(Target *target)
|
|||||||
addExtraAspect(new WorkingDirectoryAspect(this, "CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"));
|
addExtraAspect(new WorkingDirectoryAspect(this, "CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeRunConfiguration::initialize(Core::Id id)
|
QString CMakeRunConfiguration::extraId() const
|
||||||
{
|
{
|
||||||
RunConfiguration::initialize(id);
|
return m_buildSystemTarget;
|
||||||
QString executable = id.suffixAfter(CMAKE_RC_PREFIX);
|
|
||||||
|
|
||||||
CMakeProject *project = static_cast<CMakeProject *>(target()->project());
|
|
||||||
|
|
||||||
m_buildSystemTarget = executable;
|
|
||||||
m_executable = executable;
|
|
||||||
|
|
||||||
if (!executable.isEmpty()) {
|
|
||||||
const CMakeBuildTarget ct = project->buildTargetForTitle(executable);
|
|
||||||
m_title = ct.title;
|
|
||||||
extraAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(ct.workingDirectory);
|
|
||||||
}
|
|
||||||
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Runnable CMakeRunConfiguration::runnable() const
|
Runnable CMakeRunConfiguration::runnable() const
|
||||||
@@ -143,8 +129,26 @@ QVariantMap CMakeRunConfiguration::toMap() const
|
|||||||
|
|
||||||
bool CMakeRunConfiguration::fromMap(const QVariantMap &map)
|
bool CMakeRunConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
|
RunConfiguration::fromMap(map);
|
||||||
|
|
||||||
m_title = map.value(QLatin1String(TITLE_KEY)).toString();
|
m_title = map.value(QLatin1String(TITLE_KEY)).toString();
|
||||||
return RunConfiguration::fromMap(map);
|
|
||||||
|
QString extraId = ProjectExplorer::idFromMap(map).suffixAfter(id());
|
||||||
|
|
||||||
|
if (!extraId.isEmpty()) {
|
||||||
|
m_buildSystemTarget = extraId;
|
||||||
|
m_executable = extraId;
|
||||||
|
if (m_title.isEmpty())
|
||||||
|
m_title = extraId;
|
||||||
|
|
||||||
|
CMakeProject *project = static_cast<CMakeProject *>(target()->project());
|
||||||
|
const CMakeBuildTarget ct = project->buildTargetForTitle(m_title);
|
||||||
|
extraAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(ct.workingDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeRunConfiguration::defaultDisplayName() const
|
QString CMakeRunConfiguration::defaultDisplayName() const
|
||||||
|
@@ -44,7 +44,6 @@ public:
|
|||||||
|
|
||||||
void setExecutable(const QString &executable);
|
void setExecutable(const QString &executable);
|
||||||
void setBaseWorkingDirectory(const Utils::FileName &workingDirectory);
|
void setBaseWorkingDirectory(const Utils::FileName &workingDirectory);
|
||||||
|
|
||||||
QString title() const;
|
QString title() const;
|
||||||
|
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
@@ -55,13 +54,12 @@ public:
|
|||||||
|
|
||||||
Utils::OutputFormatter *createOutputFormatter() const final;
|
Utils::OutputFormatter *createOutputFormatter() const final;
|
||||||
|
|
||||||
void initialize(Core::Id id) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QString defaultDisplayName() const;
|
QString defaultDisplayName() const;
|
||||||
|
|
||||||
void updateEnabledState() final;
|
void updateEnabledState() final;
|
||||||
|
QString extraId() const final;
|
||||||
|
|
||||||
QString baseWorkingDirectory() const;
|
QString baseWorkingDirectory() const;
|
||||||
|
|
||||||
|
@@ -55,21 +55,21 @@ namespace Internal {
|
|||||||
const char GENERIC_BC_ID[] = "GenericProjectManager.GenericBuildConfiguration";
|
const char GENERIC_BC_ID[] = "GenericProjectManager.GenericBuildConfiguration";
|
||||||
|
|
||||||
GenericBuildConfiguration::GenericBuildConfiguration(Target *parent)
|
GenericBuildConfiguration::GenericBuildConfiguration(Target *parent)
|
||||||
: BuildConfiguration(parent, Core::Id(GENERIC_BC_ID))
|
: BuildConfiguration(parent, GENERIC_BC_ID)
|
||||||
{
|
{
|
||||||
updateCacheAndEmitEnvironmentChanged();
|
updateCacheAndEmitEnvironmentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericBuildConfiguration::GenericBuildConfiguration(Target *parent, Core::Id id)
|
void GenericBuildConfiguration::initialize(const BuildInfo *info)
|
||||||
: BuildConfiguration(parent, id)
|
|
||||||
{
|
{
|
||||||
updateCacheAndEmitEnvironmentChanged();
|
BuildConfiguration::initialize(info);
|
||||||
}
|
|
||||||
|
BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
|
buildSteps->appendStep(new GenericMakeStep(buildSteps, "all"));
|
||||||
|
|
||||||
|
BuildStepList *cleanSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||||
|
cleanSteps->appendStep(new GenericMakeStep(cleanSteps, "clean"));
|
||||||
|
|
||||||
GenericBuildConfiguration::GenericBuildConfiguration(Target *parent, GenericBuildConfiguration *source) :
|
|
||||||
BuildConfiguration(parent, source)
|
|
||||||
{
|
|
||||||
cloneSteps(source);
|
|
||||||
updateCacheAndEmitEnvironmentChanged();
|
updateCacheAndEmitEnvironmentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,33 +82,20 @@ NamedWidget *GenericBuildConfiguration::createConfigWidget()
|
|||||||
\class GenericBuildConfigurationFactory
|
\class GenericBuildConfigurationFactory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GenericBuildConfigurationFactory::GenericBuildConfigurationFactory(QObject *parent) :
|
GenericBuildConfigurationFactory::GenericBuildConfigurationFactory()
|
||||||
IBuildConfigurationFactory(parent)
|
|
||||||
{
|
{
|
||||||
|
registerBuildConfiguration<GenericBuildConfiguration>(GENERIC_BC_ID);
|
||||||
|
setSupportedProjectType(Constants::GENERICPROJECT_ID);
|
||||||
|
setSupportedProjectMimeTypeName(Constants::GENERICMIMETYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericBuildConfigurationFactory::~GenericBuildConfigurationFactory()
|
GenericBuildConfigurationFactory::~GenericBuildConfigurationFactory()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int GenericBuildConfigurationFactory::priority(const Target *parent) const
|
|
||||||
{
|
|
||||||
return canHandle(parent) ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<BuildInfo *> GenericBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
QList<BuildInfo *> GenericBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
||||||
{
|
{
|
||||||
QList<BuildInfo *> result;
|
return {createBuildInfo(parent->kit(), parent->project()->projectDirectory())};
|
||||||
BuildInfo *info = createBuildInfo(parent->kit(), parent->project()->projectDirectory());
|
|
||||||
result << info;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GenericBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
|
||||||
{
|
|
||||||
if (k && Utils::mimeTypeForFile(projectPath).matchesName(Constants::GENERICMIMETYPE))
|
|
||||||
return 0;
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildInfo *> GenericBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
QList<BuildInfo *> GenericBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||||
@@ -121,73 +108,6 @@ QList<BuildInfo *> GenericBuildConfigurationFactory::availableSetups(const Kit *
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildConfiguration *GenericBuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
|
||||||
{
|
|
||||||
QTC_ASSERT(info->factory() == this, return 0);
|
|
||||||
QTC_ASSERT(info->kitId == parent->kit()->id(), return 0);
|
|
||||||
QTC_ASSERT(!info->displayName.isEmpty(), return 0);
|
|
||||||
|
|
||||||
auto bc = new GenericBuildConfiguration(parent);
|
|
||||||
bc->setDisplayName(info->displayName);
|
|
||||||
bc->setDefaultDisplayName(info->displayName);
|
|
||||||
bc->setBuildDirectory(info->buildDirectory);
|
|
||||||
|
|
||||||
BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
||||||
BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
|
||||||
|
|
||||||
Q_ASSERT(buildSteps);
|
|
||||||
auto makeStep = new GenericMakeStep(buildSteps);
|
|
||||||
buildSteps->insertStep(0, makeStep);
|
|
||||||
makeStep->setBuildTarget("all", /* on = */ true);
|
|
||||||
|
|
||||||
Q_ASSERT(cleanSteps);
|
|
||||||
auto cleanMakeStep = new GenericMakeStep(cleanSteps);
|
|
||||||
cleanSteps->insertStep(0, cleanMakeStep);
|
|
||||||
cleanMakeStep->setBuildTarget("clean", /* on = */ true);
|
|
||||||
cleanMakeStep->setClean(true);
|
|
||||||
|
|
||||||
return bc;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GenericBuildConfigurationFactory::canClone(const Target *parent, BuildConfiguration *source) const
|
|
||||||
{
|
|
||||||
if (!canHandle(parent))
|
|
||||||
return false;
|
|
||||||
return source->id() == GENERIC_BC_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *GenericBuildConfigurationFactory::clone(Target *parent, BuildConfiguration *source)
|
|
||||||
{
|
|
||||||
if (!canClone(parent, source))
|
|
||||||
return 0;
|
|
||||||
return new GenericBuildConfiguration(parent, qobject_cast<GenericBuildConfiguration *>(source));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GenericBuildConfigurationFactory::canRestore(const Target *parent, const QVariantMap &map) const
|
|
||||||
{
|
|
||||||
if (!canHandle(parent))
|
|
||||||
return false;
|
|
||||||
return ProjectExplorer::idFromMap(map) == GENERIC_BC_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *GenericBuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
|
||||||
{
|
|
||||||
if (!canRestore(parent, map))
|
|
||||||
return 0;
|
|
||||||
auto bc = new GenericBuildConfiguration(parent);
|
|
||||||
if (bc->fromMap(map))
|
|
||||||
return bc;
|
|
||||||
delete bc;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GenericBuildConfigurationFactory::canHandle(const Target *t) const
|
|
||||||
{
|
|
||||||
if (!t->project()->supportsKit(t->kit()))
|
|
||||||
return false;
|
|
||||||
return qobject_cast<GenericProject *>(t->project());
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildInfo *GenericBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
BuildInfo *GenericBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||||
const Utils::FileName &buildDir) const
|
const Utils::FileName &buildDir) const
|
||||||
{
|
{
|
||||||
|
@@ -36,29 +36,17 @@ class PathChooser;
|
|||||||
namespace GenericProjectManager {
|
namespace GenericProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class GenericTarget;
|
|
||||||
class GenericBuildConfigurationFactory;
|
|
||||||
class GenericBuildSettingsWidget;
|
|
||||||
|
|
||||||
class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class GenericBuildConfigurationFactory;
|
|
||||||
|
|
||||||
public:
|
friend class ProjectExplorer::IBuildConfigurationFactory;
|
||||||
explicit GenericBuildConfiguration(ProjectExplorer::Target *parent);
|
explicit GenericBuildConfiguration(ProjectExplorer::Target *parent);
|
||||||
|
|
||||||
|
void initialize(const ProjectExplorer::BuildInfo *info) override;
|
||||||
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
||||||
|
|
||||||
BuildType buildType() const override;
|
BuildType buildType() const override;
|
||||||
|
|
||||||
void addToEnvironment(Utils::Environment &env) const final;
|
void addToEnvironment(Utils::Environment &env) const final;
|
||||||
|
|
||||||
protected:
|
|
||||||
GenericBuildConfiguration(ProjectExplorer::Target *parent, GenericBuildConfiguration *source);
|
|
||||||
GenericBuildConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
|
||||||
|
|
||||||
friend class GenericBuildSettingsWidget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GenericBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
class GenericBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
||||||
@@ -66,24 +54,14 @@ class GenericBuildConfigurationFactory : public ProjectExplorer::IBuildConfigura
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GenericBuildConfigurationFactory(QObject *parent = nullptr);
|
GenericBuildConfigurationFactory();
|
||||||
~GenericBuildConfigurationFactory();
|
~GenericBuildConfigurationFactory();
|
||||||
|
|
||||||
int priority(const ProjectExplorer::Target *parent) const override;
|
private:
|
||||||
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
||||||
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
|
|
||||||
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
||||||
const QString &projectPath) const override;
|
const QString &projectPath) const override;
|
||||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
|
||||||
const ProjectExplorer::BuildInfo *info) const override;
|
|
||||||
|
|
||||||
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const override;
|
|
||||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) override;
|
|
||||||
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const override;
|
|
||||||
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool canHandle(const ProjectExplorer::Target *t) const;
|
|
||||||
ProjectExplorer::BuildInfo *createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FileName &buildDir) const;
|
ProjectExplorer::BuildInfo *createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FileName &buildDir) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -61,32 +61,12 @@ const char MAKE_ARGUMENTS_KEY[] = "GenericProjectManager.GenericMakeStep.MakeArg
|
|||||||
const char MAKE_COMMAND_KEY[] = "GenericProjectManager.GenericMakeStep.MakeCommand";
|
const char MAKE_COMMAND_KEY[] = "GenericProjectManager.GenericMakeStep.MakeCommand";
|
||||||
const char CLEAN_KEY[] = "GenericProjectManager.GenericMakeStep.Clean";
|
const char CLEAN_KEY[] = "GenericProjectManager.GenericMakeStep.Clean";
|
||||||
|
|
||||||
GenericMakeStep::GenericMakeStep(BuildStepList *parent) :
|
GenericMakeStep::GenericMakeStep(BuildStepList *parent, const QString &buildTarget)
|
||||||
AbstractProcessStep(parent, Id(GENERIC_MS_ID))
|
: AbstractProcessStep(parent, GENERIC_MS_ID)
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
GenericMakeStep::GenericMakeStep(BuildStepList *parent, const Id id) :
|
|
||||||
AbstractProcessStep(parent, id)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
GenericMakeStep::GenericMakeStep(BuildStepList *parent, GenericMakeStep *bs) :
|
|
||||||
AbstractProcessStep(parent, bs),
|
|
||||||
m_buildTargets(bs->m_buildTargets),
|
|
||||||
m_makeArguments(bs->m_makeArguments),
|
|
||||||
m_makeCommand(bs->m_makeCommand),
|
|
||||||
m_clean(bs->m_clean)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GenericMakeStep::ctor()
|
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(QCoreApplication::translate("GenericProjectManager::Internal::GenericMakeStep",
|
setDefaultDisplayName(QCoreApplication::translate("GenericProjectManager::Internal::GenericMakeStep",
|
||||||
GENERIC_MS_DISPLAY_NAME));
|
GENERIC_MS_DISPLAY_NAME));
|
||||||
|
setBuildTarget(buildTarget, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GenericMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
bool GenericMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
||||||
@@ -324,42 +304,46 @@ void GenericMakeStepConfigWidget::makeArgumentsLineEditTextEdited()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// GenericMakeStepFactory
|
// GenericMakeAllStepFactory
|
||||||
//
|
//
|
||||||
|
|
||||||
GenericMakeStepFactory::GenericMakeStepFactory(QObject *parent) :
|
GenericMakeAllStepFactory::GenericMakeAllStepFactory()
|
||||||
IBuildStepFactory(parent)
|
|
||||||
{
|
{
|
||||||
|
struct Step : GenericMakeStep
|
||||||
|
{
|
||||||
|
Step(BuildStepList *bsl) : GenericMakeStep(bsl)
|
||||||
|
{
|
||||||
|
setBuildTarget("all", true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
registerStep<Step>(GENERIC_MS_ID);
|
||||||
|
setDisplayName(QCoreApplication::translate(
|
||||||
|
"GenericProjectManager::Internal::GenericMakeStep", GENERIC_MS_DISPLAY_NAME));
|
||||||
|
setSupportedProjectType(Constants::GENERICPROJECT_ID);
|
||||||
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildStepInfo> GenericMakeStepFactory::availableSteps(BuildStepList *parent) const
|
//
|
||||||
{
|
// GenericMakeCleanStepFactory
|
||||||
if (parent->target()->project()->id() != Constants::GENERICPROJECT_ID)
|
//
|
||||||
return {};
|
|
||||||
|
|
||||||
return {{GENERIC_MS_ID,
|
GenericMakeCleanStepFactory::GenericMakeCleanStepFactory()
|
||||||
QCoreApplication::translate("GenericProjectManager::Internal::GenericMakeStep",
|
|
||||||
GENERIC_MS_DISPLAY_NAME)}};
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *GenericMakeStepFactory::create(BuildStepList *parent, const Id id)
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(id)
|
struct Step : GenericMakeStep
|
||||||
auto step = new GenericMakeStep(parent);
|
|
||||||
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
|
|
||||||
step->setClean(true);
|
|
||||||
step->setBuildTarget("clean", /* on = */ true);
|
|
||||||
} else if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_BUILD) {
|
|
||||||
step->setBuildTarget("all", /* on = */ true);
|
|
||||||
}
|
|
||||||
return step;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *GenericMakeStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
|
||||||
{
|
{
|
||||||
auto old = qobject_cast<GenericMakeStep *>(source);
|
Step(BuildStepList *bsl) : GenericMakeStep(bsl)
|
||||||
Q_ASSERT(old);
|
{
|
||||||
return new GenericMakeStep(parent, old);
|
setBuildTarget("clean", true);
|
||||||
|
setClean(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
registerStep<Step>(GENERIC_MS_ID);
|
||||||
|
setDisplayName(QCoreApplication::translate(
|
||||||
|
"GenericProjectManager::Internal::GenericMakeStep", GENERIC_MS_DISPLAY_NAME));
|
||||||
|
setSupportedProjectType(Constants::GENERICPROJECT_ID);
|
||||||
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -33,7 +33,6 @@ namespace GenericProjectManager {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class GenericMakeStepConfigWidget;
|
class GenericMakeStepConfigWidget;
|
||||||
class GenericMakeStepFactory;
|
|
||||||
|
|
||||||
namespace Ui { class GenericMakeStep; }
|
namespace Ui { class GenericMakeStep; }
|
||||||
|
|
||||||
@@ -42,10 +41,9 @@ class GenericMakeStep : public ProjectExplorer::AbstractProcessStep
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
friend class GenericMakeStepConfigWidget;
|
friend class GenericMakeStepConfigWidget;
|
||||||
friend class GenericMakeStepFactory;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GenericMakeStep(ProjectExplorer::BuildStepList *parent);
|
explicit GenericMakeStep(ProjectExplorer::BuildStepList *parent, const QString &buildTarget = {});
|
||||||
|
|
||||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||||
void run(QFutureInterface<bool> &fi) override;
|
void run(QFutureInterface<bool> &fi) override;
|
||||||
@@ -60,15 +58,9 @@ public:
|
|||||||
void setClean(bool clean);
|
void setClean(bool clean);
|
||||||
bool isClean() const;
|
bool isClean() const;
|
||||||
|
|
||||||
QVariantMap toMap() const override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
GenericMakeStep(ProjectExplorer::BuildStepList *parent, GenericMakeStep *bs);
|
|
||||||
GenericMakeStep(ProjectExplorer::BuildStepList *parent, Core::Id id);
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
QVariantMap toMap() const override;
|
||||||
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
QStringList m_buildTargets;
|
QStringList m_buildTargets;
|
||||||
QString m_makeArguments;
|
QString m_makeArguments;
|
||||||
@@ -99,19 +91,16 @@ private:
|
|||||||
QString m_summaryText;
|
QString m_summaryText;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GenericMakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
class GenericMakeAllStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GenericMakeStepFactory(QObject *parent = nullptr);
|
GenericMakeAllStepFactory();
|
||||||
|
};
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
class GenericMakeCleanStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
{
|
||||||
|
public:
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
GenericMakeCleanStepFactory();
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
|
|
||||||
ProjectExplorer::BuildStep *source) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -62,7 +62,8 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage
|
|||||||
ProjectManager::registerProjectType<GenericProject>(Constants::GENERICMIMETYPE);
|
ProjectManager::registerProjectType<GenericProject>(Constants::GENERICMIMETYPE);
|
||||||
|
|
||||||
addAutoReleasedObject(new ProjectFilesFactory);
|
addAutoReleasedObject(new ProjectFilesFactory);
|
||||||
addAutoReleasedObject(new GenericMakeStepFactory);
|
addAutoReleasedObject(new GenericMakeAllStepFactory);
|
||||||
|
addAutoReleasedObject(new GenericMakeCleanStepFactory);
|
||||||
addAutoReleasedObject(new GenericBuildConfigurationFactory);
|
addAutoReleasedObject(new GenericBuildConfigurationFactory);
|
||||||
|
|
||||||
IWizardFactory::registerFactoryCreator([]() { return QList<IWizardFactory *>() << new GenericProjectWizard; });
|
IWizardFactory::registerFactoryCreator([]() { return QList<IWizardFactory *>() << new GenericProjectWizard; });
|
||||||
|
@@ -32,12 +32,14 @@
|
|||||||
#include "projectexplorer/kitinformation.h"
|
#include "projectexplorer/kitinformation.h"
|
||||||
#include "projectexplorer/namedwidget.h"
|
#include "projectexplorer/namedwidget.h"
|
||||||
#include "projectexplorer/target.h"
|
#include "projectexplorer/target.h"
|
||||||
|
|
||||||
#include "qmakeprojectmanager/qmakebuildinfo.h"
|
#include "qmakeprojectmanager/qmakebuildinfo.h"
|
||||||
|
#include "qmakeprojectmanager/qmakeprojectmanagerconstants.h"
|
||||||
|
|
||||||
#include "utils/algorithm.h"
|
#include "utils/algorithm.h"
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
using namespace QmakeProjectManager;
|
using namespace QmakeProjectManager;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Ios {
|
namespace Ios {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -47,13 +49,8 @@ const char qmakeProvisioningProfileSettings[] = "QMAKE_MAC_XCODE_SETTINGS+=qprof
|
|||||||
const char signingIdentifierKey[] = "Ios.SigningIdentifier";
|
const char signingIdentifierKey[] = "Ios.SigningIdentifier";
|
||||||
const char autoManagedSigningKey[] = "Ios.AutoManagedSigning";
|
const char autoManagedSigningKey[] = "Ios.AutoManagedSigning";
|
||||||
|
|
||||||
IosBuildConfiguration::IosBuildConfiguration(ProjectExplorer::Target *target) :
|
IosBuildConfiguration::IosBuildConfiguration(Target *target)
|
||||||
QmakeBuildConfiguration(target)
|
: QmakeBuildConfiguration(target)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IosBuildConfiguration::IosBuildConfiguration(ProjectExplorer::Target *target, IosBuildConfiguration *source) :
|
|
||||||
QmakeBuildConfiguration(target, source)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,12 +140,11 @@ void IosBuildConfiguration::updateQmakeCommand()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IosBuildConfigurationFactory::IosBuildConfigurationFactory(QObject *parent)
|
IosBuildConfigurationFactory::IosBuildConfigurationFactory()
|
||||||
: QmakeBuildConfigurationFactory(parent)
|
|
||||||
{
|
{
|
||||||
|
registerBuildConfiguration<IosBuildConfiguration>(QmakeProjectManager::Constants::QMAKE_BC_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int IosBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
int IosBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
||||||
{
|
{
|
||||||
return (QmakeBuildConfigurationFactory::priority(k, projectPath) >= 0
|
return (QmakeBuildConfigurationFactory::priority(k, projectPath) >= 0
|
||||||
@@ -157,37 +153,10 @@ int IosBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const
|
|||||||
|
|
||||||
int IosBuildConfigurationFactory::priority(const ProjectExplorer::Target *parent) const
|
int IosBuildConfigurationFactory::priority(const ProjectExplorer::Target *parent) const
|
||||||
{
|
{
|
||||||
return (QmakeBuildConfigurationFactory::priority(parent) >= 0
|
return (IBuildConfigurationFactory::priority(parent) >= 0
|
||||||
&& IosManager::supportsIos(parent)) ? 1 : -1;
|
&& IosManager::supportsIos(parent)) ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *IosBuildConfigurationFactory::create(ProjectExplorer::Target *parent,
|
|
||||||
const ProjectExplorer::BuildInfo *info) const
|
|
||||||
{
|
|
||||||
auto qmakeInfo = static_cast<const QmakeBuildInfo *>(info);
|
|
||||||
auto bc = new IosBuildConfiguration(parent);
|
|
||||||
configureBuildConfiguration(parent, bc, qmakeInfo);
|
|
||||||
return bc;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *IosBuildConfigurationFactory::clone(ProjectExplorer::Target *parent,
|
|
||||||
ProjectExplorer::BuildConfiguration *source)
|
|
||||||
{
|
|
||||||
if (!canClone(parent, source))
|
|
||||||
return nullptr;
|
|
||||||
auto *oldbc = static_cast<IosBuildConfiguration *>(source);
|
|
||||||
return new IosBuildConfiguration(parent, oldbc);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *IosBuildConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
|
||||||
{
|
|
||||||
if (canRestore(parent, map)) {
|
|
||||||
std::unique_ptr<IosBuildConfiguration> bc(new IosBuildConfiguration(parent));
|
|
||||||
if (bc->fromMap(map))
|
|
||||||
return bc.release();
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Ios
|
} // namespace Ios
|
||||||
|
@@ -26,49 +26,35 @@
|
|||||||
|
|
||||||
#include "qmakeprojectmanager/qmakebuildconfiguration.h"
|
#include "qmakeprojectmanager/qmakebuildconfiguration.h"
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
|
||||||
class Target;
|
|
||||||
class Kit;
|
|
||||||
class NamedWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Ios {
|
namespace Ios {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class IosBuildConfiguration : public QmakeProjectManager::QmakeBuildConfiguration
|
class IosBuildConfiguration : public QmakeProjectManager::QmakeBuildConfiguration
|
||||||
{
|
{
|
||||||
friend class IosBuildConfigurationFactory;
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IosBuildConfiguration(ProjectExplorer::Target *target);
|
explicit IosBuildConfiguration(ProjectExplorer::Target *target);
|
||||||
IosBuildConfiguration(ProjectExplorer::Target *target, IosBuildConfiguration *source);
|
|
||||||
|
|
||||||
QList<ProjectExplorer::NamedWidget *> createSubConfigWidgets() override;
|
|
||||||
QVariantMap toMap() const override;
|
|
||||||
protected:
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QList<ProjectExplorer::NamedWidget *> createSubConfigWidgets() override;
|
||||||
|
QVariantMap toMap() const override;
|
||||||
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
void onSigningSettingsChanged(bool autoManagedSigning, QString identifier);
|
void onSigningSettingsChanged(bool autoManagedSigning, QString identifier);
|
||||||
void updateQmakeCommand();
|
void updateQmakeCommand();
|
||||||
|
|
||||||
private:
|
|
||||||
QString m_signingIdentifier;
|
QString m_signingIdentifier;
|
||||||
bool m_autoManagedSigning = true;
|
bool m_autoManagedSigning = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class IosBuildConfigurationFactory : public QmakeProjectManager::QmakeBuildConfigurationFactory
|
class IosBuildConfigurationFactory : public QmakeProjectManager::QmakeBuildConfigurationFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit IosBuildConfigurationFactory(QObject *parent = 0);
|
IosBuildConfigurationFactory();
|
||||||
|
|
||||||
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
|
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
|
||||||
int priority(const ProjectExplorer::Target *parent) const override;
|
int priority(const ProjectExplorer::Target *parent) const override;
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const ProjectExplorer::BuildInfo *info) const override;
|
|
||||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) override;
|
|
||||||
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -60,30 +60,14 @@ const char BUILD_ARGUMENTS_KEY[] = "Ios.IosBuildStep.XcodeArguments";
|
|||||||
const char CLEAN_KEY[] = "Ios.IosBuildStep.Clean";
|
const char CLEAN_KEY[] = "Ios.IosBuildStep.Clean";
|
||||||
|
|
||||||
IosBuildStep::IosBuildStep(BuildStepList *parent) :
|
IosBuildStep::IosBuildStep(BuildStepList *parent) :
|
||||||
AbstractProcessStep(parent, Id(IOS_BUILD_STEP_ID))
|
AbstractProcessStep(parent, IOS_BUILD_STEP_ID)
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
IosBuildStep::IosBuildStep(BuildStepList *parent, const Id id) :
|
|
||||||
AbstractProcessStep(parent, id)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
IosBuildStep::IosBuildStep(BuildStepList *parent, IosBuildStep *bs) :
|
|
||||||
AbstractProcessStep(parent, bs),
|
|
||||||
m_baseBuildArguments(bs->m_baseBuildArguments),
|
|
||||||
m_useDefaultArguments(bs->m_useDefaultArguments),
|
|
||||||
m_clean(bs->m_clean)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosBuildStep::ctor()
|
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(QCoreApplication::translate("GenericProjectManager::Internal::IosBuildStep",
|
setDefaultDisplayName(QCoreApplication::translate("GenericProjectManager::Internal::IosBuildStep",
|
||||||
IOS_BUILD_STEP_DISPLAY_NAME));
|
IOS_BUILD_STEP_DISPLAY_NAME));
|
||||||
|
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
|
||||||
|
m_clean = true;
|
||||||
|
setExtraArguments(QStringList("clean"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IosBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
bool IosBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
||||||
@@ -127,16 +111,6 @@ bool IosBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
return AbstractProcessStep::init(earlierSteps);
|
return AbstractProcessStep::init(earlierSteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosBuildStep::setClean(bool clean)
|
|
||||||
{
|
|
||||||
m_clean = clean;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IosBuildStep::isClean() const
|
|
||||||
{
|
|
||||||
return m_clean;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap IosBuildStep::toMap() const
|
QVariantMap IosBuildStep::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map(AbstractProcessStep::toMap());
|
QVariantMap map(AbstractProcessStep::toMap());
|
||||||
@@ -323,49 +297,20 @@ void IosBuildStepConfigWidget::extraArgumentsChanged()
|
|||||||
m_buildStep->setExtraArguments(Utils::QtcProcess::splitArgs(
|
m_buildStep->setExtraArguments(Utils::QtcProcess::splitArgs(
|
||||||
m_ui->extraArgumentsLineEdit->text()));
|
m_ui->extraArgumentsLineEdit->text()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// IosBuildStepFactory
|
// IosBuildStepFactory
|
||||||
//
|
//
|
||||||
|
|
||||||
IosBuildStepFactory::IosBuildStepFactory(QObject *parent) :
|
IosBuildStepFactory::IosBuildStepFactory()
|
||||||
IBuildStepFactory(parent)
|
|
||||||
{
|
{
|
||||||
}
|
registerStep<IosBuildStep>(IOS_BUILD_STEP_ID);
|
||||||
|
setSupportedDeviceTypes({Constants::IOS_DEVICE_TYPE,
|
||||||
BuildStep *IosBuildStepFactory::create(BuildStepList *parent, const Id id)
|
Constants::IOS_SIMULATOR_TYPE});
|
||||||
{
|
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_CLEAN,
|
||||||
Q_UNUSED(id);
|
ProjectExplorer::Constants::BUILDSTEPS_BUILD});
|
||||||
IosBuildStep *step = new IosBuildStep(parent);
|
setDisplayName(QCoreApplication::translate("GenericProjectManager::Internal::IosBuildStep",
|
||||||
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
|
IOS_BUILD_STEP_DISPLAY_NAME));
|
||||||
step->setClean(true);
|
|
||||||
step->setExtraArguments(QStringList("clean"));
|
|
||||||
} else if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_BUILD) {
|
|
||||||
// nomal setup
|
|
||||||
}
|
|
||||||
return step;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *IosBuildStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
|
||||||
{
|
|
||||||
IosBuildStep *old = qobject_cast<IosBuildStep *>(source);
|
|
||||||
Q_ASSERT(old);
|
|
||||||
return new IosBuildStep(parent, old);
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<BuildStepInfo> IosBuildStepFactory::availableSteps(BuildStepList *parent) const
|
|
||||||
{
|
|
||||||
Id deviceType = DeviceTypeKitInformation::deviceTypeId(parent->target()->kit());
|
|
||||||
if (deviceType != Constants::IOS_DEVICE_TYPE
|
|
||||||
&& deviceType != Constants::IOS_SIMULATOR_TYPE)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_CLEAN
|
|
||||||
&& parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return {{IOS_BUILD_STEP_ID,
|
|
||||||
QCoreApplication::translate("GenericProjectManager::Internal::IosBuildStep",
|
|
||||||
IOS_BUILD_STEP_DISPLAY_NAME)}};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -60,17 +60,9 @@ public:
|
|||||||
QStringList defaultArguments() const;
|
QStringList defaultArguments() const;
|
||||||
QString buildCommand() const;
|
QString buildCommand() const;
|
||||||
|
|
||||||
void setClean(bool clean);
|
|
||||||
bool isClean() const;
|
|
||||||
|
|
||||||
QVariantMap toMap() const override;
|
|
||||||
protected:
|
|
||||||
IosBuildStep(ProjectExplorer::BuildStepList *parent, IosBuildStep *bs);
|
|
||||||
IosBuildStep(ProjectExplorer::BuildStepList *parent, Core::Id id);
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
QStringList m_baseBuildArguments;
|
QStringList m_baseBuildArguments;
|
||||||
QStringList m_extraArguments;
|
QStringList m_extraArguments;
|
||||||
@@ -99,19 +91,10 @@ private:
|
|||||||
QString m_summaryText;
|
QString m_summaryText;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IosBuildStepFactory : public ProjectExplorer::IBuildStepFactory
|
class IosBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IosBuildStepFactory(QObject *parent = 0);
|
IosBuildStepFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
|
|
||||||
ProjectExplorer::BuildStep *source) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -41,6 +41,7 @@ const char IOS_DEVICE_TYPE[] = "Ios.Device.Type";
|
|||||||
const char IOS_SIMULATOR_TYPE[] = "Ios.Simulator.Type";
|
const char IOS_SIMULATOR_TYPE[] = "Ios.Simulator.Type";
|
||||||
const char IOS_DEVICE_ID[] = "iOS Device ";
|
const char IOS_DEVICE_ID[] = "iOS Device ";
|
||||||
const char IOS_SIMULATOR_DEVICE_ID[] = "iOS Simulator Device ";
|
const char IOS_SIMULATOR_DEVICE_ID[] = "iOS Simulator Device ";
|
||||||
|
const char IOS_PRESET_BUILD_STEP_ID[] = "Ios.IosPresetBuildStep";
|
||||||
const char IOS_DSYM_BUILD_STEP_ID[] = "Ios.IosDsymBuildStep";
|
const char IOS_DSYM_BUILD_STEP_ID[] = "Ios.IosDsymBuildStep";
|
||||||
|
|
||||||
const quint16 IOS_DEVICE_PORT_START = 30000;
|
const quint16 IOS_DEVICE_PORT_START = 30000;
|
||||||
|
@@ -32,8 +32,7 @@
|
|||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <qmakeprojectmanager/qmakeproject.h>
|
#include <qmakeprojectmanager/qmakeproject.h>
|
||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
@@ -41,89 +40,28 @@ namespace Ios {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const char IOS_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.IosDeployConfiguration";
|
const char IOS_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.IosDeployConfiguration";
|
||||||
const char IOS_DC_PREFIX[] = "Qt4ProjectManager.IosDeployConfiguration.";
|
|
||||||
|
|
||||||
IosDeployConfiguration::IosDeployConfiguration(Target *parent, Core::Id id)
|
IosDeployConfiguration::IosDeployConfiguration(Target *parent)
|
||||||
: DeployConfiguration(parent, id)
|
: DeployConfiguration(parent, IOS_DEPLOYCONFIGURATION_ID)
|
||||||
{
|
{
|
||||||
setDisplayName(tr("Deploy to iOS"));
|
|
||||||
setDefaultDisplayName(displayName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IosDeployConfiguration::IosDeployConfiguration(Target *parent, DeployConfiguration *source)
|
void IosDeployConfiguration::initialize()
|
||||||
: DeployConfiguration(parent, source)
|
|
||||||
{
|
{
|
||||||
cloneSteps(source);
|
stepList()->insertStep(0, new IosDeployStep(stepList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
IosDeployConfigurationFactory::IosDeployConfigurationFactory(QObject *parent)
|
IosDeployConfigurationFactory::IosDeployConfigurationFactory()
|
||||||
: DeployConfigurationFactory(parent)
|
|
||||||
{
|
{
|
||||||
setObjectName(QLatin1String("IosDeployConfigurationFactory"));
|
setObjectName("IosDeployConfigurationFactory");
|
||||||
|
registerDeployConfiguration<IosDeployConfiguration>(IOS_DEPLOYCONFIGURATION_ID);
|
||||||
|
setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
||||||
|
setDefaultDisplayName(tr("Deploy on iOS"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IosDeployConfigurationFactory::canCreate(Target *parent, Core::Id id) const
|
bool IosDeployConfigurationFactory::canHandle(Target *target) const
|
||||||
{
|
{
|
||||||
return availableCreationIds(parent).contains(id);
|
return DeployConfigurationFactory::canHandle(target) && IosManager::supportsIos(target->kit());
|
||||||
}
|
|
||||||
|
|
||||||
DeployConfiguration *IosDeployConfigurationFactory::create(Target *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
IosDeployConfiguration *dc = new IosDeployConfiguration(parent, id);
|
|
||||||
dc->stepList()->insertStep(0, new IosDeployStep(dc->stepList()));
|
|
||||||
return dc;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IosDeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
|
||||||
{
|
|
||||||
return canCreate(parent, idFromMap(map));
|
|
||||||
}
|
|
||||||
|
|
||||||
DeployConfiguration *IosDeployConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
|
||||||
{
|
|
||||||
if (!canRestore(parent, map))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
IosDeployConfiguration *dc = new IosDeployConfiguration(parent, idFromMap(map));
|
|
||||||
if (dc->fromMap(map))
|
|
||||||
return dc;
|
|
||||||
|
|
||||||
delete dc;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IosDeployConfigurationFactory::canClone(Target *parent, DeployConfiguration *source) const
|
|
||||||
{
|
|
||||||
if (!IosManager::supportsIos(parent))
|
|
||||||
return false;
|
|
||||||
return source->id() == IOS_DEPLOYCONFIGURATION_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
DeployConfiguration *IosDeployConfigurationFactory::clone(Target *parent, DeployConfiguration *source)
|
|
||||||
{
|
|
||||||
if (!canClone(parent, source))
|
|
||||||
return 0;
|
|
||||||
return new IosDeployConfiguration(parent, source);
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Core::Id> IosDeployConfigurationFactory::availableCreationIds(Target *parent) const
|
|
||||||
{
|
|
||||||
QList<Core::Id> ids;
|
|
||||||
if (!qobject_cast<QmakeProjectManager::QmakeProject *>(parent->project()))
|
|
||||||
return ids;
|
|
||||||
if (!parent->project()->supportsKit(parent->kit()))
|
|
||||||
return ids;
|
|
||||||
if (!IosManager::supportsIos(parent))
|
|
||||||
return ids;
|
|
||||||
ids << Core::Id(IOS_DEPLOYCONFIGURATION_ID);
|
|
||||||
return ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IosDeployConfigurationFactory::displayNameForId(Core::Id id) const
|
|
||||||
{
|
|
||||||
if (id.name().startsWith(IOS_DC_PREFIX))
|
|
||||||
return tr("Deploy on iOS");
|
|
||||||
return QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -33,15 +33,10 @@ namespace Internal {
|
|||||||
class IosDeployConfiguration : public ProjectExplorer::DeployConfiguration
|
class IosDeployConfiguration : public ProjectExplorer::DeployConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class IosDeployConfigurationFactory;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IosDeployConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
explicit IosDeployConfiguration(ProjectExplorer::Target *parent);
|
||||||
|
void initialize() override;
|
||||||
protected:
|
|
||||||
IosDeployConfiguration(ProjectExplorer::Target *parent,
|
|
||||||
ProjectExplorer::DeployConfiguration *source);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class IosDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
class IosDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
||||||
@@ -49,21 +44,9 @@ class IosDeployConfigurationFactory : public ProjectExplorer::DeployConfiguratio
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IosDeployConfigurationFactory(QObject *parent = 0);
|
IosDeployConfigurationFactory();
|
||||||
|
|
||||||
bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const override;
|
bool canHandle(ProjectExplorer::Target *target) const override;
|
||||||
ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent, Core::Id id) override;
|
|
||||||
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const override;
|
|
||||||
ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent,
|
|
||||||
const QVariantMap &map) override;
|
|
||||||
bool canClone(ProjectExplorer::Target *parent,
|
|
||||||
ProjectExplorer::DeployConfiguration *source) const override;
|
|
||||||
ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent,
|
|
||||||
ProjectExplorer::DeployConfiguration *source) override;
|
|
||||||
|
|
||||||
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const override;
|
|
||||||
// used to translate the ids to names to display to the user
|
|
||||||
QString displayNameForId(Core::Id id) const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -59,24 +59,7 @@ const Core::Id IosDeployStep::Id("Qt4ProjectManager.IosDeployStep");
|
|||||||
|
|
||||||
IosDeployStep::IosDeployStep(BuildStepList *parent)
|
IosDeployStep::IosDeployStep(BuildStepList *parent)
|
||||||
: BuildStep(parent, Id)
|
: BuildStep(parent, Id)
|
||||||
, m_expectFail(false)
|
|
||||||
{
|
{
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
IosDeployStep::IosDeployStep(BuildStepList *parent,
|
|
||||||
IosDeployStep *other)
|
|
||||||
: BuildStep(parent, other)
|
|
||||||
, m_expectFail(false)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosDeployStep::ctor()
|
|
||||||
{
|
|
||||||
m_toolHandler = 0;
|
|
||||||
m_transferStatus = NoTransfer;
|
|
||||||
cleanup();
|
|
||||||
updateDisplayNames();
|
updateDisplayNames();
|
||||||
connect(DeviceManager::instance(), &DeviceManager::updated,
|
connect(DeviceManager::instance(), &DeviceManager::updated,
|
||||||
this, &IosDeployStep::updateDisplayNames);
|
this, &IosDeployStep::updateDisplayNames);
|
||||||
|
@@ -36,16 +36,9 @@
|
|||||||
#include <QFutureInterface>
|
#include <QFutureInterface>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QEventLoop;
|
|
||||||
class QTimer;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Ios {
|
namespace Ios {
|
||||||
class IosToolHandler;
|
class IosToolHandler;
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class IosDeviceConfigListModel;
|
|
||||||
class IosPackageCreationStep;
|
|
||||||
|
|
||||||
class IosDeployStep : public ProjectExplorer::BuildStep
|
class IosDeployStep : public ProjectExplorer::BuildStep
|
||||||
{
|
{
|
||||||
@@ -67,9 +60,6 @@ public:
|
|||||||
void run(QFutureInterface<bool> &fi) override;
|
void run(QFutureInterface<bool> &fi) override;
|
||||||
void cleanup();
|
void cleanup();
|
||||||
void cancel() override;
|
void cancel() override;
|
||||||
signals:
|
|
||||||
//void done();
|
|
||||||
//void error();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleIsTransferringApp(Ios::IosToolHandler *handler, const QString &bundlePath,
|
void handleIsTransferringApp(Ios::IosToolHandler *handler, const QString &bundlePath,
|
||||||
@@ -80,7 +70,7 @@ private:
|
|||||||
void handleFinished(Ios::IosToolHandler *handler);
|
void handleFinished(Ios::IosToolHandler *handler);
|
||||||
void handleErrorMsg(Ios::IosToolHandler *handler, const QString &msg);
|
void handleErrorMsg(Ios::IosToolHandler *handler, const QString &msg);
|
||||||
void updateDisplayNames();
|
void updateDisplayNames();
|
||||||
IosDeployStep(ProjectExplorer::BuildStepList *bc, IosDeployStep *other);
|
|
||||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||||
bool immutable() const override { return true; }
|
bool immutable() const override { return true; }
|
||||||
@@ -89,21 +79,20 @@ private:
|
|||||||
IosDevice::ConstPtr iosdevice() const;
|
IosDevice::ConstPtr iosdevice() const;
|
||||||
IosSimulator::ConstPtr iossimulator() const;
|
IosSimulator::ConstPtr iossimulator() const;
|
||||||
|
|
||||||
void ctor();
|
|
||||||
QString deviceId() const;
|
QString deviceId() const;
|
||||||
QString appBundle() const;
|
QString appBundle() const;
|
||||||
void raiseError(const QString &error);
|
void raiseError(const QString &error);
|
||||||
void writeOutput(const QString &text, OutputFormat = OutputFormat::NormalMessage);
|
void writeOutput(const QString &text, OutputFormat = OutputFormat::NormalMessage);
|
||||||
void checkProvisioningProfile();
|
void checkProvisioningProfile();
|
||||||
|
|
||||||
TransferStatus m_transferStatus;
|
TransferStatus m_transferStatus = NoTransfer;
|
||||||
IosToolHandler *m_toolHandler;
|
IosToolHandler *m_toolHandler = nullptr;
|
||||||
QFutureInterface<bool> m_futureInterface;
|
QFutureInterface<bool> m_futureInterface;
|
||||||
ProjectExplorer::IDevice::ConstPtr m_device;
|
ProjectExplorer::IDevice::ConstPtr m_device;
|
||||||
QString m_bundlePath;
|
QString m_bundlePath;
|
||||||
IosDeviceType m_deviceType;
|
IosDeviceType m_deviceType;
|
||||||
static const Core::Id Id;
|
static const Core::Id Id;
|
||||||
bool m_expectFail;
|
bool m_expectFail = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -31,8 +31,6 @@
|
|||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
|
||||||
#include <qtsupport/qtkitinformation.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
@@ -41,29 +39,18 @@ using namespace ProjectExplorer;
|
|||||||
namespace Ios {
|
namespace Ios {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
IosDeployStepFactory::IosDeployStepFactory(QObject *parent)
|
IosDeployStepFactory::IosDeployStepFactory()
|
||||||
: IBuildStepFactory(parent)
|
|
||||||
{
|
{
|
||||||
|
registerStep<IosDeployStep>(IosDeployStep::Id);
|
||||||
|
setDisplayName(tr("Deploy to iOS device or emulator"));
|
||||||
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||||
|
setRepeatable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildStepInfo> IosDeployStepFactory::availableSteps(BuildStepList *parent) const
|
bool IosDeployStepFactory::canHandle(BuildStepList *parent) const
|
||||||
{
|
{
|
||||||
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_DEPLOY
|
return BuildStepFactory::canHandle(parent)
|
||||||
&& IosManager::supportsIos(parent->target())
|
&& IosManager::supportsIos(parent->target());
|
||||||
&& !parent->contains(IosDeployStep::Id))
|
|
||||||
return {{IosDeployStep::Id, tr("Deploy to iOS device or emulator")}};
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *IosDeployStepFactory::create(BuildStepList *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
Q_UNUSED(id);
|
|
||||||
return new IosDeployStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *IosDeployStepFactory::clone(BuildStepList *parent, BuildStep *product)
|
|
||||||
{
|
|
||||||
return new IosDeployStep(parent, static_cast<IosDeployStep *>(product));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -30,19 +30,13 @@
|
|||||||
namespace Ios {
|
namespace Ios {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class IosDeployStepFactory : public ProjectExplorer::IBuildStepFactory
|
class IosDeployStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IosDeployStepFactory(QObject *parent = 0);
|
IosDeployStepFactory();
|
||||||
|
bool canHandle(ProjectExplorer::BuildStepList *parent) const;
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
|
|
||||||
ProjectExplorer::BuildStep *product) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -56,31 +56,13 @@ static const char COMMAND_PARTIAL_KEY[] = ".Command";
|
|||||||
static const char ARGUMENTS_PARTIAL_KEY[] = ".Arguments";
|
static const char ARGUMENTS_PARTIAL_KEY[] = ".Arguments";
|
||||||
static const char CLEAN_PARTIAL_KEY[] = ".Clean";
|
static const char CLEAN_PARTIAL_KEY[] = ".Clean";
|
||||||
|
|
||||||
IosPresetBuildStep::IosPresetBuildStep(BuildStepList *parent, const Id id) :
|
IosDsymBuildStep::IosDsymBuildStep(BuildStepList *parent) :
|
||||||
AbstractProcessStep(parent, id),
|
AbstractProcessStep(parent, Constants::IOS_DSYM_BUILD_STEP_ID),
|
||||||
m_clean(parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN)
|
m_clean(parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IosPresetBuildStep::completeSetup()
|
bool IosDsymBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
||||||
{
|
|
||||||
m_command = defaultCommand();
|
|
||||||
m_arguments = defaultArguments();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IosPresetBuildStep::completeSetupWithStep(BuildStep *bs)
|
|
||||||
{
|
|
||||||
IosPresetBuildStep *o = qobject_cast<IosPresetBuildStep *>(bs);
|
|
||||||
if (!o)
|
|
||||||
return false;
|
|
||||||
m_arguments = o->m_arguments;
|
|
||||||
m_clean = o->m_clean;
|
|
||||||
m_command = o->m_command;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IosPresetBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
|
||||||
{
|
{
|
||||||
BuildConfiguration *bc = buildConfiguration();
|
BuildConfiguration *bc = buildConfiguration();
|
||||||
if (!bc)
|
if (!bc)
|
||||||
@@ -108,7 +90,7 @@ bool IosPresetBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
return AbstractProcessStep::init(earlierSteps);
|
return AbstractProcessStep::init(earlierSteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap IosPresetBuildStep::toMap() const
|
QVariantMap IosDsymBuildStep::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map(AbstractProcessStep::toMap());
|
QVariantMap map(AbstractProcessStep::toMap());
|
||||||
|
|
||||||
@@ -121,7 +103,7 @@ QVariantMap IosPresetBuildStep::toMap() const
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IosPresetBuildStep::fromMap(const QVariantMap &map)
|
bool IosDsymBuildStep::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
QVariant bArgs = map.value(id().withSuffix(ARGUMENTS_PARTIAL_KEY).toString());
|
QVariant bArgs = map.value(id().withSuffix(ARGUMENTS_PARTIAL_KEY).toString());
|
||||||
m_arguments = bArgs.toStringList();
|
m_arguments = bArgs.toStringList();
|
||||||
@@ -138,14 +120,14 @@ bool IosPresetBuildStep::fromMap(const QVariantMap &map)
|
|||||||
return BuildStep::fromMap(map);
|
return BuildStep::fromMap(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList IosPresetBuildStep::defaultArguments() const
|
QStringList IosDsymBuildStep::defaultArguments() const
|
||||||
{
|
{
|
||||||
if (m_clean)
|
if (m_clean)
|
||||||
return defaultCleanCmdList().mid(1);
|
return defaultCleanCmdList().mid(1);
|
||||||
return defaultCmdList().mid(1);
|
return defaultCmdList().mid(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IosPresetBuildStep::defaultCommand() const
|
QString IosDsymBuildStep::defaultCommand() const
|
||||||
{
|
{
|
||||||
if (m_clean)
|
if (m_clean)
|
||||||
return defaultCleanCmdList().at(0);
|
return defaultCleanCmdList().at(0);
|
||||||
@@ -153,248 +135,9 @@ QString IosPresetBuildStep::defaultCommand() const
|
|||||||
return defaultCmdList().at(0);
|
return defaultCmdList().at(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IosPresetBuildStep::command() const
|
|
||||||
{
|
|
||||||
if (m_command.isEmpty())
|
|
||||||
return defaultCommand();
|
|
||||||
return m_command;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosPresetBuildStep::setCommand(const QString &command)
|
|
||||||
{
|
|
||||||
if (command == m_command)
|
|
||||||
return;
|
|
||||||
if (command.isEmpty() || command == defaultCommand()) {
|
|
||||||
if (arguments() == defaultArguments())
|
|
||||||
m_command.clear();
|
|
||||||
else
|
|
||||||
m_command = defaultCommand();
|
|
||||||
} else if (m_command.isEmpty()) {
|
|
||||||
m_arguments = defaultArguments();
|
|
||||||
m_command = command;
|
|
||||||
} else {
|
|
||||||
m_command = command;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IosPresetBuildStep::clean() const
|
|
||||||
{
|
|
||||||
return m_clean;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosPresetBuildStep::setClean(bool clean)
|
|
||||||
{
|
|
||||||
if (m_clean != clean) {
|
|
||||||
m_clean = clean;
|
|
||||||
m_arguments = defaultArguments();
|
|
||||||
m_command = defaultCommand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IosPresetBuildStep::isDefault() const
|
|
||||||
{
|
|
||||||
return arguments() == defaultArguments() && command() == defaultCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosPresetBuildStep::run(QFutureInterface<bool> &fi)
|
|
||||||
{
|
|
||||||
AbstractProcessStep::run(fi);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStepConfigWidget *IosPresetBuildStep::createConfigWidget()
|
|
||||||
{
|
|
||||||
return new IosPresetBuildStepConfigWidget(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IosPresetBuildStep::immutable() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosPresetBuildStep::setArguments(const QStringList &args)
|
|
||||||
{
|
|
||||||
if (arguments() == args)
|
|
||||||
return;
|
|
||||||
if (args == defaultArguments() && command() == defaultCommand())
|
|
||||||
m_command.clear();
|
|
||||||
else {
|
|
||||||
if (m_command.isEmpty())
|
|
||||||
m_command = defaultCommand();
|
|
||||||
m_arguments = args;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList IosPresetBuildStep::arguments() const
|
|
||||||
{
|
|
||||||
if (m_command.isEmpty())
|
|
||||||
return defaultArguments();
|
|
||||||
return m_arguments;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// IosPresetBuildStepConfigWidget
|
|
||||||
//
|
|
||||||
|
|
||||||
IosPresetBuildStepConfigWidget::IosPresetBuildStepConfigWidget(IosPresetBuildStep *buildStep)
|
|
||||||
: m_buildStep(buildStep)
|
|
||||||
{
|
|
||||||
m_ui = new Ui::IosPresetBuildStep;
|
|
||||||
m_ui->setupUi(this);
|
|
||||||
|
|
||||||
Project *pro = m_buildStep->target()->project();
|
|
||||||
|
|
||||||
m_ui->commandLineEdit->setText(m_buildStep->command());
|
|
||||||
m_ui->argumentsTextEdit->setPlainText(Utils::QtcProcess::joinArgs(
|
|
||||||
m_buildStep->arguments()));
|
|
||||||
m_ui->resetDefaultsButton->setEnabled(!m_buildStep->isDefault());
|
|
||||||
updateDetails();
|
|
||||||
|
|
||||||
connect(m_ui->argumentsTextEdit, &QPlainTextEdit::textChanged,
|
|
||||||
this, &IosPresetBuildStepConfigWidget::argumentsChanged);
|
|
||||||
connect(m_ui->commandLineEdit, &QLineEdit::editingFinished,
|
|
||||||
this, &IosPresetBuildStepConfigWidget::commandChanged);
|
|
||||||
connect(m_ui->resetDefaultsButton, &QAbstractButton::clicked,
|
|
||||||
this, &IosPresetBuildStepConfigWidget::resetDefaults);
|
|
||||||
|
|
||||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged,
|
|
||||||
this, &IosPresetBuildStepConfigWidget::updateDetails);
|
|
||||||
connect(m_buildStep->target(), &Target::kitChanged,
|
|
||||||
this, &IosPresetBuildStepConfigWidget::updateDetails);
|
|
||||||
pro->subscribeSignal(&BuildConfiguration::environmentChanged, this, [this]() {
|
|
||||||
if (static_cast<BuildConfiguration *>(sender())->isActive())
|
|
||||||
updateDetails();
|
|
||||||
});
|
|
||||||
connect(pro, &Project::activeProjectConfigurationChanged,
|
|
||||||
this, [this](ProjectConfiguration *pc) {
|
|
||||||
if (pc && pc->isActive())
|
|
||||||
updateDetails();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
IosPresetBuildStepConfigWidget::~IosPresetBuildStepConfigWidget()
|
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IosPresetBuildStepConfigWidget::displayName() const
|
|
||||||
{
|
|
||||||
return m_buildStep->displayName();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosPresetBuildStepConfigWidget::updateDetails()
|
|
||||||
{
|
|
||||||
BuildConfiguration *bc = m_buildStep->buildConfiguration();
|
|
||||||
if (!bc)
|
|
||||||
bc = m_buildStep->target()->activeBuildConfiguration();
|
|
||||||
|
|
||||||
ProcessParameters param;
|
|
||||||
param.setMacroExpander(bc->macroExpander());
|
|
||||||
param.setWorkingDirectory(bc->buildDirectory().toString());
|
|
||||||
param.setEnvironment(bc->environment());
|
|
||||||
param.setCommand(m_buildStep->command());
|
|
||||||
param.setArguments(Utils::QtcProcess::joinArgs(m_buildStep->arguments()));
|
|
||||||
m_summaryText = param.summary(displayName());
|
|
||||||
emit updateSummary();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IosPresetBuildStepConfigWidget::summaryText() const
|
|
||||||
{
|
|
||||||
return m_summaryText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosPresetBuildStepConfigWidget::commandChanged()
|
|
||||||
{
|
|
||||||
m_buildStep->setCommand(m_ui->commandLineEdit->text());
|
|
||||||
m_ui->resetDefaultsButton->setEnabled(!m_buildStep->isDefault());
|
|
||||||
updateDetails();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosPresetBuildStepConfigWidget::argumentsChanged()
|
|
||||||
{
|
|
||||||
m_buildStep->setArguments(Utils::QtcProcess::splitArgs(
|
|
||||||
m_ui->argumentsTextEdit->toPlainText()));
|
|
||||||
m_ui->resetDefaultsButton->setEnabled(!m_buildStep->isDefault());
|
|
||||||
updateDetails();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosPresetBuildStepConfigWidget::resetDefaults()
|
|
||||||
{
|
|
||||||
m_buildStep->setCommand(m_buildStep->defaultCommand());
|
|
||||||
m_buildStep->setArguments(m_buildStep->defaultArguments());
|
|
||||||
m_ui->commandLineEdit->setText(m_buildStep->command());
|
|
||||||
m_ui->argumentsTextEdit->setPlainText(Utils::QtcProcess::joinArgs(
|
|
||||||
m_buildStep->arguments()));
|
|
||||||
m_ui->resetDefaultsButton->setEnabled(!m_buildStep->isDefault());
|
|
||||||
updateDetails();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// IosPresetBuildStepFactory
|
|
||||||
//
|
|
||||||
|
|
||||||
IosPresetBuildStepFactory::IosPresetBuildStepFactory(QObject *parent) :
|
|
||||||
IBuildStepFactory(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *IosPresetBuildStepFactory::create(BuildStepList *parent, const Id id)
|
|
||||||
{
|
|
||||||
IosPresetBuildStep *step = createPresetStep(parent, id);
|
|
||||||
if (step->completeSetup())
|
|
||||||
return step;
|
|
||||||
delete step;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *IosPresetBuildStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
|
||||||
{
|
|
||||||
IosPresetBuildStep *old = qobject_cast<IosPresetBuildStep *>(source);
|
|
||||||
Q_ASSERT(old);
|
|
||||||
IosPresetBuildStep *res = createPresetStep(parent, old->id());
|
|
||||||
if (res->completeSetupWithStep(old))
|
|
||||||
return res;
|
|
||||||
delete res;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *IosPresetBuildStepFactory::restore(BuildStepList *parent, const QVariantMap &map)
|
|
||||||
{
|
|
||||||
IosPresetBuildStep *bs = createPresetStep(parent, idFromMap(map));
|
|
||||||
if (bs->fromMap(map))
|
|
||||||
return bs;
|
|
||||||
delete bs;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<BuildStepInfo> IosDsymBuildStepFactory::availableSteps(BuildStepList *parent) const
|
|
||||||
{
|
|
||||||
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_CLEAN
|
|
||||||
&& parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD
|
|
||||||
&& parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
Id deviceType = DeviceTypeKitInformation::deviceTypeId(parent->target()->kit());
|
|
||||||
if (deviceType != Constants::IOS_DEVICE_TYPE && deviceType != Constants::IOS_SIMULATOR_TYPE)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return {{Constants::IOS_DSYM_BUILD_STEP_ID, "dsymutil"}};
|
|
||||||
}
|
|
||||||
|
|
||||||
IosPresetBuildStep *IosDsymBuildStepFactory::createPresetStep(BuildStepList *parent, const Id id) const
|
|
||||||
{
|
|
||||||
return new IosDsymBuildStep(parent, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
IosDsymBuildStep::IosDsymBuildStep(BuildStepList *parent, const Id id)
|
|
||||||
: IosPresetBuildStep(parent, id)
|
|
||||||
{
|
|
||||||
setDefaultDisplayName("dsymutil");
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList IosDsymBuildStep::defaultCleanCmdList() const
|
QStringList IosDsymBuildStep::defaultCleanCmdList() const
|
||||||
{
|
{
|
||||||
IosRunConfiguration *runConf =
|
auto runConf = qobject_cast<IosRunConfiguration *>(target()->activeRunConfiguration());
|
||||||
qobject_cast<IosRunConfiguration *>(target()->activeRunConfiguration());
|
|
||||||
QTC_ASSERT(runConf, return QStringList("echo"));
|
QTC_ASSERT(runConf, return QStringList("echo"));
|
||||||
QString dsymPath = runConf->bundleDirectory().toUserOutput();
|
QString dsymPath = runConf->bundleDirectory().toUserOutput();
|
||||||
dsymPath.chop(4);
|
dsymPath.chop(4);
|
||||||
@@ -418,6 +161,181 @@ QStringList IosDsymBuildStep::defaultCmdList() const
|
|||||||
return QStringList({dsymutilCmd, "-o", dsymPath, runConf->localExecutable().toUserOutput()});
|
return QStringList({dsymutilCmd, "-o", dsymPath, runConf->localExecutable().toUserOutput()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString IosDsymBuildStep::command() const
|
||||||
|
{
|
||||||
|
if (m_command.isEmpty())
|
||||||
|
return defaultCommand();
|
||||||
|
return m_command;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IosDsymBuildStep::setCommand(const QString &command)
|
||||||
|
{
|
||||||
|
if (command == m_command)
|
||||||
|
return;
|
||||||
|
if (command.isEmpty() || command == defaultCommand()) {
|
||||||
|
if (arguments() == defaultArguments())
|
||||||
|
m_command.clear();
|
||||||
|
else
|
||||||
|
m_command = defaultCommand();
|
||||||
|
} else if (m_command.isEmpty()) {
|
||||||
|
m_arguments = defaultArguments();
|
||||||
|
m_command = command;
|
||||||
|
} else {
|
||||||
|
m_command = command;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IosDsymBuildStep::isDefault() const
|
||||||
|
{
|
||||||
|
return arguments() == defaultArguments() && command() == defaultCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IosDsymBuildStep::run(QFutureInterface<bool> &fi)
|
||||||
|
{
|
||||||
|
AbstractProcessStep::run(fi);
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildStepConfigWidget *IosDsymBuildStep::createConfigWidget()
|
||||||
|
{
|
||||||
|
return new IosDsymBuildStepConfigWidget(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IosDsymBuildStep::immutable() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IosDsymBuildStep::setArguments(const QStringList &args)
|
||||||
|
{
|
||||||
|
if (arguments() == args)
|
||||||
|
return;
|
||||||
|
if (args == defaultArguments() && command() == defaultCommand())
|
||||||
|
m_command.clear();
|
||||||
|
else {
|
||||||
|
if (m_command.isEmpty())
|
||||||
|
m_command = defaultCommand();
|
||||||
|
m_arguments = args;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList IosDsymBuildStep::arguments() const
|
||||||
|
{
|
||||||
|
if (m_command.isEmpty())
|
||||||
|
return defaultArguments();
|
||||||
|
return m_arguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// IosDsymBuildStepConfigWidget
|
||||||
|
//
|
||||||
|
|
||||||
|
IosDsymBuildStepConfigWidget::IosDsymBuildStepConfigWidget(IosDsymBuildStep *buildStep)
|
||||||
|
: m_buildStep(buildStep)
|
||||||
|
{
|
||||||
|
m_ui = new Ui::IosPresetBuildStep;
|
||||||
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
|
Project *pro = m_buildStep->target()->project();
|
||||||
|
|
||||||
|
m_ui->commandLineEdit->setText(m_buildStep->command());
|
||||||
|
m_ui->argumentsTextEdit->setPlainText(Utils::QtcProcess::joinArgs(
|
||||||
|
m_buildStep->arguments()));
|
||||||
|
m_ui->resetDefaultsButton->setEnabled(!m_buildStep->isDefault());
|
||||||
|
updateDetails();
|
||||||
|
|
||||||
|
connect(m_ui->argumentsTextEdit, &QPlainTextEdit::textChanged,
|
||||||
|
this, &IosDsymBuildStepConfigWidget::argumentsChanged);
|
||||||
|
connect(m_ui->commandLineEdit, &QLineEdit::editingFinished,
|
||||||
|
this, &IosDsymBuildStepConfigWidget::commandChanged);
|
||||||
|
connect(m_ui->resetDefaultsButton, &QAbstractButton::clicked,
|
||||||
|
this, &IosDsymBuildStepConfigWidget::resetDefaults);
|
||||||
|
|
||||||
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged,
|
||||||
|
this, &IosDsymBuildStepConfigWidget::updateDetails);
|
||||||
|
connect(m_buildStep->target(), &Target::kitChanged,
|
||||||
|
this, &IosDsymBuildStepConfigWidget::updateDetails);
|
||||||
|
pro->subscribeSignal(&BuildConfiguration::environmentChanged, this, [this]() {
|
||||||
|
if (static_cast<BuildConfiguration *>(sender())->isActive())
|
||||||
|
updateDetails();
|
||||||
|
});
|
||||||
|
connect(pro, &Project::activeProjectConfigurationChanged,
|
||||||
|
this, [this](ProjectConfiguration *pc) {
|
||||||
|
if (pc && pc->isActive())
|
||||||
|
updateDetails();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
IosDsymBuildStepConfigWidget::~IosDsymBuildStepConfigWidget()
|
||||||
|
{
|
||||||
|
delete m_ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString IosDsymBuildStepConfigWidget::displayName() const
|
||||||
|
{
|
||||||
|
return m_buildStep->displayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IosDsymBuildStepConfigWidget::updateDetails()
|
||||||
|
{
|
||||||
|
BuildConfiguration *bc = m_buildStep->buildConfiguration();
|
||||||
|
if (!bc)
|
||||||
|
bc = m_buildStep->target()->activeBuildConfiguration();
|
||||||
|
|
||||||
|
ProcessParameters param;
|
||||||
|
param.setMacroExpander(bc->macroExpander());
|
||||||
|
param.setWorkingDirectory(bc->buildDirectory().toString());
|
||||||
|
param.setEnvironment(bc->environment());
|
||||||
|
param.setCommand(m_buildStep->command());
|
||||||
|
param.setArguments(Utils::QtcProcess::joinArgs(m_buildStep->arguments()));
|
||||||
|
m_summaryText = param.summary(displayName());
|
||||||
|
emit updateSummary();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString IosDsymBuildStepConfigWidget::summaryText() const
|
||||||
|
{
|
||||||
|
return m_summaryText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IosDsymBuildStepConfigWidget::commandChanged()
|
||||||
|
{
|
||||||
|
m_buildStep->setCommand(m_ui->commandLineEdit->text());
|
||||||
|
m_ui->resetDefaultsButton->setEnabled(!m_buildStep->isDefault());
|
||||||
|
updateDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IosDsymBuildStepConfigWidget::argumentsChanged()
|
||||||
|
{
|
||||||
|
m_buildStep->setArguments(Utils::QtcProcess::splitArgs(
|
||||||
|
m_ui->argumentsTextEdit->toPlainText()));
|
||||||
|
m_ui->resetDefaultsButton->setEnabled(!m_buildStep->isDefault());
|
||||||
|
updateDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IosDsymBuildStepConfigWidget::resetDefaults()
|
||||||
|
{
|
||||||
|
m_buildStep->setCommand(m_buildStep->defaultCommand());
|
||||||
|
m_buildStep->setArguments(m_buildStep->defaultArguments());
|
||||||
|
m_ui->commandLineEdit->setText(m_buildStep->command());
|
||||||
|
m_ui->argumentsTextEdit->setPlainText(Utils::QtcProcess::joinArgs(
|
||||||
|
m_buildStep->arguments()));
|
||||||
|
m_ui->resetDefaultsButton->setEnabled(!m_buildStep->isDefault());
|
||||||
|
updateDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// IosDsymBuildStepFactory
|
||||||
|
//
|
||||||
|
|
||||||
|
IosDsymBuildStepFactory::IosDsymBuildStepFactory()
|
||||||
|
{
|
||||||
|
registerStep<IosDsymBuildStep>(Constants::IOS_DSYM_BUILD_STEP_ID);
|
||||||
|
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_CLEAN,
|
||||||
|
ProjectExplorer::Constants::BUILDSTEPS_BUILD,
|
||||||
|
ProjectExplorer::Constants::BUILDSTEPS_DEPLOY});
|
||||||
|
setSupportedDeviceTypes({Constants::IOS_DEVICE_TYPE,
|
||||||
|
Constants::IOS_SIMULATOR_TYPE});
|
||||||
|
setDisplayName("dsymutil");
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Ios
|
} // namespace Ios
|
||||||
|
@@ -31,17 +31,17 @@ namespace Ios {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
namespace Ui { class IosPresetBuildStep; }
|
namespace Ui { class IosPresetBuildStep; }
|
||||||
|
|
||||||
class IosPresetBuildStepConfigWidget;
|
class IosDsymBuildStepConfigWidget;
|
||||||
class IosPresetBuildStepFactory;
|
|
||||||
|
|
||||||
class IosPresetBuildStep : public ProjectExplorer::AbstractProcessStep
|
class IosDsymBuildStep : public ProjectExplorer::AbstractProcessStep
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
friend class IosPresetBuildStepConfigWidget;
|
friend class IosDsymBuildStepConfigWidget;
|
||||||
friend class IosPresetBuildStepFactory;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
IosDsymBuildStep(ProjectExplorer::BuildStepList *parent);
|
||||||
|
|
||||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||||
void run(QFutureInterface<bool> &fi) override;
|
void run(QFutureInterface<bool> &fi) override;
|
||||||
|
|
||||||
@@ -53,31 +53,27 @@ public:
|
|||||||
QString defaultCommand() const;
|
QString defaultCommand() const;
|
||||||
QString command() const;
|
QString command() const;
|
||||||
void setCommand(const QString &command);
|
void setCommand(const QString &command);
|
||||||
bool clean() const;
|
|
||||||
void setClean(bool clean);
|
|
||||||
bool isDefault() const;
|
bool isDefault() const;
|
||||||
|
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
protected:
|
|
||||||
IosPresetBuildStep(ProjectExplorer::BuildStepList *parent, Core::Id id);
|
|
||||||
virtual bool completeSetup();
|
|
||||||
virtual bool completeSetupWithStep(ProjectExplorer::BuildStep *bs);
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
virtual QStringList defaultCleanCmdList() const = 0;
|
|
||||||
virtual QStringList defaultCmdList() const = 0;
|
|
||||||
private:
|
private:
|
||||||
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
QStringList defaultCleanCmdList() const;
|
||||||
|
QStringList defaultCmdList() const;
|
||||||
|
|
||||||
QStringList m_arguments;
|
QStringList m_arguments;
|
||||||
QString m_command;
|
QString m_command;
|
||||||
bool m_clean;
|
bool m_clean;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IosPresetBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
class IosDsymBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IosPresetBuildStepConfigWidget(IosPresetBuildStep *buildStep);
|
IosDsymBuildStepConfigWidget(IosDsymBuildStep *buildStep);
|
||||||
~IosPresetBuildStepConfigWidget();
|
~IosDsymBuildStepConfigWidget();
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
QString summaryText() const override;
|
QString summaryText() const override;
|
||||||
|
|
||||||
@@ -88,47 +84,15 @@ private:
|
|||||||
void updateDetails();
|
void updateDetails();
|
||||||
|
|
||||||
Ui::IosPresetBuildStep *m_ui;
|
Ui::IosPresetBuildStep *m_ui;
|
||||||
IosPresetBuildStep *m_buildStep;
|
IosDsymBuildStep *m_buildStep;
|
||||||
QString m_summaryText;
|
QString m_summaryText;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IosPresetBuildStepFactory : public ProjectExplorer::IBuildStepFactory
|
class IosDsymBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit IosPresetBuildStepFactory(QObject *parent = 0);
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
|
|
||||||
ProjectExplorer::BuildStep *source) override;
|
|
||||||
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent,
|
|
||||||
const QVariantMap &map) override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual IosPresetBuildStep *createPresetStep(ProjectExplorer::BuildStepList *parent,
|
|
||||||
const Core::Id id) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class IosDsymBuildStep : public IosPresetBuildStep
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
friend class IosDsymBuildStepFactory;
|
|
||||||
protected:
|
|
||||||
QStringList defaultCleanCmdList() const override;
|
|
||||||
QStringList defaultCmdList() const override;
|
|
||||||
IosDsymBuildStep(ProjectExplorer::BuildStepList *parent, Core::Id id);
|
|
||||||
};
|
|
||||||
|
|
||||||
class IosDsymBuildStepFactory : public IosPresetBuildStepFactory
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
explicit IosDsymBuildStepFactory();
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
IosPresetBuildStep *createPresetStep(ProjectExplorer::BuildStepList *parent,
|
|
||||||
const Core::Id id) const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -95,7 +95,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
IosRunConfiguration::IosRunConfiguration(Target *target)
|
IosRunConfiguration::IosRunConfiguration(Target *target)
|
||||||
: RunConfiguration(target)
|
: RunConfiguration(target, Constants::IOS_RC_ID_PREFIX)
|
||||||
{
|
{
|
||||||
addExtraAspect(new ArgumentsAspect(this, "Ios.run_arguments"));
|
addExtraAspect(new ArgumentsAspect(this, "Ios.run_arguments"));
|
||||||
|
|
||||||
@@ -105,15 +105,13 @@ IosRunConfiguration::IosRunConfiguration(Target *target)
|
|||||||
this, &IosRunConfiguration::deviceChanges);
|
this, &IosRunConfiguration::deviceChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosRunConfiguration::initialize(Core::Id id)
|
QString IosRunConfiguration::extraId() const
|
||||||
{
|
{
|
||||||
RunConfiguration::initialize(id);
|
return m_profilePath.toString();
|
||||||
m_profilePath = pathFromId(id);
|
|
||||||
|
|
||||||
updateDisplayNames();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosRunConfiguration::deviceChanges() {
|
void IosRunConfiguration::deviceChanges()
|
||||||
|
{
|
||||||
updateDisplayNames();
|
updateDisplayNames();
|
||||||
updateEnabledState();
|
updateEnabledState();
|
||||||
}
|
}
|
||||||
@@ -242,6 +240,12 @@ FileName IosRunConfiguration::localExecutable() const
|
|||||||
|
|
||||||
bool IosRunConfiguration::fromMap(const QVariantMap &map)
|
bool IosRunConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
|
if (!RunConfiguration::fromMap(map))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QString extraId = idFromMap(map).suffixAfter(id());
|
||||||
|
m_profilePath = Utils::FileName::fromString(extraId);
|
||||||
|
|
||||||
bool deviceTypeIsInt;
|
bool deviceTypeIsInt;
|
||||||
map.value(deviceTypeKey).toInt(&deviceTypeIsInt);
|
map.value(deviceTypeKey).toInt(&deviceTypeIsInt);
|
||||||
if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).toMap())) {
|
if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).toMap())) {
|
||||||
@@ -250,7 +254,9 @@ bool IosRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
else
|
else
|
||||||
m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice);
|
m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice);
|
||||||
}
|
}
|
||||||
return RunConfiguration::fromMap(map);
|
|
||||||
|
updateDisplayNames();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap IosRunConfiguration::toMap() const
|
QVariantMap IosRunConfiguration::toMap() const
|
||||||
@@ -265,15 +271,6 @@ QString IosRunConfiguration::buildSystemTarget() const
|
|||||||
return static_cast<QmakeProject *>(target()->project())->mapProFilePathToTarget(m_profilePath);
|
return static_cast<QmakeProject *>(target()->project())->mapProFilePathToTarget(m_profilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName IosRunConfiguration::pathFromId(Core::Id id)
|
|
||||||
{
|
|
||||||
QString pathStr = id.toString();
|
|
||||||
const QString prefix = Constants::IOS_RC_ID_PREFIX;
|
|
||||||
if (!pathStr.startsWith(prefix))
|
|
||||||
return Utils::FileName();
|
|
||||||
return Utils::FileName::fromString(pathStr.mid(prefix.size()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IosRunConfiguration::disabledReason() const
|
QString IosRunConfiguration::disabledReason() const
|
||||||
{
|
{
|
||||||
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||||
|
@@ -66,14 +66,11 @@ public:
|
|||||||
|
|
||||||
QString buildSystemTarget() const final;
|
QString buildSystemTarget() const final;
|
||||||
|
|
||||||
static Utils::FileName pathFromId(Core::Id id);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void localExecutableChanged();
|
void localExecutableChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ProjectExplorer::IRunConfigurationFactory;
|
QString extraId() const final;
|
||||||
void initialize(Core::Id id) override;
|
|
||||||
|
|
||||||
void deviceChanges();
|
void deviceChanges();
|
||||||
friend class IosRunConfigurationWidget;
|
friend class IosRunConfigurationWidget;
|
||||||
|
@@ -18,7 +18,6 @@ HEADERS += \
|
|||||||
project/nimproject.h \
|
project/nimproject.h \
|
||||||
project/nimprojectnode.h \
|
project/nimprojectnode.h \
|
||||||
project/nimbuildconfiguration.h \
|
project/nimbuildconfiguration.h \
|
||||||
project/nimbuildconfigurationfactory.h \
|
|
||||||
project/nimcompilerbuildstep.h \
|
project/nimcompilerbuildstep.h \
|
||||||
project/nimcompilerbuildstepconfigwidget.h \
|
project/nimcompilerbuildstepconfigwidget.h \
|
||||||
project/nimcompilercleanstep.h \
|
project/nimcompilercleanstep.h \
|
||||||
@@ -45,7 +44,6 @@ SOURCES += \
|
|||||||
project/nimproject.cpp \
|
project/nimproject.cpp \
|
||||||
project/nimprojectnode.cpp \
|
project/nimprojectnode.cpp \
|
||||||
project/nimbuildconfiguration.cpp \
|
project/nimbuildconfiguration.cpp \
|
||||||
project/nimbuildconfigurationfactory.cpp \
|
|
||||||
project/nimcompilerbuildstep.cpp \
|
project/nimcompilerbuildstep.cpp \
|
||||||
project/nimcompilerbuildstepconfigwidget.cpp \
|
project/nimcompilerbuildstepconfigwidget.cpp \
|
||||||
project/nimcompilercleanstep.cpp \
|
project/nimcompilercleanstep.cpp \
|
||||||
|
@@ -36,7 +36,6 @@ QtcPlugin {
|
|||||||
prefix: "project/"
|
prefix: "project/"
|
||||||
files: [
|
files: [
|
||||||
"nimbuildconfiguration.h", "nimbuildconfiguration.cpp",
|
"nimbuildconfiguration.h", "nimbuildconfiguration.cpp",
|
||||||
"nimbuildconfigurationfactory.h", "nimbuildconfigurationfactory.cpp",
|
|
||||||
"nimbuildconfigurationwidget.h", "nimbuildconfigurationwidget.cpp",
|
"nimbuildconfigurationwidget.h", "nimbuildconfigurationwidget.cpp",
|
||||||
"nimcompilerbuildstep.h", "nimcompilerbuildstep.cpp",
|
"nimcompilerbuildstep.h", "nimcompilerbuildstep.cpp",
|
||||||
"nimcompilerbuildstepconfigwidget.h", "nimcompilerbuildstepconfigwidget.cpp", "nimcompilerbuildstepconfigwidget.ui",
|
"nimcompilerbuildstepconfigwidget.h", "nimcompilerbuildstepconfigwidget.cpp", "nimcompilerbuildstepconfigwidget.ui",
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "nimconstants.h"
|
#include "nimconstants.h"
|
||||||
#include "editor/nimeditorfactory.h"
|
#include "editor/nimeditorfactory.h"
|
||||||
#include "editor/nimhighlighter.h"
|
#include "editor/nimhighlighter.h"
|
||||||
#include "project/nimbuildconfigurationfactory.h"
|
#include "project/nimbuildconfiguration.h"
|
||||||
#include "project/nimcompilerbuildstepfactory.h"
|
#include "project/nimcompilerbuildstepfactory.h"
|
||||||
#include "project/nimcompilercleanstepfactory.h"
|
#include "project/nimcompilercleanstepfactory.h"
|
||||||
#include "project/nimproject.h"
|
#include "project/nimproject.h"
|
||||||
|
@@ -27,12 +27,23 @@
|
|||||||
#include "nimbuildconfigurationwidget.h"
|
#include "nimbuildconfigurationwidget.h"
|
||||||
#include "nimcompilerbuildstep.h"
|
#include "nimcompilerbuildstep.h"
|
||||||
#include "nimproject.h"
|
#include "nimproject.h"
|
||||||
|
#include "nimbuildconfiguration.h"
|
||||||
|
#include "nimcompilerbuildstep.h"
|
||||||
|
#include "nimcompilercleanstep.h"
|
||||||
|
#include "nimproject.h"
|
||||||
|
|
||||||
#include "../nimconstants.h"
|
#include "../nimconstants.h"
|
||||||
|
|
||||||
#include <projectexplorer/namedwidget.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
#include <projectexplorer/buildinfo.h>
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
|
#include <projectexplorer/buildstep.h>
|
||||||
|
#include <projectexplorer/kit.h>
|
||||||
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/projectmacroexpander.h>
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -40,9 +51,73 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
|
static FileName defaultBuildDirectory(const Kit *k,
|
||||||
|
const QString &projectFilePath,
|
||||||
|
const QString &bc,
|
||||||
|
BuildConfiguration::BuildType buildType)
|
||||||
|
{
|
||||||
|
QFileInfo projectFileInfo(projectFilePath);
|
||||||
|
|
||||||
|
ProjectMacroExpander expander(projectFilePath, projectFileInfo.baseName(), k, bc, buildType);
|
||||||
|
QString buildDirectory = expander.expand(Core::DocumentManager::buildDirectory());
|
||||||
|
|
||||||
|
if (FileUtils::isAbsolutePath(buildDirectory))
|
||||||
|
return FileName::fromString(buildDirectory);
|
||||||
|
|
||||||
|
auto projectDir = FileName::fromString(projectFileInfo.absoluteDir().absolutePath());
|
||||||
|
auto result = projectDir.appendPath(buildDirectory);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
NimBuildConfiguration::NimBuildConfiguration(Target *target)
|
NimBuildConfiguration::NimBuildConfiguration(Target *target)
|
||||||
: BuildConfiguration(target, Constants::C_NIMBUILDCONFIGURATION_ID)
|
: BuildConfiguration(target, Constants::C_NIMBUILDCONFIGURATION_ID)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void NimBuildConfiguration::initialize(const BuildInfo *info)
|
||||||
|
{
|
||||||
|
BuildConfiguration::initialize(info);
|
||||||
|
|
||||||
|
auto project = qobject_cast<NimProject *>(target()->project());
|
||||||
|
QTC_ASSERT(project, return);
|
||||||
|
|
||||||
|
// Create the build configuration and initialize it from build info
|
||||||
|
setBuildDirectory(defaultBuildDirectory(target()->kit(),
|
||||||
|
project->projectFilePath().toString(),
|
||||||
|
info->displayName,
|
||||||
|
info->buildType));
|
||||||
|
|
||||||
|
// Add nim compiler build step
|
||||||
|
{
|
||||||
|
BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
|
auto nimCompilerBuildStep = new NimCompilerBuildStep(buildSteps);
|
||||||
|
NimCompilerBuildStep::DefaultBuildOptions defaultOption;
|
||||||
|
switch (info->buildType) {
|
||||||
|
case BuildConfiguration::Release:
|
||||||
|
defaultOption = NimCompilerBuildStep::DefaultBuildOptions::Release;
|
||||||
|
break;
|
||||||
|
case BuildConfiguration::Debug:
|
||||||
|
defaultOption = NimCompilerBuildStep::DefaultBuildOptions::Debug;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
defaultOption = NimCompilerBuildStep::DefaultBuildOptions::Empty;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
nimCompilerBuildStep->setDefaultCompilerOptions(defaultOption);
|
||||||
|
Utils::FileNameList nimFiles = project->nimFiles();
|
||||||
|
if (!nimFiles.isEmpty())
|
||||||
|
nimCompilerBuildStep->setTargetNimFile(nimFiles.first());
|
||||||
|
buildSteps->appendStep(nimCompilerBuildStep);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add clean step
|
||||||
|
{
|
||||||
|
BuildStepList *cleanSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||||
|
cleanSteps->appendStep(new NimCompilerCleanStep(cleanSteps));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NamedWidget *NimBuildConfiguration::createConfigWidget()
|
NamedWidget *NimBuildConfiguration::createConfigWidget()
|
||||||
{
|
{
|
||||||
@@ -59,9 +134,6 @@ bool NimBuildConfiguration::fromMap(const QVariantMap &map)
|
|||||||
if (!BuildConfiguration::fromMap(map))
|
if (!BuildConfiguration::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!canRestore(map))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const QString displayName = map[Constants::C_NIMBUILDCONFIGURATION_DISPLAY_KEY].toString();
|
const QString displayName = map[Constants::C_NIMBUILDCONFIGURATION_DISPLAY_KEY].toString();
|
||||||
const QString buildDirectory = map[Constants::C_NIMBUILDCONFIGURATION_BUILDDIRECTORY_KEY].toString();
|
const QString buildDirectory = map[Constants::C_NIMBUILDCONFIGURATION_BUILDDIRECTORY_KEY].toString();
|
||||||
|
|
||||||
@@ -91,23 +163,6 @@ FileName NimBuildConfiguration::outFilePath() const
|
|||||||
return step->outFilePath();
|
return step->outFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NimBuildConfiguration::canRestore(const QVariantMap &map)
|
|
||||||
{
|
|
||||||
return idFromMap(map) == Constants::C_NIMBUILDCONFIGURATION_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NimBuildConfiguration::hasNimCompilerBuildStep() const
|
|
||||||
{
|
|
||||||
BuildStepList *steps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
||||||
return steps ? steps->contains(Constants::C_NIMCOMPILERBUILDSTEP_ID) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NimBuildConfiguration::hasNimCompilerCleanStep() const
|
|
||||||
{
|
|
||||||
BuildStepList *steps = stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
|
||||||
return steps ? steps->contains(Constants::C_NIMCOMPILERCLEANSTEP_ID) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NimCompilerBuildStep *NimBuildConfiguration::nimCompilerBuildStep() const
|
const NimCompilerBuildStep *NimBuildConfiguration::nimCompilerBuildStep() const
|
||||||
{
|
{
|
||||||
BuildStepList *steps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
BuildStepList *steps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
@@ -118,5 +173,48 @@ const NimCompilerBuildStep *NimBuildConfiguration::nimCompilerBuildStep() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NimBuildConfigurationFactory::NimBuildConfigurationFactory()
|
||||||
|
{
|
||||||
|
registerBuildConfiguration<NimBuildConfiguration>(Constants::C_NIMBUILDCONFIGURATION_ID);
|
||||||
|
setSupportedProjectType(Constants::C_NIMPROJECT_ID);
|
||||||
|
setSupportedProjectMimeTypeName(Constants::C_NIM_PROJECT_MIMETYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<BuildInfo *> NimBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
||||||
|
{
|
||||||
|
// Retrieve the project path
|
||||||
|
auto project = qobject_cast<NimProject *>(parent->project());
|
||||||
|
QTC_ASSERT(project, return {});
|
||||||
|
|
||||||
|
// Create the build info
|
||||||
|
BuildInfo *info = createBuildInfo(parent->kit(), project->projectFilePath().toString(),
|
||||||
|
BuildConfiguration::Debug);
|
||||||
|
|
||||||
|
info->displayName.clear(); // ask for a name
|
||||||
|
info->buildDirectory.clear(); // This depends on the displayName
|
||||||
|
|
||||||
|
return {info};
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<BuildInfo *> NimBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||||
|
{
|
||||||
|
BuildInfo *debug = createBuildInfo(k, projectPath, BuildConfiguration::Debug);
|
||||||
|
BuildInfo *release = createBuildInfo(k, projectPath, BuildConfiguration::Release);
|
||||||
|
return {debug, release};
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildInfo *NimBuildConfigurationFactory::createBuildInfo(const Kit *k, const QString &projectFilePath,
|
||||||
|
BuildConfiguration::BuildType buildType) const
|
||||||
|
{
|
||||||
|
auto result = new BuildInfo(this);
|
||||||
|
result->buildType = buildType;
|
||||||
|
result->displayName = BuildConfiguration::buildTypeName(buildType);
|
||||||
|
result->buildDirectory = defaultBuildDirectory(k, projectFilePath, result->displayName, buildType);
|
||||||
|
result->kitId = k->id();
|
||||||
|
result->typeName = tr("Build");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Nim
|
||||||
|
|
||||||
|
@@ -28,40 +28,53 @@
|
|||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <QPointer>
|
|
||||||
|
|
||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
class NimProject;
|
|
||||||
class NimCompilerBuildStep;
|
class NimCompilerBuildStep;
|
||||||
|
|
||||||
class NimBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
class NimBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
friend class ProjectExplorer::IBuildConfigurationFactory;
|
||||||
NimBuildConfiguration(ProjectExplorer::Target *target);
|
explicit NimBuildConfiguration(ProjectExplorer::Target *target);
|
||||||
|
|
||||||
|
void initialize(const ProjectExplorer::BuildInfo *info) override;
|
||||||
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration::BuildType buildType() const override;
|
ProjectExplorer::BuildConfiguration::BuildType buildType() const override;
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
|
public:
|
||||||
Utils::FileName cacheDirectory() const;
|
Utils::FileName cacheDirectory() const;
|
||||||
Utils::FileName outFilePath() const;
|
Utils::FileName outFilePath() const;
|
||||||
|
|
||||||
static bool canRestore(const QVariantMap &map);
|
|
||||||
|
|
||||||
bool hasNimCompilerBuildStep() const;
|
|
||||||
bool hasNimCompilerCleanStep() const;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void outFilePathChanged(const Utils::FileName &outFilePath);
|
void outFilePathChanged(const Utils::FileName &outFilePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setupBuild(const ProjectExplorer::BuildInfo *info);
|
||||||
const NimCompilerBuildStep *nimCompilerBuildStep() const;
|
const NimCompilerBuildStep *nimCompilerBuildStep() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class NimBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
NimBuildConfigurationFactory();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
||||||
|
|
||||||
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
||||||
|
const QString &projectPath) const override;
|
||||||
|
|
||||||
|
ProjectExplorer::BuildInfo *createBuildInfo(const ProjectExplorer::Kit *k,
|
||||||
|
const QString &projectPath,
|
||||||
|
ProjectExplorer::BuildConfiguration::BuildType buildType) const;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,217 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "nimbuildconfigurationfactory.h"
|
|
||||||
#include "nimbuildconfiguration.h"
|
|
||||||
#include "nimcompilerbuildstep.h"
|
|
||||||
#include "nimcompilercleanstep.h"
|
|
||||||
#include "nimproject.h"
|
|
||||||
|
|
||||||
#include "../nimconstants.h"
|
|
||||||
|
|
||||||
#include <coreplugin/documentmanager.h>
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
|
||||||
#include <projectexplorer/buildinfo.h>
|
|
||||||
#include <projectexplorer/buildsteplist.h>
|
|
||||||
#include <projectexplorer/buildstep.h>
|
|
||||||
#include <projectexplorer/kit.h>
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
|
||||||
#include <projectexplorer/projectmacroexpander.h>
|
|
||||||
#include <projectexplorer/target.h>
|
|
||||||
#include <utils/mimetypes/mimedatabase.h>
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
using namespace Utils;
|
|
||||||
|
|
||||||
namespace Nim {
|
|
||||||
|
|
||||||
NimBuildConfigurationFactory::NimBuildConfigurationFactory(QObject *parent)
|
|
||||||
: IBuildConfigurationFactory(parent)
|
|
||||||
{}
|
|
||||||
|
|
||||||
QList<BuildInfo *> NimBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
|
||||||
{
|
|
||||||
// Retrieve the project path
|
|
||||||
auto project = qobject_cast<NimProject *>(parent->project());
|
|
||||||
QTC_ASSERT(project, return {});
|
|
||||||
|
|
||||||
// Create the build info
|
|
||||||
BuildInfo *info = createBuildInfo(parent->kit(), project->projectFilePath().toString(),
|
|
||||||
BuildConfiguration::Debug);
|
|
||||||
|
|
||||||
info->displayName.clear(); // ask for a name
|
|
||||||
info->buildDirectory.clear(); // This depends on the displayName
|
|
||||||
|
|
||||||
return {info};
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<BuildInfo *> NimBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
|
||||||
{
|
|
||||||
BuildInfo *debug = createBuildInfo(k, projectPath, BuildConfiguration::Debug);
|
|
||||||
BuildInfo *release = createBuildInfo(k, projectPath, BuildConfiguration::Release);
|
|
||||||
return {debug, release};
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *NimBuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
|
||||||
{
|
|
||||||
auto project = qobject_cast<NimProject *>(parent->project());
|
|
||||||
QTC_ASSERT(project, return nullptr);
|
|
||||||
|
|
||||||
// Create the build configuration and initialize it from build info
|
|
||||||
auto result = new NimBuildConfiguration(parent);
|
|
||||||
result->setDisplayName(info->displayName);
|
|
||||||
result->setDefaultDisplayName(info->displayName);
|
|
||||||
result->setBuildDirectory(defaultBuildDirectory(parent->kit(),
|
|
||||||
project->projectFilePath().toString(),
|
|
||||||
info->displayName,
|
|
||||||
info->buildType));
|
|
||||||
|
|
||||||
// Add nim compiler build step
|
|
||||||
{
|
|
||||||
BuildStepList *buildSteps = result->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
|
|
||||||
auto nimCompilerBuildStep = new NimCompilerBuildStep(buildSteps);
|
|
||||||
NimCompilerBuildStep::DefaultBuildOptions defaultOption;
|
|
||||||
switch (info->buildType) {
|
|
||||||
case BuildConfiguration::Release:
|
|
||||||
defaultOption = NimCompilerBuildStep::DefaultBuildOptions::Release;
|
|
||||||
break;
|
|
||||||
case BuildConfiguration::Debug:
|
|
||||||
defaultOption = NimCompilerBuildStep::DefaultBuildOptions::Debug;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
defaultOption = NimCompilerBuildStep::DefaultBuildOptions::Empty;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
nimCompilerBuildStep->setDefaultCompilerOptions(defaultOption);
|
|
||||||
Utils::FileNameList nimFiles = project->nimFiles();
|
|
||||||
if (!nimFiles.isEmpty())
|
|
||||||
nimCompilerBuildStep->setTargetNimFile(nimFiles.first());
|
|
||||||
buildSteps->appendStep(nimCompilerBuildStep);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add clean step
|
|
||||||
{
|
|
||||||
BuildStepList *cleanSteps = result->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
|
|
||||||
cleanSteps->appendStep(new NimCompilerCleanStep(cleanSteps));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NimBuildConfigurationFactory::canRestore(const Target *parent, const QVariantMap &map) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(parent);
|
|
||||||
if (!canHandle(parent))
|
|
||||||
return false;
|
|
||||||
return NimBuildConfiguration::canRestore(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *NimBuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(canRestore(parent, map), return nullptr);
|
|
||||||
|
|
||||||
// Create the build configuration
|
|
||||||
auto result = new NimBuildConfiguration(parent);
|
|
||||||
|
|
||||||
// Restore from map
|
|
||||||
bool status = result->fromMap(map);
|
|
||||||
QTC_ASSERT(status, return nullptr);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NimBuildConfigurationFactory::canClone(const Target *parent, BuildConfiguration *product) const
|
|
||||||
{
|
|
||||||
QTC_ASSERT(parent, return false);
|
|
||||||
QTC_ASSERT(product, return false);
|
|
||||||
if (!canHandle(parent))
|
|
||||||
return false;
|
|
||||||
return product->id() == Constants::C_NIMBUILDCONFIGURATION_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *NimBuildConfigurationFactory::clone(Target *parent, BuildConfiguration *product)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(parent, return nullptr);
|
|
||||||
QTC_ASSERT(product, return nullptr);
|
|
||||||
auto buildConfiguration = qobject_cast<NimBuildConfiguration *>(product);
|
|
||||||
QTC_ASSERT(buildConfiguration, return nullptr);
|
|
||||||
std::unique_ptr<NimBuildConfiguration> result(new NimBuildConfiguration(parent));
|
|
||||||
return result->fromMap(buildConfiguration->toMap()) ? result.release() : nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NimBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
|
||||||
{
|
|
||||||
if (k && Utils::mimeTypeForFile(projectPath).matchesName(Constants::C_NIM_PROJECT_MIMETYPE))
|
|
||||||
return 0;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NimBuildConfigurationFactory::priority(const Target *parent) const
|
|
||||||
{
|
|
||||||
return canHandle(parent) ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NimBuildConfigurationFactory::canHandle(const Target *t) const
|
|
||||||
{
|
|
||||||
if (!t->project()->supportsKit(t->kit()))
|
|
||||||
return false;
|
|
||||||
return qobject_cast<NimProject *>(t->project());
|
|
||||||
}
|
|
||||||
|
|
||||||
FileName NimBuildConfigurationFactory::defaultBuildDirectory(const Kit *k,
|
|
||||||
const QString &projectFilePath,
|
|
||||||
const QString &bc,
|
|
||||||
BuildConfiguration::BuildType buildType)
|
|
||||||
{
|
|
||||||
QFileInfo projectFileInfo(projectFilePath);
|
|
||||||
|
|
||||||
ProjectMacroExpander expander(projectFilePath, projectFileInfo.baseName(), k, bc, buildType);
|
|
||||||
QString buildDirectory = expander.expand(Core::DocumentManager::buildDirectory());
|
|
||||||
|
|
||||||
if (FileUtils::isAbsolutePath(buildDirectory))
|
|
||||||
return FileName::fromString(buildDirectory);
|
|
||||||
|
|
||||||
auto projectDir = FileName::fromString(projectFileInfo.absoluteDir().absolutePath());
|
|
||||||
auto result = projectDir.appendPath(buildDirectory);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildInfo *NimBuildConfigurationFactory::createBuildInfo(const Kit *k, const QString &projectFilePath,
|
|
||||||
BuildConfiguration::BuildType buildType) const
|
|
||||||
{
|
|
||||||
auto result = new BuildInfo(this);
|
|
||||||
result->buildType = buildType;
|
|
||||||
result->displayName = BuildConfiguration::buildTypeName(buildType);
|
|
||||||
result->buildDirectory = defaultBuildDirectory(k, projectFilePath, result->displayName, buildType);
|
|
||||||
result->kitId = k->id();
|
|
||||||
result->typeName = tr("Build");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Nim
|
|
@@ -1,74 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
|
||||||
|
|
||||||
namespace Nim {
|
|
||||||
|
|
||||||
class NimBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit NimBuildConfigurationFactory(QObject *parent = 0);
|
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
|
||||||
const QString &projectPath) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
|
||||||
const ProjectExplorer::BuildInfo *info) const override;
|
|
||||||
|
|
||||||
bool canRestore(const ProjectExplorer::Target *parent,
|
|
||||||
const QVariantMap &map) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent,
|
|
||||||
const QVariantMap &map) override;
|
|
||||||
|
|
||||||
bool canClone(const ProjectExplorer::Target *parent,
|
|
||||||
ProjectExplorer::BuildConfiguration *product) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent,
|
|
||||||
ProjectExplorer::BuildConfiguration *product) override;
|
|
||||||
|
|
||||||
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
|
|
||||||
|
|
||||||
int priority(const ProjectExplorer::Target *parent) const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool canHandle(const ProjectExplorer::Target *t) const;
|
|
||||||
static Utils::FileName defaultBuildDirectory(const ProjectExplorer::Kit *k,
|
|
||||||
const QString &projectPath,
|
|
||||||
const QString &bc, ProjectExplorer::BuildConfiguration::BuildType buildType);
|
|
||||||
|
|
||||||
ProjectExplorer::BuildInfo *createBuildInfo(const ProjectExplorer::Kit *k,
|
|
||||||
const QString &projectPath,
|
|
||||||
ProjectExplorer::BuildConfiguration::BuildType buildType) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@@ -32,39 +32,17 @@
|
|||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
NimCompilerBuildStepFactory::NimCompilerBuildStepFactory(QObject *parent)
|
NimCompilerBuildStepFactory::NimCompilerBuildStepFactory()
|
||||||
: IBuildStepFactory(parent)
|
|
||||||
{}
|
|
||||||
|
|
||||||
QList<BuildStepInfo> NimCompilerBuildStepFactory::availableSteps(BuildStepList *parent) const
|
|
||||||
{
|
{
|
||||||
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_BUILD)
|
registerStep<NimCompilerBuildStep>(Constants::C_NIMCOMPILERBUILDSTEP_ID);
|
||||||
return {};
|
setDisplayName(tr("Nim Compiler Build Step"));
|
||||||
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
auto bc = qobject_cast<NimBuildConfiguration *>(parent->parent());
|
setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID);
|
||||||
if (!bc || bc->hasNimCompilerBuildStep())
|
setRepeatable(false);
|
||||||
return {};
|
|
||||||
|
|
||||||
return {{Constants::C_NIMCOMPILERBUILDSTEP_ID, tr("Nim Compiler Build Step")}};
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *NimCompilerBuildStepFactory::create(BuildStepList *parent, Core::Id)
|
|
||||||
{
|
|
||||||
return new NimCompilerBuildStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *NimCompilerBuildStepFactory::clone(BuildStepList *parent, BuildStep *buildStep)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(parent, return nullptr);
|
|
||||||
QTC_ASSERT(buildStep, return nullptr);
|
|
||||||
std::unique_ptr<NimCompilerBuildStep> result(new NimCompilerBuildStep(parent));
|
|
||||||
return result->fromMap(buildStep->toMap()) ? result.release() : nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -29,18 +29,12 @@
|
|||||||
|
|
||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
class NimCompilerBuildStepFactory : public ProjectExplorer::IBuildStepFactory
|
class NimCompilerBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NimCompilerBuildStepFactory(QObject *parent = nullptr);
|
NimCompilerBuildStepFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -31,38 +31,18 @@
|
|||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
NimCompilerCleanStepFactory::NimCompilerCleanStepFactory(QObject *parent)
|
NimCompilerCleanStepFactory::NimCompilerCleanStepFactory()
|
||||||
: IBuildStepFactory(parent)
|
|
||||||
{}
|
|
||||||
|
|
||||||
QList<BuildStepInfo> NimCompilerCleanStepFactory::availableSteps(BuildStepList *parent) const
|
|
||||||
{
|
{
|
||||||
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_CLEAN)
|
registerStep<NimCompilerCleanStep>(Constants::C_NIMCOMPILERCLEANSTEP_ID);
|
||||||
return {};
|
setFlags(BuildStepInfo::Unclonable);
|
||||||
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||||
auto bc = qobject_cast<NimBuildConfiguration *>(parent->parent());
|
setSupportedConfiguration(Constants::C_NIMBUILDCONFIGURATION_ID);
|
||||||
if (!bc || bc->hasNimCompilerCleanStep())
|
setRepeatable(false);
|
||||||
return {};
|
setDisplayName(tr(Nim::Constants::C_NIMCOMPILERCLEANSTEP_DISPLAY));
|
||||||
|
|
||||||
return {{Constants::C_NIMCOMPILERCLEANSTEP_ID,
|
|
||||||
tr(Nim::Constants::C_NIMCOMPILERCLEANSTEP_DISPLAY),
|
|
||||||
BuildStepInfo::Unclonable}};
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *NimCompilerCleanStepFactory::create(BuildStepList *parent, Core::Id)
|
|
||||||
{
|
|
||||||
return new NimCompilerCleanStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *NimCompilerCleanStepFactory::clone(BuildStepList *, BuildStep *)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -29,18 +29,12 @@
|
|||||||
|
|
||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
class NimCompilerCleanStepFactory : public ProjectExplorer::IBuildStepFactory
|
class NimCompilerCleanStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NimCompilerCleanStepFactory(QObject *parent = nullptr);
|
NimCompilerCleanStepFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -44,7 +44,7 @@ using namespace Utils;
|
|||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
NimRunConfiguration::NimRunConfiguration(Target *target)
|
NimRunConfiguration::NimRunConfiguration(Target *target)
|
||||||
: RunConfiguration(target)
|
: RunConfiguration(target, Constants::C_NIMRUNCONFIGURATION_ID)
|
||||||
, m_workingDirectoryAspect(new WorkingDirectoryAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_WORKINGDIRECTORYASPECT_ID))
|
, m_workingDirectoryAspect(new WorkingDirectoryAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_WORKINGDIRECTORYASPECT_ID))
|
||||||
, m_argumentAspect(new ArgumentsAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_ARGUMENTASPECT_ID))
|
, m_argumentAspect(new ArgumentsAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_ARGUMENTASPECT_ID))
|
||||||
, m_terminalAspect(new TerminalAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_TERMINALASPECT_ID))
|
, m_terminalAspect(new TerminalAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_TERMINALASPECT_ID))
|
||||||
|
@@ -89,11 +89,6 @@ AbstractProcessStep::AbstractProcessStep(BuildStepList *bsl, Core::Id id) :
|
|||||||
connect(&m_timer, &QTimer::timeout, this, &AbstractProcessStep::checkForCancel);
|
connect(&m_timer, &QTimer::timeout, this, &AbstractProcessStep::checkForCancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractProcessStep::AbstractProcessStep(BuildStepList *bsl,
|
|
||||||
AbstractProcessStep *bs) :
|
|
||||||
BuildStep(bsl, bs), m_ignoreReturnValue(bs->m_ignoreReturnValue)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Deletes all existing output parsers and starts a new chain with the
|
Deletes all existing output parsers and starts a new chain with the
|
||||||
given parser.
|
given parser.
|
||||||
|
@@ -65,7 +65,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
AbstractProcessStep(BuildStepList *bsl, Core::Id id);
|
AbstractProcessStep(BuildStepList *bsl, Core::Id id);
|
||||||
AbstractProcessStep(BuildStepList *bsl, AbstractProcessStep *bs);
|
|
||||||
|
|
||||||
virtual void processStarted();
|
virtual void processStarted();
|
||||||
virtual void processFinished(int exitCode, QProcess::ExitStatus status);
|
virtual void processFinished(int exitCode, QProcess::ExitStatus status);
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "buildconfiguration.h"
|
#include "buildconfiguration.h"
|
||||||
|
|
||||||
|
#include "buildinfo.h"
|
||||||
#include "buildsteplist.h"
|
#include "buildsteplist.h"
|
||||||
#include "projectexplorer.h"
|
#include "projectexplorer.h"
|
||||||
#include "kitmanager.h"
|
#include "kitmanager.h"
|
||||||
@@ -43,6 +44,8 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/macroexpander.h>
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/mimetypes/mimetype.h>
|
||||||
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
@@ -54,57 +57,13 @@ static const char BUILDDIRECTORY_KEY[] = "ProjectExplorer.BuildConfiguration.Bui
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
BuildConfiguration::BuildConfiguration(Target *target, Core::Id id) :
|
BuildConfiguration::BuildConfiguration(Target *target, Core::Id id)
|
||||||
ProjectConfiguration(target),
|
: ProjectConfiguration(target, id)
|
||||||
m_clearSystemEnvironment(false)
|
|
||||||
{
|
|
||||||
initialize(id);
|
|
||||||
Q_ASSERT(target);
|
|
||||||
auto bsl = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_BUILD));
|
|
||||||
//: Display name of the build build step list. Used as part of the labels in the project window.
|
|
||||||
bsl->setDefaultDisplayName(tr("Build"));
|
|
||||||
m_stepLists.append(bsl);
|
|
||||||
bsl = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_CLEAN));
|
|
||||||
//: Display name of the clean build step list. Used as part of the labels in the project window.
|
|
||||||
bsl->setDefaultDisplayName(tr("Clean"));
|
|
||||||
m_stepLists.append(bsl);
|
|
||||||
|
|
||||||
updateCacheAndEmitEnvironmentChanged();
|
|
||||||
|
|
||||||
connect(target, &Target::kitChanged,
|
|
||||||
this, &BuildConfiguration::handleKitUpdate);
|
|
||||||
connect(this, &BuildConfiguration::environmentChanged,
|
|
||||||
this, &BuildConfiguration::emitBuildDirectoryChanged);
|
|
||||||
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *source) :
|
|
||||||
ProjectConfiguration(target),
|
|
||||||
m_clearSystemEnvironment(source->m_clearSystemEnvironment),
|
|
||||||
m_userEnvironmentChanges(source->m_userEnvironmentChanges),
|
|
||||||
m_buildDirectory(source->m_buildDirectory)
|
|
||||||
{
|
|
||||||
copyFrom(source);
|
|
||||||
Q_ASSERT(target);
|
|
||||||
// Do not clone stepLists here, do that in the derived constructor instead
|
|
||||||
// otherwise BuildStepFactories might reject to set up a BuildStep for us
|
|
||||||
// since we are not yet the derived class!
|
|
||||||
|
|
||||||
updateCacheAndEmitEnvironmentChanged();
|
|
||||||
|
|
||||||
connect(target, &Target::kitChanged,
|
|
||||||
this, &BuildConfiguration::handleKitUpdate);
|
|
||||||
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildConfiguration::ctor()
|
|
||||||
{
|
{
|
||||||
Utils::MacroExpander *expander = macroExpander();
|
Utils::MacroExpander *expander = macroExpander();
|
||||||
expander->setDisplayName(tr("Build Settings"));
|
expander->setDisplayName(tr("Build Settings"));
|
||||||
expander->setAccumulating(true);
|
expander->setAccumulating(true);
|
||||||
expander->registerSubProvider([this] { return target()->macroExpander(); });
|
expander->registerSubProvider([target] { return target->macroExpander(); });
|
||||||
|
|
||||||
expander->registerVariable("buildDir", tr("Build directory"),
|
expander->registerVariable("buildDir", tr("Build directory"),
|
||||||
[this] { return buildDirectory().toUserOutput(); });
|
[this] { return buildDirectory().toUserOutput(); });
|
||||||
@@ -115,6 +74,12 @@ void BuildConfiguration::ctor()
|
|||||||
expander->registerPrefix(Constants::VAR_CURRENTBUILD_ENV,
|
expander->registerPrefix(Constants::VAR_CURRENTBUILD_ENV,
|
||||||
tr("Variables in the current build environment"),
|
tr("Variables in the current build environment"),
|
||||||
[this](const QString &var) { return environment().value(var); });
|
[this](const QString &var) { return environment().value(var); });
|
||||||
|
|
||||||
|
updateCacheAndEmitEnvironmentChanged();
|
||||||
|
connect(target, &Target::kitChanged,
|
||||||
|
this, &BuildConfiguration::handleKitUpdate);
|
||||||
|
connect(this, &BuildConfiguration::environmentChanged,
|
||||||
|
this, &BuildConfiguration::emitBuildDirectoryChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileName BuildConfiguration::buildDirectory() const
|
Utils::FileName BuildConfiguration::buildDirectory() const
|
||||||
@@ -136,6 +101,16 @@ void BuildConfiguration::setBuildDirectory(const Utils::FileName &dir)
|
|||||||
emitBuildDirectoryChanged();
|
emitBuildDirectoryChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BuildConfiguration::initialize(const BuildInfo *info)
|
||||||
|
{
|
||||||
|
setDisplayName(info->displayName);
|
||||||
|
setDefaultDisplayName(info->displayName);
|
||||||
|
setBuildDirectory(info->buildDirectory);
|
||||||
|
|
||||||
|
m_stepLists.append(new BuildStepList(this, Constants::BUILDSTEPS_BUILD));
|
||||||
|
m_stepLists.append(new BuildStepList(this, Constants::BUILDSTEPS_CLEAN));
|
||||||
|
}
|
||||||
|
|
||||||
QList<NamedWidget *> BuildConfiguration::createSubConfigWidgets()
|
QList<NamedWidget *> BuildConfiguration::createSubConfigWidgets()
|
||||||
{
|
{
|
||||||
return QList<NamedWidget *>() << new BuildEnvironmentWidget(this);
|
return QList<NamedWidget *>() << new BuildEnvironmentWidget(this);
|
||||||
@@ -183,16 +158,12 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
|
|||||||
qWarning() << "No data for build step list" << i << "found!";
|
qWarning() << "No data for build step list" << i << "found!";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto list = new BuildStepList(this, Core::Id());
|
auto list = new BuildStepList(this, idFromMap(data));
|
||||||
if (!list->fromMap(data)) {
|
if (!list->fromMap(data)) {
|
||||||
qWarning() << "Failed to restore build step list" << i;
|
qWarning() << "Failed to restore build step list" << i;
|
||||||
delete list;
|
delete list;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (list->id() == Constants::BUILDSTEPS_BUILD)
|
|
||||||
list->setDefaultDisplayName(tr("Build"));
|
|
||||||
else if (list->id() == Constants::BUILDSTEPS_CLEAN)
|
|
||||||
list->setDefaultDisplayName(tr("Clean"));
|
|
||||||
m_stepLists.append(list);
|
m_stepLists.append(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,19 +261,6 @@ void BuildConfiguration::setUserEnvironmentChanges(const QList<Utils::Environmen
|
|||||||
updateCacheAndEmitEnvironmentChanged();
|
updateCacheAndEmitEnvironmentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildConfiguration::cloneSteps(BuildConfiguration *source)
|
|
||||||
{
|
|
||||||
if (source == this)
|
|
||||||
return;
|
|
||||||
qDeleteAll(m_stepLists);
|
|
||||||
m_stepLists.clear();
|
|
||||||
foreach (BuildStepList *bsl, source->m_stepLists) {
|
|
||||||
auto newBsl = new BuildStepList(this, bsl);
|
|
||||||
newBsl->cloneSteps(bsl);
|
|
||||||
m_stepLists.append(newBsl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BuildConfiguration::isEnabled() const
|
bool BuildConfiguration::isEnabled() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -360,12 +318,18 @@ void BuildConfiguration::prependCompilerPathToEnvironment(Kit *k, Utils::Environ
|
|||||||
// IBuildConfigurationFactory
|
// IBuildConfigurationFactory
|
||||||
///
|
///
|
||||||
|
|
||||||
IBuildConfigurationFactory::IBuildConfigurationFactory(QObject *parent) :
|
int IBuildConfigurationFactory::priority(const Target *parent) const
|
||||||
QObject(parent)
|
{
|
||||||
{ }
|
return canHandle(parent) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
IBuildConfigurationFactory::~IBuildConfigurationFactory()
|
int IBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
||||||
{ }
|
{
|
||||||
|
QTC_ASSERT(!m_supportedProjectMimeTypeName.isEmpty(), return -1);
|
||||||
|
if (k && Utils::mimeTypeForFile(projectPath).matchesName(m_supportedProjectMimeTypeName))
|
||||||
|
return 0;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// restore
|
// restore
|
||||||
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
||||||
@@ -442,4 +406,89 @@ IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, Bui
|
|||||||
}
|
}
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IBuildConfigurationFactory::setSupportedProjectType(Core::Id id)
|
||||||
|
{
|
||||||
|
m_supportedProjectType = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IBuildConfigurationFactory::setSupportedProjectMimeTypeName(const QString &mimeTypeName)
|
||||||
|
{
|
||||||
|
m_supportedProjectMimeTypeName = mimeTypeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IBuildConfigurationFactory::setSupportedTargetDeviceTypes(const QList<Core::Id> &ids)
|
||||||
|
{
|
||||||
|
m_supportedTargetDeviceTypes = ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IBuildConfigurationFactory::canHandle(const Target *target) const
|
||||||
|
{
|
||||||
|
if (m_supportedProjectType.isValid() && m_supportedProjectType != target->project()->id())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!target->project()->supportsKit(target->kit()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!m_supportedTargetDeviceTypes.isEmpty())
|
||||||
|
if (!m_supportedTargetDeviceTypes.contains(
|
||||||
|
DeviceTypeKitInformation::deviceTypeId(target->kit())))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildConfiguration *IBuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
||||||
|
{
|
||||||
|
if (!canHandle(parent))
|
||||||
|
return nullptr;
|
||||||
|
QTC_ASSERT(m_creator, return nullptr);
|
||||||
|
BuildConfiguration *bc = m_creator(parent);
|
||||||
|
if (!bc)
|
||||||
|
return nullptr;
|
||||||
|
bc->initialize(info);
|
||||||
|
return bc;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IBuildConfigurationFactory::canClone(const Target *parent, BuildConfiguration *product) const
|
||||||
|
{
|
||||||
|
if (!canHandle(parent))
|
||||||
|
return false;
|
||||||
|
const Core::Id id = product->id();
|
||||||
|
return id == m_buildConfigId;
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildConfiguration *IBuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
||||||
|
{
|
||||||
|
if (!canRestore(parent, map))
|
||||||
|
return nullptr;
|
||||||
|
QTC_ASSERT(m_creator, return nullptr);
|
||||||
|
BuildConfiguration *bc = m_creator(parent);
|
||||||
|
QTC_ASSERT(bc, return nullptr);
|
||||||
|
if (!bc->fromMap(map)) {
|
||||||
|
delete bc;
|
||||||
|
bc = nullptr;
|
||||||
|
}
|
||||||
|
return bc;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IBuildConfigurationFactory::canRestore(const Target *parent, const QVariantMap &map) const
|
||||||
|
{
|
||||||
|
if (!canHandle(parent))
|
||||||
|
return false;
|
||||||
|
const Core::Id id = idFromMap(map);
|
||||||
|
return id.name().startsWith(m_buildConfigId.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildConfiguration *IBuildConfigurationFactory::clone(Target *parent, BuildConfiguration *product)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_creator, return nullptr);
|
||||||
|
if (!canClone(parent, product))
|
||||||
|
return nullptr;
|
||||||
|
BuildConfiguration *bc = m_creator(parent);
|
||||||
|
QVariantMap data = product->toMap();
|
||||||
|
bc->fromMap(data);
|
||||||
|
return bc;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class BuildConfiguration;
|
|
||||||
class BuildInfo;
|
class BuildInfo;
|
||||||
class NamedWidget;
|
class NamedWidget;
|
||||||
class BuildStepList;
|
class BuildStepList;
|
||||||
@@ -45,9 +44,11 @@ class PROJECTEXPLORER_EXPORT BuildConfiguration : public ProjectConfiguration
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
protected:
|
||||||
// ctors are protected
|
friend class IBuildConfigurationFactory;
|
||||||
|
explicit BuildConfiguration(Target *target, Core::Id id);
|
||||||
|
|
||||||
|
public:
|
||||||
Utils::FileName buildDirectory() const;
|
Utils::FileName buildDirectory() const;
|
||||||
Utils::FileName rawBuildDirectory() const;
|
Utils::FileName rawBuildDirectory() const;
|
||||||
void setBuildDirectory(const Utils::FileName &dir);
|
void setBuildDirectory(const Utils::FileName &dir);
|
||||||
@@ -100,19 +101,14 @@ signals:
|
|||||||
void buildTypeChanged();
|
void buildTypeChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BuildConfiguration(Target *target, Core::Id id);
|
virtual void initialize(const BuildInfo *info);
|
||||||
BuildConfiguration(Target *target, BuildConfiguration *source);
|
|
||||||
|
|
||||||
void cloneSteps(BuildConfiguration *source);
|
|
||||||
void updateCacheAndEmitEnvironmentChanged();
|
void updateCacheAndEmitEnvironmentChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleKitUpdate();
|
void handleKitUpdate();
|
||||||
void emitBuildDirectoryChanged();
|
void emitBuildDirectoryChanged();
|
||||||
|
|
||||||
void ctor();
|
bool m_clearSystemEnvironment = false;
|
||||||
|
|
||||||
bool m_clearSystemEnvironment;
|
|
||||||
QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
|
QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
|
||||||
QList<BuildStepList *> m_stepLists;
|
QList<BuildStepList *> m_stepLists;
|
||||||
Utils::FileName m_buildDirectory;
|
Utils::FileName m_buildDirectory;
|
||||||
@@ -124,37 +120,62 @@ class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
protected:
|
||||||
explicit IBuildConfigurationFactory(QObject *parent = nullptr);
|
IBuildConfigurationFactory() = default;
|
||||||
~IBuildConfigurationFactory() override;
|
|
||||||
|
|
||||||
|
public:
|
||||||
// The priority is negative if this factory can not create anything for the target.
|
// The priority is negative if this factory can not create anything for the target.
|
||||||
// It is 0 for the "default" factory that wants to handle the target.
|
// It is 0 for the "default" factory that wants to handle the target.
|
||||||
// Add 100 for each specialization.
|
// Add 100 for each specialization.
|
||||||
virtual int priority(const Target *parent) const = 0;
|
virtual int priority(const Target *parent) const;
|
||||||
// List of build information that can be used to create a new build configuration via
|
// List of build information that can be used to create a new build configuration via
|
||||||
// "Add Build Configuration" button.
|
// "Add Build Configuration" button.
|
||||||
virtual QList<BuildInfo *> availableBuilds(const Target *parent) const = 0;
|
virtual QList<BuildInfo *> availableBuilds(const Target *parent) const = 0;
|
||||||
|
|
||||||
virtual int priority(const Kit *k, const QString &projectPath) const = 0;
|
virtual int priority(const Kit *k, const QString &projectPath) const;
|
||||||
// List of build information that can be used to initially set up a new build configuration.
|
// List of build information that can be used to initially set up a new build configuration.
|
||||||
virtual QList<BuildInfo *> availableSetups(const Kit *k, const QString &projectPath) const = 0;
|
virtual QList<BuildInfo *> availableSetups(const Kit *k, const QString &projectPath) const = 0;
|
||||||
|
|
||||||
virtual BuildConfiguration *create(Target *parent, const BuildInfo *info) const = 0;
|
BuildConfiguration *create(Target *parent, const BuildInfo *info) const;
|
||||||
|
|
||||||
// used to recreate the runConfigurations when restoring settings
|
// used to recreate the runConfigurations when restoring settings
|
||||||
virtual bool canRestore(const Target *parent, const QVariantMap &map) const = 0;
|
bool canRestore(const Target *parent, const QVariantMap &map) const;
|
||||||
virtual BuildConfiguration *restore(Target *parent, const QVariantMap &map) = 0;
|
BuildConfiguration *restore(Target *parent, const QVariantMap &map);
|
||||||
virtual bool canClone(const Target *parent, BuildConfiguration *product) const = 0;
|
bool canClone(const Target *parent, BuildConfiguration *product) const;
|
||||||
virtual BuildConfiguration *clone(Target *parent, BuildConfiguration *product) = 0;
|
BuildConfiguration *clone(Target *parent, BuildConfiguration *product);
|
||||||
|
|
||||||
static IBuildConfigurationFactory *find(Target *parent, const QVariantMap &map);
|
static IBuildConfigurationFactory *find(Target *parent, const QVariantMap &map);
|
||||||
static IBuildConfigurationFactory *find(const Kit *k, const QString &projectPath);
|
static IBuildConfigurationFactory *find(const Kit *k, const QString &projectPath);
|
||||||
static IBuildConfigurationFactory *find(Target *parent);
|
static IBuildConfigurationFactory *find(Target *parent);
|
||||||
static IBuildConfigurationFactory *find(Target *parent, BuildConfiguration *bc);
|
static IBuildConfigurationFactory *find(Target *parent, BuildConfiguration *bc);
|
||||||
|
|
||||||
|
virtual bool canHandle(const ProjectExplorer::Target *t) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void setSupportedProjectType(Core::Id id);
|
||||||
|
void setSupportedProjectMimeTypeName(const QString &mimeTypeName);
|
||||||
|
void setSupportedTargetDeviceTypes(const QList<Core::Id> &ids);
|
||||||
|
void setDefaultDisplayName(const QString &defaultDisplayName);
|
||||||
|
|
||||||
|
using BuildConfigurationCreator = std::function<BuildConfiguration *(Target *)>;
|
||||||
|
|
||||||
|
template <class BuildConfig>
|
||||||
|
void registerBuildConfiguration(Core::Id buildConfigId)
|
||||||
|
{
|
||||||
|
setObjectName(buildConfigId.toString() + "BuildConfigurationFactory");
|
||||||
|
m_creator = [](Target *t) { return new BuildConfig(t); };
|
||||||
|
m_buildConfigId = buildConfigId;
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void availableCreationIdsChanged();
|
void availableCreationIdsChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BuildConfigurationCreator m_creator;
|
||||||
|
Core::Id m_buildConfigId;
|
||||||
|
Core::Id m_supportedProjectType;
|
||||||
|
QList<Core::Id> m_supportedTargetDeviceTypes;
|
||||||
|
QString m_supportedProjectMimeTypeName;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -28,9 +28,12 @@
|
|||||||
#include "buildconfiguration.h"
|
#include "buildconfiguration.h"
|
||||||
#include "buildsteplist.h"
|
#include "buildsteplist.h"
|
||||||
#include "deployconfiguration.h"
|
#include "deployconfiguration.h"
|
||||||
|
#include "kitinformation.h"
|
||||||
|
#include "project.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class ProjectExplorer::BuildStep
|
\class ProjectExplorer::BuildStep
|
||||||
@@ -109,26 +112,10 @@
|
|||||||
|
|
||||||
static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled";
|
static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled";
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
BuildStep::BuildStep(BuildStepList *bsl, Core::Id id) :
|
BuildStep::BuildStep(BuildStepList *bsl, Core::Id id) :
|
||||||
ProjectConfiguration(bsl), m_enabled(true)
|
ProjectConfiguration(bsl, id)
|
||||||
{
|
|
||||||
initialize(id);
|
|
||||||
Q_ASSERT(bsl);
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep::BuildStep(BuildStepList *bsl, BuildStep *bs) :
|
|
||||||
ProjectConfiguration(bsl), m_enabled(bs->m_enabled)
|
|
||||||
{
|
|
||||||
copyFrom(bs);
|
|
||||||
Q_ASSERT(bsl);
|
|
||||||
setDisplayName(bs->displayName());
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildStep::ctor()
|
|
||||||
{
|
{
|
||||||
Utils::MacroExpander *expander = macroExpander();
|
Utils::MacroExpander *expander = macroExpander();
|
||||||
expander->setDisplayName(tr("Build Step"));
|
expander->setDisplayName(tr("Build Step"));
|
||||||
@@ -225,17 +212,133 @@ bool BuildStep::enabled() const
|
|||||||
return m_enabled;
|
return m_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
IBuildStepFactory::IBuildStepFactory(QObject *parent) :
|
BuildStepFactory::BuildStepFactory()
|
||||||
QObject(parent)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
BuildStep *IBuildStepFactory::restore(BuildStepList *parent, const QVariantMap &map)
|
bool BuildStepFactory::canHandle(BuildStepList *bsl) const
|
||||||
{
|
{
|
||||||
const Core::Id id = idFromMap(map);
|
if (!m_supportedStepLists.isEmpty() && !m_supportedStepLists.contains(bsl->id()))
|
||||||
BuildStep *bs = create(parent, id);
|
return false;
|
||||||
if (bs->fromMap(map))
|
|
||||||
|
auto config = qobject_cast<ProjectConfiguration *>(bsl->parent());
|
||||||
|
|
||||||
|
if (!m_supportedDeviceTypes.isEmpty()) {
|
||||||
|
Target *target = bsl->target();
|
||||||
|
QTC_ASSERT(target, return false);
|
||||||
|
Core::Id deviceType = DeviceTypeKitInformation::deviceTypeId(target->kit());
|
||||||
|
if (!m_supportedDeviceTypes.contains(deviceType))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_supportedProjectType.isValid()) {
|
||||||
|
if (!config)
|
||||||
|
return false;
|
||||||
|
Core::Id projectId = config->project()->id();
|
||||||
|
if (projectId != m_supportedProjectType)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_isRepeatable && bsl->contains(m_info.id))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (m_supportedConfiguration.isValid()) {
|
||||||
|
if (!config)
|
||||||
|
return false;
|
||||||
|
Core::Id configId = config->id();
|
||||||
|
if (configId != m_supportedConfiguration)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildStepFactory::setDisplayName(const QString &displayName)
|
||||||
|
{
|
||||||
|
m_info.displayName = displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildStepFactory::setFlags(BuildStepInfo::Flags flags)
|
||||||
|
{
|
||||||
|
m_info.flags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildStepFactory::setSupportedStepList(Core::Id id)
|
||||||
|
{
|
||||||
|
m_supportedStepLists = {id};
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildStepFactory::setSupportedStepLists(const QList<Core::Id> &ids)
|
||||||
|
{
|
||||||
|
m_supportedStepLists = ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildStepFactory::setSupportedConfiguration(Core::Id id)
|
||||||
|
{
|
||||||
|
m_supportedConfiguration = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildStepFactory::setSupportedProjectType(Core::Id id)
|
||||||
|
{
|
||||||
|
m_supportedProjectType = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildStepFactory::setSupportedDeviceType(Core::Id id)
|
||||||
|
{
|
||||||
|
m_supportedDeviceTypes = {id};
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildStepFactory::setSupportedDeviceTypes(const QList<Core::Id> &ids)
|
||||||
|
{
|
||||||
|
m_supportedDeviceTypes = ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildStepInfo BuildStepFactory::stepInfo() const
|
||||||
|
{
|
||||||
|
return m_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::Id BuildStepFactory::stepId() const
|
||||||
|
{
|
||||||
|
return m_info.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildStep *BuildStepFactory::create(BuildStepList *parent, Core::Id id)
|
||||||
|
{
|
||||||
|
BuildStep *bs = nullptr;
|
||||||
|
if (id == m_info.id)
|
||||||
|
bs = m_info.creator(parent);
|
||||||
return bs;
|
return bs;
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildStep *BuildStepFactory::restore(BuildStepList *parent, const QVariantMap &map)
|
||||||
|
{
|
||||||
|
BuildStep *bs = m_info.creator(parent);
|
||||||
|
if (!bs)
|
||||||
|
return nullptr;
|
||||||
|
if (!bs->fromMap(map)) {
|
||||||
|
QTC_CHECK(false);
|
||||||
delete bs;
|
delete bs;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
return bs;
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildStep *BuildStepFactory::clone(BuildStepList *parent, BuildStep *product)
|
||||||
|
{
|
||||||
|
if ((m_info.flags & BuildStepInfo::Unclonable) != 0)
|
||||||
|
return nullptr;
|
||||||
|
if (m_info.id != product->id())
|
||||||
|
return nullptr;
|
||||||
|
BuildStep *bs = m_info.creator(parent);
|
||||||
|
if (!bs)
|
||||||
|
return nullptr;
|
||||||
|
const QVariantMap map = product->toMap();
|
||||||
|
if (!bs->fromMap(map)) {
|
||||||
|
QTC_CHECK(false);
|
||||||
|
delete bs;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return bs;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // ProjectExplorer
|
||||||
|
@@ -28,17 +28,20 @@
|
|||||||
#include "projectconfiguration.h"
|
#include "projectconfiguration.h"
|
||||||
#include "projectexplorer_export.h"
|
#include "projectexplorer_export.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QFutureInterface>
|
#include <QFutureInterface>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Task;
|
|
||||||
class BuildConfiguration;
|
class BuildConfiguration;
|
||||||
|
class BuildStepConfigWidget;
|
||||||
|
class BuildStepFactory;
|
||||||
class BuildStepList;
|
class BuildStepList;
|
||||||
class DeployConfiguration;
|
class DeployConfiguration;
|
||||||
class Target;
|
class Target;
|
||||||
|
class Task;
|
||||||
class BuildStepConfigWidget;
|
|
||||||
|
|
||||||
// Documentation inside.
|
// Documentation inside.
|
||||||
class PROJECTEXPLORER_EXPORT BuildStep : public ProjectConfiguration
|
class PROJECTEXPLORER_EXPORT BuildStep : public ProjectConfiguration
|
||||||
@@ -46,14 +49,12 @@ class PROJECTEXPLORER_EXPORT BuildStep : public ProjectConfiguration
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BuildStep(BuildStepList *bsl, Core::Id id);
|
friend class BuildStepFactory;
|
||||||
BuildStep(BuildStepList *bsl, BuildStep *bs);
|
explicit BuildStep(BuildStepList *bsl, Core::Id id);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool init(QList<const BuildStep *> &earlierSteps) = 0;
|
virtual bool init(QList<const BuildStep *> &earlierSteps) = 0;
|
||||||
|
|
||||||
virtual void run(QFutureInterface<bool> &fi) = 0;
|
virtual void run(QFutureInterface<bool> &fi) = 0;
|
||||||
|
|
||||||
virtual BuildStepConfigWidget *createConfigWidget() = 0;
|
virtual BuildStepConfigWidget *createConfigWidget() = 0;
|
||||||
|
|
||||||
virtual bool immutable() const;
|
virtual bool immutable() const;
|
||||||
@@ -97,8 +98,6 @@ signals:
|
|||||||
void enabledChanged();
|
void enabledChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
|
||||||
|
|
||||||
bool m_enabled = true;
|
bool m_enabled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -111,27 +110,58 @@ public:
|
|||||||
UniqueStep = 1 << 8 // Can't be used twice in a BuildStepList
|
UniqueStep = 1 << 8 // Can't be used twice in a BuildStepList
|
||||||
};
|
};
|
||||||
|
|
||||||
BuildStepInfo() {}
|
using BuildStepCreator = std::function<BuildStep *(BuildStepList *)>;
|
||||||
BuildStepInfo(Core::Id id, const QString &displayName, Flags flags = Flags())
|
|
||||||
: id(id), displayName(displayName), flags(flags)
|
|
||||||
{}
|
|
||||||
|
|
||||||
Core::Id id;
|
Core::Id id;
|
||||||
QString displayName;
|
QString displayName;
|
||||||
Flags flags = Flags();
|
Flags flags = Flags();
|
||||||
|
BuildStepCreator creator;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IBuildStepFactory : public QObject
|
class PROJECTEXPLORER_EXPORT BuildStepFactory : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IBuildStepFactory(QObject *parent = nullptr);
|
BuildStepFactory();
|
||||||
|
|
||||||
virtual QList<BuildStepInfo> availableSteps(BuildStepList *parent) const = 0;
|
BuildStepInfo stepInfo() const;
|
||||||
virtual BuildStep *create(BuildStepList *parent, Core::Id id) = 0;
|
Core::Id stepId() const;
|
||||||
virtual BuildStep *restore(BuildStepList *parent, const QVariantMap &map);
|
BuildStep *create(BuildStepList *parent, Core::Id id);
|
||||||
virtual BuildStep *clone(BuildStepList *parent, BuildStep *product) = 0;
|
BuildStep *restore(BuildStepList *parent, const QVariantMap &map);
|
||||||
|
BuildStep *clone(BuildStepList *parent, BuildStep *product);
|
||||||
|
|
||||||
|
virtual bool canHandle(BuildStepList *bsl) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
using BuildStepCreator = std::function<BuildStep *(BuildStepList *)>;
|
||||||
|
|
||||||
|
template <class BuildStepType>
|
||||||
|
void registerStep(Core::Id id)
|
||||||
|
{
|
||||||
|
QTC_CHECK(!m_info.creator);
|
||||||
|
m_info.id = id;
|
||||||
|
m_info.creator = [](BuildStepList *bsl) { return new BuildStepType(bsl); };
|
||||||
|
}
|
||||||
|
|
||||||
|
void setSupportedStepList(Core::Id id);
|
||||||
|
void setSupportedStepLists(const QList<Core::Id> &ids);
|
||||||
|
void setSupportedConfiguration(Core::Id id);
|
||||||
|
void setSupportedProjectType(Core::Id id);
|
||||||
|
void setSupportedDeviceType(Core::Id id);
|
||||||
|
void setSupportedDeviceTypes(const QList<Core::Id> &ids);
|
||||||
|
void setRepeatable(bool on) { m_isRepeatable = on; }
|
||||||
|
void setDisplayName(const QString &displayName);
|
||||||
|
void setFlags(BuildStepInfo::Flags flags);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BuildStepInfo m_info;
|
||||||
|
|
||||||
|
Core::Id m_supportedProjectType;
|
||||||
|
QList<Core::Id> m_supportedDeviceTypes;
|
||||||
|
QList<Core::Id> m_supportedStepLists;
|
||||||
|
Core::Id m_supportedConfiguration;
|
||||||
|
bool m_isRepeatable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT BuildStepConfigWidget : public QWidget
|
class PROJECTEXPLORER_EXPORT BuildStepConfigWidget : public QWidget
|
||||||
|
@@ -44,27 +44,27 @@ const char STEPS_PREFIX[] = "ProjectExplorer.BuildStepList.Step.";
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
BuildStepList::BuildStepList(QObject *parent, Core::Id id) :
|
BuildStepList::BuildStepList(QObject *parent, Core::Id id)
|
||||||
ProjectConfiguration(parent)
|
: ProjectConfiguration(parent, id)
|
||||||
{
|
{
|
||||||
Q_ASSERT(parent);
|
if (id == Constants::BUILDSTEPS_BUILD) {
|
||||||
initialize(id);
|
//: Display name of the clean build step list. Used as part of the labels in the project window.
|
||||||
|
setDefaultDisplayName(tr("Build"));
|
||||||
|
} else if (id == Constants::BUILDSTEPS_CLEAN) {
|
||||||
|
//: Display name of the build build step list. Used as part of the labels in the project window.
|
||||||
|
setDefaultDisplayName(tr("Clean"));
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStepList::BuildStepList(QObject *parent, BuildStepList *source) :
|
|
||||||
ProjectConfiguration(parent)
|
|
||||||
{
|
|
||||||
copyFrom(source);
|
|
||||||
setDisplayName(source->displayName());
|
|
||||||
Q_ASSERT(parent);
|
|
||||||
// do not clone the steps here:
|
|
||||||
// The BC is not fully set up yet and thus some of the buildstepfactories
|
|
||||||
// will fail to clone the buildsteps!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStepList::~BuildStepList()
|
BuildStepList::~BuildStepList()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildStepList::clear()
|
||||||
{
|
{
|
||||||
qDeleteAll(m_steps);
|
qDeleteAll(m_steps);
|
||||||
|
m_steps.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap BuildStepList::toMap() const
|
QVariantMap BuildStepList::toMap() const
|
||||||
@@ -95,29 +95,6 @@ bool BuildStepList::contains(Core::Id id) const
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildStepList::cloneSteps(BuildStepList *source)
|
|
||||||
{
|
|
||||||
Q_ASSERT(source);
|
|
||||||
const QList<IBuildStepFactory *> factories
|
|
||||||
= ExtensionSystem::PluginManager::getObjects<IBuildStepFactory>();
|
|
||||||
foreach (BuildStep *originalbs, source->steps()) {
|
|
||||||
foreach (IBuildStepFactory *factory, factories) {
|
|
||||||
const QList<BuildStepInfo> steps = factory->availableSteps(source);
|
|
||||||
const Core::Id sourceId = originalbs->id();
|
|
||||||
const auto canClone = [sourceId](const BuildStepInfo &info) {
|
|
||||||
return (info.flags & BuildStepInfo::Unclonable) == 0 && info.id == sourceId;
|
|
||||||
};
|
|
||||||
if (Utils::contains(steps, canClone)) {
|
|
||||||
if (BuildStep *clonebs = factory->clone(this, originalbs)) {
|
|
||||||
m_steps.append(clonebs);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
qWarning() << "Cloning of step " << originalbs->displayName() << " failed (continuing).";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BuildStepList::isActive() const
|
bool BuildStepList::isActive() const
|
||||||
{
|
{
|
||||||
return qobject_cast<ProjectConfiguration *>(parent())->isActive();
|
return qobject_cast<ProjectConfiguration *>(parent())->isActive();
|
||||||
@@ -125,12 +102,14 @@ bool BuildStepList::isActive() const
|
|||||||
|
|
||||||
bool BuildStepList::fromMap(const QVariantMap &map)
|
bool BuildStepList::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
|
clear();
|
||||||
|
|
||||||
// We need the ID set before trying to restore the steps!
|
// We need the ID set before trying to restore the steps!
|
||||||
if (!ProjectConfiguration::fromMap(map))
|
if (!ProjectConfiguration::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const QList<IBuildStepFactory *> factories
|
const QList<BuildStepFactory *> factories
|
||||||
= ExtensionSystem::PluginManager::getObjects<IBuildStepFactory>();
|
= ExtensionSystem::PluginManager::getObjects<BuildStepFactory>();
|
||||||
|
|
||||||
int maxSteps = map.value(QString::fromLatin1(STEPS_COUNT_KEY), 0).toInt();
|
int maxSteps = map.value(QString::fromLatin1(STEPS_COUNT_KEY), 0).toInt();
|
||||||
for (int i = 0; i < maxSteps; ++i) {
|
for (int i = 0; i < maxSteps; ++i) {
|
||||||
@@ -139,18 +118,22 @@ bool BuildStepList::fromMap(const QVariantMap &map)
|
|||||||
qWarning() << "No step data found for" << i << "(continuing).";
|
qWarning() << "No step data found for" << i << "(continuing).";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach (IBuildStepFactory *factory, factories) {
|
bool handled = false;
|
||||||
const QList<BuildStepInfo> steps = factory->availableSteps(this);
|
Core::Id stepId = idFromMap(bsData);
|
||||||
const Core::Id id = ProjectExplorer::idFromMap(bsData);
|
for (BuildStepFactory *factory : factories) {
|
||||||
if (Utils::contains(steps, Utils::equal(&BuildStepInfo::id, id))) {
|
if (factory->stepId() == stepId) {
|
||||||
|
if (factory->canHandle(this)) {
|
||||||
if (BuildStep *bs = factory->restore(this, bsData)) {
|
if (BuildStep *bs = factory->restore(this, bsData)) {
|
||||||
appendStep(bs);
|
appendStep(bs);
|
||||||
break;
|
handled = true;
|
||||||
}
|
} else {
|
||||||
qWarning() << "Restoration of step" << i << "failed (continuing).";
|
qWarning() << "Restoration of step" << i << "failed (continuing).";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
QTC_CHECK(handled);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,10 +41,11 @@ class PROJECTEXPLORER_EXPORT BuildStepList : public ProjectConfiguration
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BuildStepList(QObject *parent, Core::Id id);
|
explicit BuildStepList(QObject *parent, Core::Id id);
|
||||||
BuildStepList(QObject *parent, BuildStepList *source);
|
|
||||||
~BuildStepList() override;
|
~BuildStepList() override;
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
QList<BuildStep *> steps() const;
|
QList<BuildStep *> steps() const;
|
||||||
QList<BuildStep *> steps(const std::function<bool(const BuildStep *)> &filter) const;
|
QList<BuildStep *> steps(const std::function<bool(const BuildStep *)> &filter) const;
|
||||||
template <class BS> BS *firstOfType() {
|
template <class BS> BS *firstOfType() {
|
||||||
@@ -82,7 +83,6 @@ public:
|
|||||||
|
|
||||||
virtual QVariantMap toMap() const override;
|
virtual QVariantMap toMap() const override;
|
||||||
virtual bool fromMap(const QVariantMap &map) override;
|
virtual bool fromMap(const QVariantMap &map) override;
|
||||||
void cloneSteps(BuildStepList *source);
|
|
||||||
|
|
||||||
bool isActive() const override;
|
bool isActive() const override;
|
||||||
|
|
||||||
|
@@ -286,12 +286,12 @@ void BuildStepListWidget::init(BuildStepList *bsl)
|
|||||||
|
|
||||||
void BuildStepListWidget::updateAddBuildStepMenu()
|
void BuildStepListWidget::updateAddBuildStepMenu()
|
||||||
{
|
{
|
||||||
QMap<QString, QPair<Core::Id, IBuildStepFactory *> > map;
|
QMap<QString, QPair<Core::Id, BuildStepFactory *> > map;
|
||||||
//Build up a list of possible steps and save map the display names to the (internal) name and factories.
|
//Build up a list of possible steps and save map the display names to the (internal) name and factories.
|
||||||
QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::getObjects<IBuildStepFactory>();
|
QList<BuildStepFactory *> factories = ExtensionSystem::PluginManager::getObjects<BuildStepFactory>();
|
||||||
foreach (IBuildStepFactory *factory, factories) {
|
foreach (BuildStepFactory *factory, factories) {
|
||||||
const QList<BuildStepInfo> infos = factory->availableSteps(m_buildStepList);
|
if (factory->canHandle(m_buildStepList)) {
|
||||||
for (const BuildStepInfo &info : infos) {
|
const BuildStepInfo &info = factory->stepInfo();
|
||||||
if (info.flags & BuildStepInfo::Uncreatable)
|
if (info.flags & BuildStepInfo::Uncreatable)
|
||||||
continue;
|
continue;
|
||||||
if ((info.flags & BuildStepInfo::UniqueStep) && m_buildStepList->contains(info.id))
|
if ((info.flags & BuildStepInfo::UniqueStep) && m_buildStepList->contains(info.id))
|
||||||
@@ -304,11 +304,11 @@ void BuildStepListWidget::updateAddBuildStepMenu()
|
|||||||
QMenu *menu = m_addButton->menu();
|
QMenu *menu = m_addButton->menu();
|
||||||
menu->clear();
|
menu->clear();
|
||||||
if (!map.isEmpty()) {
|
if (!map.isEmpty()) {
|
||||||
QMap<QString, QPair<Core::Id, IBuildStepFactory *> >::const_iterator it, end;
|
QMap<QString, QPair<Core::Id, BuildStepFactory *> >::const_iterator it, end;
|
||||||
end = map.constEnd();
|
end = map.constEnd();
|
||||||
for (it = map.constBegin(); it != end; ++it) {
|
for (it = map.constBegin(); it != end; ++it) {
|
||||||
QAction *action = menu->addAction(it.key());
|
QAction *action = menu->addAction(it.key());
|
||||||
IBuildStepFactory *factory = it.value().second;
|
BuildStepFactory *factory = it.value().second;
|
||||||
Core::Id id = it.value().first;
|
Core::Id id = it.value().first;
|
||||||
|
|
||||||
connect(action, &QAction::triggered, [id, factory, this]() {
|
connect(action, &QAction::triggered, [id, factory, this]() {
|
||||||
|
@@ -83,24 +83,13 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *target)
|
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *target)
|
||||||
: RunConfiguration(target)
|
: RunConfiguration(target, CUSTOM_EXECUTABLE_ID)
|
||||||
{
|
{
|
||||||
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
|
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
|
||||||
addExtraAspect(new ArgumentsAspect(this, "ProjectExplorer.CustomExecutableRunConfiguration.Arguments"));
|
addExtraAspect(new ArgumentsAspect(this, "ProjectExplorer.CustomExecutableRunConfiguration.Arguments"));
|
||||||
addExtraAspect(new TerminalAspect(this, "ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal"));
|
addExtraAspect(new TerminalAspect(this, "ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomExecutableRunConfiguration::initialize(Core::Id)
|
|
||||||
{
|
|
||||||
RunConfiguration::initialize(CUSTOM_EXECUTABLE_ID);
|
|
||||||
if (target()->activeBuildConfiguration())
|
|
||||||
m_workingDirectory = Constants::DEFAULT_WORKING_DIR;
|
|
||||||
else
|
|
||||||
m_workingDirectory = Constants::DEFAULT_WORKING_DIR_ALTERNATE;
|
|
||||||
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: Qt4Project deletes all empty customexecrunconfigs for which isConfigured() == false.
|
// Note: Qt4Project deletes all empty customexecrunconfigs for which isConfigured() == false.
|
||||||
CustomExecutableRunConfiguration::~CustomExecutableRunConfiguration()
|
CustomExecutableRunConfiguration::~CustomExecutableRunConfiguration()
|
||||||
{
|
{
|
||||||
|
@@ -65,14 +65,10 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
void initialize(Core::Id) override;
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QString defaultDisplayName() const;
|
QString defaultDisplayName() const;
|
||||||
|
|
||||||
private:
|
|
||||||
void ctor();
|
|
||||||
|
|
||||||
void configurationDialogFinished();
|
void configurationDialogFinished();
|
||||||
void setExecutable(const QString &executable);
|
void setExecutable(const QString &executable);
|
||||||
QString rawExecutable() const;
|
QString rawExecutable() const;
|
||||||
|
@@ -34,62 +34,51 @@
|
|||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
const char BUILD_STEP_LIST_COUNT[] = "ProjectExplorer.BuildConfiguration.BuildStepListCount";
|
const char BUILD_STEP_LIST_COUNT[] = "ProjectExplorer.BuildConfiguration.BuildStepListCount";
|
||||||
const char BUILD_STEP_LIST_PREFIX[] = "ProjectExplorer.BuildConfiguration.BuildStepList.";
|
const char BUILD_STEP_LIST_PREFIX[] = "ProjectExplorer.BuildConfiguration.BuildStepList.";
|
||||||
const char DEFAULT_DEPLOYCONFIGURATION_ID[] = "ProjectExplorer.DefaultDeployConfiguration";
|
const char DEFAULT_DEPLOYCONFIGURATION_ID[] = "ProjectExplorer.DefaultDeployConfiguration";
|
||||||
|
|
||||||
DeployConfiguration::DeployConfiguration(Target *target, Core::Id id) :
|
DeployConfiguration::DeployConfiguration(Target *target, Core::Id id)
|
||||||
ProjectConfiguration(target)
|
: ProjectConfiguration(target, id),
|
||||||
{
|
m_stepList(this, Constants::BUILDSTEPS_DEPLOY)
|
||||||
ProjectConfiguration::initialize(id);
|
|
||||||
Q_ASSERT(target);
|
|
||||||
m_stepList = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_DEPLOY));
|
|
||||||
//: Display name of the deploy build step list. Used as part of the labels in the project window.
|
|
||||||
m_stepList->setDefaultDisplayName(tr("Deploy"));
|
|
||||||
//: Default DeployConfiguration display name
|
|
||||||
setDefaultDisplayName(tr("Deploy locally"));
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
DeployConfiguration::DeployConfiguration(Target *target, DeployConfiguration *source) :
|
|
||||||
ProjectConfiguration(target)
|
|
||||||
{
|
|
||||||
ProjectConfiguration::copyFrom(source);
|
|
||||||
Q_ASSERT(target);
|
|
||||||
// Do not clone stepLists here, do that in the derived constructor instead
|
|
||||||
// otherwise BuildStepFactories might reject to set up a BuildStep for us
|
|
||||||
// since we are not yet the derived class!
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeployConfiguration::ctor()
|
|
||||||
{
|
{
|
||||||
Utils::MacroExpander *expander = macroExpander();
|
Utils::MacroExpander *expander = macroExpander();
|
||||||
expander->setDisplayName(tr("Deploy Settings"));
|
expander->setDisplayName(tr("Deploy Settings"));
|
||||||
expander->setAccumulating(true);
|
expander->setAccumulating(true);
|
||||||
expander->registerSubProvider([this]() -> Utils::MacroExpander * {
|
expander->registerSubProvider([target] {
|
||||||
BuildConfiguration *bc = target()->activeBuildConfiguration();
|
BuildConfiguration *bc = target->activeBuildConfiguration();
|
||||||
return bc ? bc->macroExpander() : target()->macroExpander();
|
return bc ? bc->macroExpander() : target->macroExpander();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//: Display name of the deploy build step list. Used as part of the labels in the project window.
|
||||||
|
m_stepList.setDefaultDisplayName(tr("Deploy"));
|
||||||
|
//: Default DeployConfiguration display name
|
||||||
|
setDefaultDisplayName(tr("Deploy locally"));
|
||||||
}
|
}
|
||||||
|
|
||||||
DeployConfiguration::~DeployConfiguration()
|
void DeployConfiguration::initialize()
|
||||||
{
|
{
|
||||||
delete m_stepList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStepList *DeployConfiguration::stepList() const
|
BuildStepList *DeployConfiguration::stepList()
|
||||||
{
|
{
|
||||||
return m_stepList;
|
return &m_stepList;
|
||||||
|
}
|
||||||
|
|
||||||
|
const BuildStepList *DeployConfiguration::stepList() const
|
||||||
|
{
|
||||||
|
return &m_stepList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap DeployConfiguration::toMap() const
|
QVariantMap DeployConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map(ProjectConfiguration::toMap());
|
QVariantMap map(ProjectConfiguration::toMap());
|
||||||
map.insert(QLatin1String(BUILD_STEP_LIST_COUNT), 1);
|
map.insert(QLatin1String(BUILD_STEP_LIST_COUNT), 1);
|
||||||
map.insert(QLatin1String(BUILD_STEP_LIST_PREFIX) + QLatin1Char('0'), m_stepList->toMap());
|
map.insert(QLatin1String(BUILD_STEP_LIST_PREFIX) + QLatin1Char('0'), m_stepList.toMap());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,23 +107,18 @@ bool DeployConfiguration::fromMap(const QVariantMap &map)
|
|||||||
return false;
|
return false;
|
||||||
QVariantMap data = map.value(QLatin1String(BUILD_STEP_LIST_PREFIX) + QLatin1Char('0')).toMap();
|
QVariantMap data = map.value(QLatin1String(BUILD_STEP_LIST_PREFIX) + QLatin1Char('0')).toMap();
|
||||||
if (!data.isEmpty()) {
|
if (!data.isEmpty()) {
|
||||||
delete m_stepList;
|
m_stepList.clear();
|
||||||
m_stepList = new BuildStepList(this, Core::Id());
|
if (!m_stepList.fromMap(data)) {
|
||||||
if (!m_stepList->fromMap(data)) {
|
|
||||||
qWarning() << "Failed to restore deploy step list";
|
qWarning() << "Failed to restore deploy step list";
|
||||||
delete m_stepList;
|
m_stepList.clear();
|
||||||
m_stepList = 0;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_stepList->setDefaultDisplayName(tr("Deploy"));
|
m_stepList.setDefaultDisplayName(tr("Deploy"));
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "No data for deploy step list found!";
|
qWarning() << "No data for deploy step list found!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We assume that we hold the deploy list
|
|
||||||
Q_ASSERT(m_stepList && m_stepList->id() == Constants::BUILDSTEPS_DEPLOY);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,37 +137,122 @@ bool DeployConfiguration::isActive() const
|
|||||||
return target()->isActive() && target()->activeDeployConfiguration() == this;
|
return target()->isActive() && target()->activeDeployConfiguration() == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeployConfiguration::cloneSteps(DeployConfiguration *source)
|
|
||||||
{
|
|
||||||
if (source == this)
|
|
||||||
return;
|
|
||||||
delete m_stepList;
|
|
||||||
m_stepList = new BuildStepList(this, source->stepList());
|
|
||||||
m_stepList->cloneSteps(source->stepList());
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
// DefaultDeployConfiguration
|
|
||||||
///
|
|
||||||
DefaultDeployConfiguration::DefaultDeployConfiguration(Target *target, Core::Id id)
|
|
||||||
: DeployConfiguration(target, id)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
DefaultDeployConfiguration::DefaultDeployConfiguration(Target *target, DeployConfiguration *source)
|
|
||||||
: DeployConfiguration(target, source)
|
|
||||||
{
|
|
||||||
cloneSteps(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// DeployConfigurationFactory
|
// DeployConfigurationFactory
|
||||||
///
|
///
|
||||||
|
|
||||||
DeployConfigurationFactory::DeployConfigurationFactory(QObject *parent) :
|
DeployConfigurationFactory::DeployConfigurationFactory()
|
||||||
QObject(parent)
|
{
|
||||||
{ setObjectName(QLatin1String("DeployConfigurationFactory")); }
|
setObjectName("DeployConfigurationFactory");
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<Core::Id> DeployConfigurationFactory::availableCreationIds(Target *parent) const
|
||||||
|
{
|
||||||
|
if (!canHandle(parent))
|
||||||
|
return {};
|
||||||
|
return Utils::transform(availableBuildTargets(parent), [this](const QString &suffix) {
|
||||||
|
return m_deployConfigBaseId.withSuffix(suffix);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QString> DeployConfigurationFactory::availableBuildTargets(Target *) const
|
||||||
|
{
|
||||||
|
return {QString()};
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DeployConfigurationFactory::displayNameForBuildTarget(const QString &) const
|
||||||
|
{
|
||||||
|
return m_defaultDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DeployConfigurationFactory::displayNameForId(Core::Id id) const
|
||||||
|
{
|
||||||
|
return displayNameForBuildTarget(id.suffixAfter(m_deployConfigBaseId));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeployConfigurationFactory::canHandle(Target *target) const
|
||||||
|
{
|
||||||
|
if (m_supportedProjectType.isValid()) {
|
||||||
|
if (target->project()->id() != m_supportedProjectType)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!target->project()->supportsKit(target->kit()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!m_supportedTargetDeviceTypes.isEmpty()) {
|
||||||
|
if (!m_supportedTargetDeviceTypes.contains(
|
||||||
|
DeviceTypeKitInformation::deviceTypeId(target->kit())))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeployConfigurationFactory::canCreate(Target *parent, Core::Id id) const
|
||||||
|
{
|
||||||
|
if (!canHandle(parent))
|
||||||
|
return false;
|
||||||
|
if (!id.name().startsWith(m_deployConfigBaseId.name()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeployConfiguration *DeployConfigurationFactory::create(Target *parent, Core::Id id)
|
||||||
|
{
|
||||||
|
if (!canCreate(parent, id))
|
||||||
|
return nullptr;
|
||||||
|
QTC_ASSERT(m_creator, return nullptr);
|
||||||
|
DeployConfiguration *dc = m_creator(parent);
|
||||||
|
if (!dc)
|
||||||
|
return nullptr;
|
||||||
|
dc->initialize();
|
||||||
|
return dc;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeployConfigurationFactory::canClone(Target *parent, DeployConfiguration *product) const
|
||||||
|
{
|
||||||
|
if (!canHandle(parent))
|
||||||
|
return false;
|
||||||
|
const Core::Id id = product->id();
|
||||||
|
if (!id.name().startsWith(m_deployConfigBaseId.name()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeployConfiguration *DeployConfigurationFactory::clone(Target *parent, DeployConfiguration *product)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_creator, return nullptr);
|
||||||
|
if (!canClone(parent, product))
|
||||||
|
return nullptr;
|
||||||
|
DeployConfiguration *dc = m_creator(parent);
|
||||||
|
QVariantMap data = product->toMap();
|
||||||
|
dc->fromMap(data);
|
||||||
|
return dc;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeployConfiguration *DeployConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
||||||
|
{
|
||||||
|
if (!canRestore(parent, map))
|
||||||
|
return nullptr;
|
||||||
|
QTC_ASSERT(m_creator, return nullptr);
|
||||||
|
DeployConfiguration *dc = m_creator(parent);
|
||||||
|
QTC_ASSERT(dc, return nullptr);
|
||||||
|
if (!dc->fromMap(map)) {
|
||||||
|
delete dc;
|
||||||
|
dc = nullptr;
|
||||||
|
}
|
||||||
|
return dc;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
||||||
|
{
|
||||||
|
if (!canHandle(parent))
|
||||||
|
return false;
|
||||||
|
const Core::Id id = idFromMap(map);
|
||||||
|
return id.name().startsWith(m_deployConfigBaseId.name());
|
||||||
|
}
|
||||||
|
|
||||||
DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
@@ -209,73 +278,44 @@ DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, Dep
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeployConfigurationFactory::setSupportedTargetDeviceTypes(const QList<Core::Id> &ids)
|
||||||
|
{
|
||||||
|
m_supportedTargetDeviceTypes = ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeployConfigurationFactory::setDefaultDisplayName(const QString &defaultDisplayName)
|
||||||
|
{
|
||||||
|
m_defaultDisplayName = defaultDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeployConfigurationFactory::setSupportedProjectType(Core::Id id)
|
||||||
|
{
|
||||||
|
m_supportedProjectType = id;
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
// DefaultDeployConfigurationFactory
|
// DefaultDeployConfigurationFactory
|
||||||
///
|
///
|
||||||
|
|
||||||
QList<Core::Id> DefaultDeployConfigurationFactory::availableCreationIds(Target *parent) const
|
DefaultDeployConfigurationFactory::DefaultDeployConfigurationFactory()
|
||||||
{
|
{
|
||||||
if (!canHandle(parent))
|
struct DefaultDeployConfiguration : DeployConfiguration
|
||||||
return QList<Core::Id>();
|
{
|
||||||
return QList<Core::Id>() << Core::Id(DEFAULT_DEPLOYCONFIGURATION_ID);
|
DefaultDeployConfiguration(Target *t)
|
||||||
}
|
: DeployConfiguration(t, DEFAULT_DEPLOYCONFIGURATION_ID)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
QString DefaultDeployConfigurationFactory::displayNameForId(Core::Id id) const
|
registerDeployConfiguration<DefaultDeployConfiguration>(DEFAULT_DEPLOYCONFIGURATION_ID);
|
||||||
{
|
setSupportedTargetDeviceTypes({Constants::DESKTOP_DEVICE_TYPE});
|
||||||
if (id == DEFAULT_DEPLOYCONFIGURATION_ID)
|
|
||||||
//: Display name of the default deploy configuration
|
//: Display name of the default deploy configuration
|
||||||
return DeployConfigurationFactory::tr("Deploy Configuration");
|
setDefaultDisplayName(DeployConfigurationFactory::tr("Deploy Configuration"));
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DefaultDeployConfigurationFactory::canCreate(Target *parent, Core::Id id) const
|
|
||||||
{
|
|
||||||
if (!canHandle(parent))
|
|
||||||
return false;
|
|
||||||
return id == DEFAULT_DEPLOYCONFIGURATION_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
DeployConfiguration *DefaultDeployConfigurationFactory::create(Target *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
if (!canCreate(parent, id))
|
|
||||||
return nullptr;
|
|
||||||
return new DefaultDeployConfiguration(parent, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DefaultDeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
|
||||||
{
|
|
||||||
return canCreate(parent, idFromMap(map));
|
|
||||||
}
|
|
||||||
|
|
||||||
DeployConfiguration *DefaultDeployConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
|
||||||
{
|
|
||||||
if (!canRestore(parent, map))
|
|
||||||
return nullptr;
|
|
||||||
auto dc = new DefaultDeployConfiguration(parent, idFromMap(map));
|
|
||||||
if (!dc->fromMap(map)) {
|
|
||||||
delete dc;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return dc;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DefaultDeployConfigurationFactory::canClone(Target *parent, DeployConfiguration *product) const
|
|
||||||
{
|
|
||||||
return canCreate(parent, product->id());
|
|
||||||
}
|
|
||||||
|
|
||||||
DeployConfiguration *DefaultDeployConfigurationFactory::clone(Target *parent, DeployConfiguration *product)
|
|
||||||
{
|
|
||||||
if (!canClone(parent, product))
|
|
||||||
return nullptr;
|
|
||||||
return new DefaultDeployConfiguration(parent, product);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefaultDeployConfigurationFactory::canHandle(Target *parent) const
|
bool DefaultDeployConfigurationFactory::canHandle(Target *parent) const
|
||||||
{
|
{
|
||||||
if (!parent->project()->supportsKit(parent->kit()) || parent->project()->needsSpecialDeployment())
|
return DeployConfigurationFactory::canHandle(parent)
|
||||||
return false;
|
&& !parent->project()->needsSpecialDeployment();
|
||||||
return DeviceTypeKitInformation::deviceTypeId(parent->kit()) == Constants::DESKTOP_DEVICE_TYPE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -27,12 +27,9 @@
|
|||||||
|
|
||||||
#include "projectexplorer_export.h"
|
#include "projectexplorer_export.h"
|
||||||
|
|
||||||
|
#include "buildsteplist.h"
|
||||||
#include "projectconfiguration.h"
|
#include "projectconfiguration.h"
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QStringList)
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class BuildStepList;
|
class BuildStepList;
|
||||||
@@ -44,11 +41,16 @@ class PROJECTEXPLORER_EXPORT DeployConfiguration : public ProjectConfiguration
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
protected:
|
||||||
// ctors are protected
|
friend class DeployConfigurationFactory;
|
||||||
~DeployConfiguration() override;
|
explicit DeployConfiguration(Target *target, Core::Id id);
|
||||||
|
|
||||||
BuildStepList *stepList() const;
|
public:
|
||||||
|
~DeployConfiguration() override = default;
|
||||||
|
virtual void initialize();
|
||||||
|
|
||||||
|
BuildStepList *stepList();
|
||||||
|
const BuildStepList *stepList() const;
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
@@ -66,26 +68,8 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void enabledChanged();
|
void enabledChanged();
|
||||||
|
|
||||||
protected:
|
|
||||||
DeployConfiguration(Target *target, Core::Id id);
|
|
||||||
DeployConfiguration(Target *target, DeployConfiguration *source);
|
|
||||||
|
|
||||||
void cloneSteps(DeployConfiguration *source);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
BuildStepList m_stepList;
|
||||||
|
|
||||||
BuildStepList *m_stepList = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT DefaultDeployConfiguration : public DeployConfiguration
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
friend class DefaultDeployConfigurationFactory; // for the ctors
|
|
||||||
|
|
||||||
protected:
|
|
||||||
DefaultDeployConfiguration(Target *target, Core::Id id);
|
|
||||||
DefaultDeployConfiguration(Target *target, DeployConfiguration *source);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT DeployConfigurationFactory : public QObject
|
class PROJECTEXPLORER_EXPORT DeployConfigurationFactory : public QObject
|
||||||
@@ -93,43 +77,66 @@ class PROJECTEXPLORER_EXPORT DeployConfigurationFactory : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DeployConfigurationFactory(QObject *parent = nullptr);
|
DeployConfigurationFactory();
|
||||||
|
|
||||||
// used to show the list of possible additons to a target, returns a list of types
|
// used to show the list of possible additons to a target, returns a list of types
|
||||||
virtual QList<Core::Id> availableCreationIds(Target *parent) const = 0;
|
QList<Core::Id> availableCreationIds(Target *parent) const;
|
||||||
// used to translate the types to names to display to the user
|
// used to translate the types to names to display to the user
|
||||||
virtual QString displayNameForId(Core::Id id) const = 0;
|
QString displayNameForId(Core::Id id) const;
|
||||||
|
|
||||||
virtual bool canCreate(Target *parent, Core::Id id) const = 0;
|
virtual bool canHandle(ProjectExplorer::Target *target) const;
|
||||||
virtual DeployConfiguration *create(Target *parent, Core::Id id) = 0;
|
|
||||||
|
bool canCreate(Target *parent, Core::Id id) const;
|
||||||
|
virtual DeployConfiguration *create(Target *parent, Core::Id id);
|
||||||
// used to recreate the runConfigurations when restoring settings
|
// used to recreate the runConfigurations when restoring settings
|
||||||
virtual bool canRestore(Target *parent, const QVariantMap &map) const = 0;
|
bool canRestore(Target *parent, const QVariantMap &map) const;
|
||||||
virtual DeployConfiguration *restore(Target *parent, const QVariantMap &map) = 0;
|
DeployConfiguration *restore(Target *parent, const QVariantMap &map);
|
||||||
virtual bool canClone(Target *parent, DeployConfiguration *product) const = 0;
|
bool canClone(Target *parent, DeployConfiguration *product) const;
|
||||||
virtual DeployConfiguration *clone(Target *parent, DeployConfiguration *product) = 0;
|
DeployConfiguration *clone(Target *parent, DeployConfiguration *product);
|
||||||
|
|
||||||
static DeployConfigurationFactory *find(Target *parent, const QVariantMap &map);
|
static DeployConfigurationFactory *find(Target *parent, const QVariantMap &map);
|
||||||
static QList<DeployConfigurationFactory *> find(Target *parent);
|
static QList<DeployConfigurationFactory *> find(Target *parent);
|
||||||
static DeployConfigurationFactory *find(Target *parent, DeployConfiguration *dc);
|
static DeployConfigurationFactory *find(Target *parent, DeployConfiguration *dc);
|
||||||
|
|
||||||
|
void setSupportedTargetDeviceTypes(const QList<Core::Id> &ids);
|
||||||
|
void setDefaultDisplayName(const QString &defaultDisplayName);
|
||||||
|
void setSupportedProjectType(Core::Id id);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual QList<QString> availableBuildTargets(Target *parent) const;
|
||||||
|
virtual QString displayNameForBuildTarget(const QString &buildTarget) const;
|
||||||
|
|
||||||
|
using DeployConfigurationCreator = std::function<DeployConfiguration *(Target *)>;
|
||||||
|
|
||||||
|
template <class DeployConfig>
|
||||||
|
void registerDeployConfiguration(Core::Id deployConfigBaseId)
|
||||||
|
{
|
||||||
|
m_creator = [this](Target *t) {
|
||||||
|
auto dc = new DeployConfig(t);
|
||||||
|
dc->setDefaultDisplayName(m_defaultDisplayName);
|
||||||
|
return dc;
|
||||||
|
};
|
||||||
|
m_deployConfigBaseId = deployConfigBaseId;
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void availableCreationIdsChanged();
|
void availableCreationIdsChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DeployConfigurationCreator m_creator;
|
||||||
|
Core::Id m_deployConfigBaseId;
|
||||||
|
Core::Id m_supportedProjectType;
|
||||||
|
QList<Core::Id> m_supportedTargetDeviceTypes;
|
||||||
|
QString m_defaultDisplayName;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DefaultDeployConfigurationFactory : public DeployConfigurationFactory
|
class DefaultDeployConfigurationFactory : public DeployConfigurationFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QList<Core::Id> availableCreationIds(Target *parent) const override;
|
DefaultDeployConfigurationFactory();
|
||||||
// used to translate the types to names to display to the user
|
|
||||||
QString displayNameForId(Core::Id id) const override;
|
|
||||||
bool canCreate(Target *parent, Core::Id id) const override;
|
|
||||||
DeployConfiguration *create(Target *parent, Core::Id id) override;
|
|
||||||
bool canRestore(Target *parent, const QVariantMap &map) const override;
|
|
||||||
DeployConfiguration *restore(Target *parent, const QVariantMap &map) override;
|
|
||||||
bool canClone(Target *parent, DeployConfiguration *product) const override;
|
|
||||||
DeployConfiguration *clone(Target *parent, DeployConfiguration *product) override;
|
|
||||||
private:
|
private:
|
||||||
bool canHandle(Target *parent) const;
|
bool canHandle(Target *parent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -35,14 +35,8 @@
|
|||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl, Core::Id id)
|
DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl)
|
||||||
: BuildStep(bsl, id)
|
: BuildStep(bsl, stepId())
|
||||||
{
|
|
||||||
setDefaultDisplayName(stepDisplayName());
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl, DeviceCheckBuildStep *bs)
|
|
||||||
: BuildStep(bsl, bs)
|
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(stepDisplayName());
|
setDefaultDisplayName(stepDisplayName());
|
||||||
}
|
}
|
||||||
|
@@ -36,8 +36,7 @@ class PROJECTEXPLORER_EXPORT DeviceCheckBuildStep : public BuildStep
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DeviceCheckBuildStep(BuildStepList *bsl, Core::Id id);
|
explicit DeviceCheckBuildStep(BuildStepList *bsl);
|
||||||
DeviceCheckBuildStep(BuildStepList *bsl, DeviceCheckBuildStep *bs);
|
|
||||||
|
|
||||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||||
|
|
||||||
|
@@ -46,20 +46,8 @@ const char PROCESS_WORKINGDIRECTORY_KEY[] = "ProjectExplorer.ProcessStep.Working
|
|||||||
const char PROCESS_ARGUMENTS_KEY[] = "ProjectExplorer.ProcessStep.Arguments";
|
const char PROCESS_ARGUMENTS_KEY[] = "ProjectExplorer.ProcessStep.Arguments";
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessStep::ProcessStep(BuildStepList *bsl) : AbstractProcessStep(bsl, Core::Id(PROCESS_STEP_ID))
|
ProcessStep::ProcessStep(BuildStepList *bsl)
|
||||||
{
|
: AbstractProcessStep(bsl, PROCESS_STEP_ID)
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessStep::ProcessStep(BuildStepList *bsl, ProcessStep *bs) : AbstractProcessStep(bsl, bs),
|
|
||||||
m_command(bs->m_command),
|
|
||||||
m_arguments(bs->m_arguments),
|
|
||||||
m_workingDirectory(bs->m_workingDirectory)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessStep::ctor()
|
|
||||||
{
|
{
|
||||||
//: Default ProcessStep display name
|
//: Default ProcessStep display name
|
||||||
setDefaultDisplayName(tr("Custom Process Step"));
|
setDefaultDisplayName(tr("Custom Process Step"));
|
||||||
@@ -156,21 +144,13 @@ bool ProcessStep::fromMap(const QVariantMap &map)
|
|||||||
// ProcessStepFactory
|
// ProcessStepFactory
|
||||||
//*******
|
//*******
|
||||||
|
|
||||||
QList<BuildStepInfo> ProcessStepFactory::availableSteps(BuildStepList *parent) const
|
ProcessStepFactory::ProcessStepFactory()
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
registerStep<ProcessStep>(PROCESS_STEP_ID);
|
||||||
return {{PROCESS_STEP_ID, ProcessStep::tr("Custom Process Step", "item in combobox")}};
|
setDisplayName(ProcessStep::tr("Custom Process Step", "item in combobox"));
|
||||||
}
|
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD,
|
||||||
|
ProjectExplorer::Constants::BUILDSTEPS_CLEAN,
|
||||||
BuildStep *ProcessStepFactory::create(BuildStepList *parent, Core::Id id)
|
ProjectExplorer::Constants::BUILDSTEPS_DEPLOY});
|
||||||
{
|
|
||||||
Q_UNUSED(id);
|
|
||||||
return new ProcessStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildStep *ProcessStepFactory::clone(BuildStepList *parent, BuildStep *bs)
|
|
||||||
{
|
|
||||||
return new ProcessStep(parent, static_cast<ProcessStep *>(bs));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//*******
|
//*******
|
||||||
|
@@ -29,19 +29,14 @@
|
|||||||
#include "abstractprocessstep.h"
|
#include "abstractprocessstep.h"
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ProcessStepFactory : public IBuildStepFactory
|
class ProcessStepFactory : public BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
ProcessStepFactory();
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
BuildStep *create(BuildStepList *parent, Core::Id id) override;
|
|
||||||
BuildStep *clone(BuildStepList *parent, BuildStep *product) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ProcessStep : public AbstractProcessStep
|
class ProcessStep : public AbstractProcessStep
|
||||||
@@ -68,13 +63,8 @@ public:
|
|||||||
|
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
ProcessStep(BuildStepList *bsl, ProcessStep *bs);
|
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
QString m_command;
|
QString m_command;
|
||||||
QString m_arguments;
|
QString m_arguments;
|
||||||
|
@@ -25,35 +25,36 @@
|
|||||||
|
|
||||||
#include "projectconfiguration.h"
|
#include "projectconfiguration.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
const char CONFIGURATION_ID_KEY[] = "ProjectExplorer.ProjectConfiguration.Id";
|
const char CONFIGURATION_ID_KEY[] = "ProjectExplorer.ProjectConfiguration.Id";
|
||||||
const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayName";
|
const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayName";
|
||||||
const char DEFAULT_DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DefaultDisplayName";
|
const char DEFAULT_DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DefaultDisplayName";
|
||||||
|
|
||||||
ProjectConfiguration::ProjectConfiguration(QObject *parent)
|
ProjectConfiguration::ProjectConfiguration(QObject *parent, Core::Id id)
|
||||||
: QObject(parent)
|
: QObject(parent), m_id(id)
|
||||||
{}
|
|
||||||
|
|
||||||
void ProjectConfiguration::initialize(Core::Id id)
|
|
||||||
{
|
{
|
||||||
m_id = id;
|
QTC_CHECK(id.isValid());
|
||||||
setObjectName(id.toString());
|
setObjectName(id.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectConfiguration::copyFrom(const ProjectConfiguration *source)
|
|
||||||
{
|
|
||||||
Q_ASSERT(source);
|
|
||||||
m_id = source->m_id;
|
|
||||||
m_defaultDisplayName = source->m_defaultDisplayName;
|
|
||||||
m_displayName = tr("Clone of %1").arg(source->displayName());
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::Id ProjectConfiguration::id() const
|
Core::Id ProjectConfiguration::id() const
|
||||||
{
|
{
|
||||||
return m_id;
|
return m_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ProjectConfiguration::extraId() const
|
||||||
|
{
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProjectConfiguration::settingsIdKey()
|
||||||
|
{
|
||||||
|
return QString(CONFIGURATION_ID_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
QString ProjectConfiguration::displayName() const
|
QString ProjectConfiguration::displayName() const
|
||||||
{
|
{
|
||||||
if (!m_displayName.isEmpty())
|
if (!m_displayName.isEmpty())
|
||||||
@@ -102,8 +103,9 @@ bool ProjectConfiguration::usesDefaultDisplayName() const
|
|||||||
|
|
||||||
QVariantMap ProjectConfiguration::toMap() const
|
QVariantMap ProjectConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
|
QTC_CHECK(m_id.isValid());
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
map.insert(QLatin1String(CONFIGURATION_ID_KEY), m_id.toSetting());
|
map.insert(QLatin1String(CONFIGURATION_ID_KEY), m_id.withSuffix(extraId()).toSetting());
|
||||||
map.insert(QLatin1String(DISPLAY_NAME_KEY), m_displayName);
|
map.insert(QLatin1String(DISPLAY_NAME_KEY), m_displayName);
|
||||||
map.insert(QLatin1String(DEFAULT_DISPLAY_NAME_KEY), m_defaultDisplayName);
|
map.insert(QLatin1String(DEFAULT_DISPLAY_NAME_KEY), m_defaultDisplayName);
|
||||||
return map;
|
return map;
|
||||||
@@ -111,12 +113,14 @@ QVariantMap ProjectConfiguration::toMap() const
|
|||||||
|
|
||||||
bool ProjectConfiguration::fromMap(const QVariantMap &map)
|
bool ProjectConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
m_id = Core::Id::fromSetting(map.value(QLatin1String(CONFIGURATION_ID_KEY)));
|
Core::Id id = Core::Id::fromSetting(map.value(QLatin1String(CONFIGURATION_ID_KEY)));
|
||||||
|
QTC_ASSERT(id.toString().startsWith(m_id.toString()), return false);
|
||||||
|
|
||||||
m_displayName = map.value(QLatin1String(DISPLAY_NAME_KEY), QString()).toString();
|
m_displayName = map.value(QLatin1String(DISPLAY_NAME_KEY), QString()).toString();
|
||||||
m_defaultDisplayName = map.value(QLatin1String(DEFAULT_DISPLAY_NAME_KEY),
|
m_defaultDisplayName = map.value(QLatin1String(DEFAULT_DISPLAY_NAME_KEY),
|
||||||
m_defaultDisplayName.isEmpty() ?
|
m_defaultDisplayName.isEmpty() ?
|
||||||
m_displayName : m_defaultDisplayName).toString();
|
m_displayName : m_defaultDisplayName).toString();
|
||||||
return m_id.isValid();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id ProjectExplorer::idFromMap(const QVariantMap &map)
|
Core::Id ProjectExplorer::idFromMap(const QVariantMap &map)
|
||||||
@@ -134,16 +138,10 @@ bool StatefulProjectConfiguration::isEnabled() const
|
|||||||
return m_isEnabled;
|
return m_isEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
StatefulProjectConfiguration::StatefulProjectConfiguration(QObject *parent) :
|
StatefulProjectConfiguration::StatefulProjectConfiguration(QObject *parent, Core::Id id) :
|
||||||
ProjectConfiguration(parent)
|
ProjectConfiguration(parent, id)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void StatefulProjectConfiguration::copyFrom(const StatefulProjectConfiguration *source)
|
|
||||||
{
|
|
||||||
ProjectConfiguration::copyFrom(source);
|
|
||||||
m_isEnabled = source->m_isEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void StatefulProjectConfiguration::setEnabled(bool enabled)
|
void StatefulProjectConfiguration::setEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
if (enabled == m_isEnabled)
|
if (enabled == m_isEnabled)
|
||||||
|
@@ -42,11 +42,14 @@ class PROJECTEXPLORER_EXPORT ProjectConfiguration : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
protected:
|
||||||
|
explicit ProjectConfiguration(QObject *parent, Core::Id id);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// ctors are protected
|
|
||||||
~ProjectConfiguration() = default;
|
~ProjectConfiguration() = default;
|
||||||
|
|
||||||
Core::Id id() const;
|
Core::Id id() const;
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
|
|
||||||
bool usesDefaultDisplayName() const;
|
bool usesDefaultDisplayName() const;
|
||||||
@@ -69,17 +72,17 @@ public:
|
|||||||
|
|
||||||
virtual bool isActive() const = 0;
|
virtual bool isActive() const = 0;
|
||||||
|
|
||||||
|
// Used in settings to mangle in build targets in RunConfigurations.
|
||||||
|
virtual QString extraId() const;
|
||||||
|
|
||||||
|
static QString settingsIdKey();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void displayNameChanged();
|
void displayNameChanged();
|
||||||
void toolTipChanged();
|
void toolTipChanged();
|
||||||
|
|
||||||
protected:
|
|
||||||
ProjectConfiguration(QObject *parent);
|
|
||||||
void initialize(Core::Id id);
|
|
||||||
void copyFrom(const ProjectConfiguration *source);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::Id m_id;
|
const Core::Id m_id;
|
||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
QString m_defaultDisplayName;
|
QString m_defaultDisplayName;
|
||||||
QString m_toolTip;
|
QString m_toolTip;
|
||||||
@@ -101,8 +104,7 @@ signals:
|
|||||||
void enabledChanged();
|
void enabledChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
StatefulProjectConfiguration(QObject *parent);
|
StatefulProjectConfiguration(QObject *parent, Core::Id id);
|
||||||
void copyFrom(const StatefulProjectConfiguration *source);
|
|
||||||
|
|
||||||
void setEnabled(bool enabled);
|
void setEnabled(bool enabled);
|
||||||
|
|
||||||
|
@@ -191,11 +191,9 @@ void IRunConfigurationAspect::resetProjectToGlobalSettings()
|
|||||||
|
|
||||||
static std::vector<RunConfiguration::AspectFactory> theAspectFactories;
|
static std::vector<RunConfiguration::AspectFactory> theAspectFactories;
|
||||||
|
|
||||||
RunConfiguration::RunConfiguration(Target *target)
|
RunConfiguration::RunConfiguration(Target *target, Core::Id id)
|
||||||
: StatefulProjectConfiguration(target)
|
: StatefulProjectConfiguration(target, id)
|
||||||
{
|
{
|
||||||
Q_ASSERT(target);
|
|
||||||
|
|
||||||
connect(target->project(), &Project::parsingStarted,
|
connect(target->project(), &Project::parsingStarted,
|
||||||
this, [this]() { updateEnabledState(); });
|
this, [this]() { updateEnabledState(); });
|
||||||
connect(target->project(), &Project::parsingFinished,
|
connect(target->project(), &Project::parsingFinished,
|
||||||
@@ -235,17 +233,6 @@ RunConfiguration::~RunConfiguration()
|
|||||||
qDeleteAll(m_aspects);
|
qDeleteAll(m_aspects);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunConfiguration::initialize(Core::Id id)
|
|
||||||
{
|
|
||||||
StatefulProjectConfiguration::initialize(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunConfiguration::copyFrom(const RunConfiguration *source)
|
|
||||||
{
|
|
||||||
QVariantMap data = source->toMap();
|
|
||||||
fromMap(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RunConfiguration::isActive() const
|
bool RunConfiguration::isActive() const
|
||||||
{
|
{
|
||||||
return target()->isActive() && target()->activeRunConfiguration() == this;
|
return target()->isActive() && target()->activeRunConfiguration() == this;
|
||||||
@@ -450,20 +437,17 @@ IRunConfigurationFactory::IRunConfigurationFactory(QObject *parent) :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Core::Id> IRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
|
QList<RunConfigurationCreationInfo>
|
||||||
|
IRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode) const
|
||||||
{
|
{
|
||||||
if (!canHandle(parent))
|
if (!canHandle(parent))
|
||||||
return {};
|
return {};
|
||||||
return Utils::transform(availableBuildTargets(parent, mode), [this](const QString &suffix) {
|
return Utils::transform(availableBuildTargets(parent, mode), [this](const QString &suffix) {
|
||||||
return m_runConfigBaseId.withSuffix(suffix);
|
return RunConfigurationCreationInfo{this, m_runConfigBaseId, suffix,
|
||||||
|
this->displayNameForBuildTarget(suffix)};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IRunConfigurationFactory::displayNameForId(Core::Id id) const
|
|
||||||
{
|
|
||||||
return displayNameForBuildTarget(id.suffixAfter(m_runConfigBaseId));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IRunConfigurationFactory::displayNameForBuildTarget(const QString &buildTarget) const
|
QString IRunConfigurationFactory::displayNameForBuildTarget(const QString &buildTarget) const
|
||||||
{
|
{
|
||||||
return buildTarget;
|
return buildTarget;
|
||||||
@@ -501,30 +485,30 @@ bool IRunConfigurationFactory::canCreateHelper(Target *, const QString &) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
|
RunConfiguration *IRunConfigurationFactory::create(Target *parent, Core::Id id, const QString &extra) const
|
||||||
{
|
{
|
||||||
if (!canHandle(parent))
|
if (!canHandle(parent))
|
||||||
return false;
|
|
||||||
if (!id.name().startsWith(m_runConfigBaseId.name()))
|
|
||||||
return false;
|
|
||||||
return canCreateHelper(parent, id.suffixAfter(m_runConfigBaseId));
|
|
||||||
}
|
|
||||||
|
|
||||||
RunConfiguration *IRunConfigurationFactory::create(Target *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
if (!canCreate(parent, id))
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
if (id != m_runConfigBaseId)
|
||||||
|
return nullptr;
|
||||||
|
if (!canCreateHelper(parent, extra))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
QTC_ASSERT(m_creator, return nullptr);
|
QTC_ASSERT(m_creator, return nullptr);
|
||||||
RunConfiguration *rc = m_creator(parent);
|
RunConfiguration *rc = m_creator(parent);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
rc->initialize(id);
|
|
||||||
return rc;
|
// "FIX" ids by mangling in the extra data (build system target etc)
|
||||||
|
// for compatibility for the current format used in settings.
|
||||||
|
if (!extra.isEmpty()) {
|
||||||
|
QVariantMap data = rc->toMap();
|
||||||
|
data[ProjectConfiguration::settingsIdKey()] = id.withSuffix(extra).toString();
|
||||||
|
rc->fromMap(data);
|
||||||
|
QVariantMap data2 = rc->toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IRunConfigurationFactory::canCloneHelper(Target *, RunConfiguration *) const
|
return rc;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IRunConfigurationFactory::canClone(Target *parent, RunConfiguration *product) const
|
bool IRunConfigurationFactory::canClone(Target *parent, RunConfiguration *product) const
|
||||||
@@ -532,19 +516,16 @@ bool IRunConfigurationFactory::canClone(Target *parent, RunConfiguration *produc
|
|||||||
if (!canHandle(parent))
|
if (!canHandle(parent))
|
||||||
return false;
|
return false;
|
||||||
const Core::Id id = product->id();
|
const Core::Id id = product->id();
|
||||||
if (!id.name().startsWith(m_runConfigBaseId.name()))
|
return id.name().startsWith(m_runConfigBaseId.name());
|
||||||
return false;
|
|
||||||
return canCloneHelper(parent, product);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration *IRunConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
RunConfiguration *IRunConfigurationFactory::restore(Target *parent, const QVariantMap &map) const
|
||||||
{
|
{
|
||||||
if (!canRestore(parent, map))
|
if (!canRestore(parent, map))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
QTC_ASSERT(m_creator, return nullptr);
|
QTC_ASSERT(m_creator, return nullptr);
|
||||||
RunConfiguration *rc = m_creator(parent);
|
RunConfiguration *rc = m_creator(parent);
|
||||||
QTC_ASSERT(rc, return nullptr);
|
QTC_ASSERT(rc, return nullptr);
|
||||||
rc->initialize(idFromMap(map));
|
|
||||||
if (!rc->fromMap(map)) {
|
if (!rc->fromMap(map)) {
|
||||||
delete rc;
|
delete rc;
|
||||||
rc = nullptr;
|
rc = nullptr;
|
||||||
@@ -560,13 +541,16 @@ bool IRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map
|
|||||||
return id.name().startsWith(m_runConfigBaseId.name());
|
return id.name().startsWith(m_runConfigBaseId.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration *IRunConfigurationFactory::clone(Target *parent, RunConfiguration *product)
|
RunConfiguration *IRunConfigurationFactory::clone(Target *parent, RunConfiguration *product) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_creator, return nullptr);
|
QTC_ASSERT(m_creator, return nullptr);
|
||||||
if (!canClone(parent, product))
|
if (!canClone(parent, product))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
RunConfiguration *runConfig = m_creator(parent);
|
RunConfiguration *runConfig = m_creator(parent);
|
||||||
runConfig->copyFrom(product);
|
|
||||||
|
QVariantMap data = product->toMap();
|
||||||
|
runConfig->fromMap(data);
|
||||||
|
|
||||||
return runConfig;
|
return runConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,7 +574,7 @@ QList<IRunConfigurationFactory *> IRunConfigurationFactory::find(Target *parent)
|
|||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>(
|
return ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>(
|
||||||
[&parent](IRunConfigurationFactory *factory) {
|
[&parent](IRunConfigurationFactory *factory) {
|
||||||
return !factory->availableCreationIds(parent).isEmpty();
|
return !factory->availableCreators(parent).isEmpty();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,6 +47,7 @@ namespace ProjectExplorer {
|
|||||||
class Abi;
|
class Abi;
|
||||||
class BuildConfiguration;
|
class BuildConfiguration;
|
||||||
class IRunConfigurationAspect;
|
class IRunConfigurationAspect;
|
||||||
|
class IRunConfigurationFactory;
|
||||||
class RunConfiguration;
|
class RunConfiguration;
|
||||||
class RunConfigWidget;
|
class RunConfigWidget;
|
||||||
class RunControl;
|
class RunControl;
|
||||||
@@ -262,9 +263,7 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
friend class IRunConfigurationFactory;
|
friend class IRunConfigurationFactory;
|
||||||
|
|
||||||
RunConfiguration(Target *target);
|
RunConfiguration(Target *target, Core::Id id);
|
||||||
virtual void initialize(Core::Id id);
|
|
||||||
void copyFrom(const RunConfiguration *source);
|
|
||||||
|
|
||||||
/// convenience function to get current build configuration.
|
/// convenience function to get current build configuration.
|
||||||
BuildConfiguration *activeBuildConfiguration() const;
|
BuildConfiguration *activeBuildConfiguration() const;
|
||||||
@@ -274,9 +273,24 @@ protected:
|
|||||||
private:
|
private:
|
||||||
static void addAspectFactory(const AspectFactory &aspectFactory);
|
static void addAspectFactory(const AspectFactory &aspectFactory);
|
||||||
|
|
||||||
|
friend class IRunConfigurationFactory;
|
||||||
|
|
||||||
QList<IRunConfigurationAspect *> m_aspects;
|
QList<IRunConfigurationAspect *> m_aspects;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RunConfigurationCreationInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RunConfigurationCreationInfo(const IRunConfigurationFactory *factory, Core::Id id,
|
||||||
|
QString extra, QString displayName)
|
||||||
|
: factory(factory) , id(id) , extra(extra) , displayName(displayName) {}
|
||||||
|
|
||||||
|
const IRunConfigurationFactory *factory = nullptr;
|
||||||
|
Core::Id id;
|
||||||
|
QString extra;
|
||||||
|
QString displayName;
|
||||||
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IRunConfigurationFactory : public QObject
|
class PROJECTEXPLORER_EXPORT IRunConfigurationFactory : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -285,17 +299,17 @@ public:
|
|||||||
explicit IRunConfigurationFactory(QObject *parent = nullptr);
|
explicit IRunConfigurationFactory(QObject *parent = nullptr);
|
||||||
|
|
||||||
enum CreationMode {UserCreate, AutoCreate};
|
enum CreationMode {UserCreate, AutoCreate};
|
||||||
QList<Core::Id> availableCreationIds(Target *parent, CreationMode mode = UserCreate) const;
|
|
||||||
QString displayNameForId(Core::Id id) const;
|
QList<RunConfigurationCreationInfo> availableCreators(Target *parent,
|
||||||
|
CreationMode mode = UserCreate) const;
|
||||||
|
|
||||||
virtual bool canHandle(Target *target) const;
|
virtual bool canHandle(Target *target) const;
|
||||||
|
|
||||||
bool canCreate(Target *parent, Core::Id id) const;
|
RunConfiguration *create(Target *parent, Core::Id id, const QString &extra) const;
|
||||||
RunConfiguration *create(Target *parent, Core::Id id);
|
|
||||||
bool canRestore(Target *parent, const QVariantMap &map) const;
|
bool canRestore(Target *parent, const QVariantMap &map) const;
|
||||||
RunConfiguration *restore(Target *parent, const QVariantMap &map);
|
RunConfiguration *restore(Target *parent, const QVariantMap &map) const;
|
||||||
bool canClone(Target *parent, RunConfiguration *product) const;
|
bool canClone(Target *parent, RunConfiguration *product) const;
|
||||||
RunConfiguration *clone(Target *parent, RunConfiguration *product);
|
RunConfiguration *clone(Target *parent, RunConfiguration *product) const;
|
||||||
|
|
||||||
static IRunConfigurationFactory *find(Target *parent, const QVariantMap &map);
|
static IRunConfigurationFactory *find(Target *parent, const QVariantMap &map);
|
||||||
static IRunConfigurationFactory *find(Target *parent, RunConfiguration *rc);
|
static IRunConfigurationFactory *find(Target *parent, RunConfiguration *rc);
|
||||||
@@ -309,7 +323,6 @@ protected:
|
|||||||
virtual QString displayNameForBuildTarget(const QString &buildTarget) const;
|
virtual QString displayNameForBuildTarget(const QString &buildTarget) const;
|
||||||
|
|
||||||
virtual bool canCreateHelper(Target *parent, const QString &buildTarget) const;
|
virtual bool canCreateHelper(Target *parent, const QString &buildTarget) const;
|
||||||
virtual bool canCloneHelper(Target *parent, RunConfiguration *product) const;
|
|
||||||
|
|
||||||
using RunConfigurationCreator = std::function<RunConfiguration *(Target *)>;
|
using RunConfigurationCreator = std::function<RunConfiguration *(Target *)>;
|
||||||
|
|
||||||
|
@@ -237,19 +237,19 @@ void RunSettingsWidget::aboutToShowAddMenu()
|
|||||||
connect(cloneAction, &QAction::triggered,
|
connect(cloneAction, &QAction::triggered,
|
||||||
this, &RunSettingsWidget::cloneRunConfiguration);
|
this, &RunSettingsWidget::cloneRunConfiguration);
|
||||||
}
|
}
|
||||||
QList<IRunConfigurationFactory *> factories =
|
const QList<IRunConfigurationFactory *> factories =
|
||||||
ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>();
|
ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>();
|
||||||
|
|
||||||
QList<QAction *> menuActions;
|
QList<QAction *> menuActions;
|
||||||
foreach (IRunConfigurationFactory *factory, factories) {
|
for (IRunConfigurationFactory *factory : factories) {
|
||||||
QList<Core::Id> ids = factory->availableCreationIds(m_target);
|
const QList<RunConfigurationCreationInfo> items = factory->availableCreators(m_target);
|
||||||
foreach (Core::Id id, ids) {
|
for (const RunConfigurationCreationInfo &item : items) {
|
||||||
auto action = new QAction(factory->displayNameForId(id), m_addRunMenu);
|
auto action = new QAction(item.displayName, m_addRunMenu);
|
||||||
connect(action, &QAction::triggered, [factory, id, this]() {
|
connect(action, &QAction::triggered, [item, this] {
|
||||||
RunConfiguration *newRC = factory->create(m_target, id);
|
RunConfiguration *newRC = item.factory->create(m_target, item.id, item.extra);
|
||||||
if (!newRC)
|
if (!newRC)
|
||||||
return;
|
return;
|
||||||
QTC_CHECK(newRC->id() == id);
|
QTC_CHECK(newRC->id() == item.id);
|
||||||
m_target->addRunConfiguration(newRC);
|
m_target->addRunConfiguration(newRC);
|
||||||
m_target->setActiveRunConfiguration(newRC);
|
m_target->setActiveRunConfiguration(newRC);
|
||||||
m_removeRunToolButton->setEnabled(m_target->runConfigurations().size() > 1);
|
m_removeRunToolButton->setEnabled(m_target->runConfigurations().size() > 1);
|
||||||
|
@@ -115,10 +115,9 @@ QList<DeployConfigurationFactory *> TargetPrivate::deployFactories() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Target::Target(Project *project, Kit *k) :
|
Target::Target(Project *project, Kit *k) :
|
||||||
ProjectConfiguration(project),
|
ProjectConfiguration(project, k->id()),
|
||||||
d(new TargetPrivate(k))
|
d(new TargetPrivate(k))
|
||||||
{
|
{
|
||||||
initialize(k->id());
|
|
||||||
QTC_CHECK(d->m_kit);
|
QTC_CHECK(d->m_kit);
|
||||||
connect(DeviceManager::instance(), &DeviceManager::updated, this, &Target::updateDeviceState);
|
connect(DeviceManager::instance(), &DeviceManager::updated, this, &Target::updateDeviceState);
|
||||||
|
|
||||||
@@ -547,7 +546,7 @@ void Target::updateDefaultDeployConfigurations()
|
|||||||
|
|
||||||
void Target::updateDefaultRunConfigurations()
|
void Target::updateDefaultRunConfigurations()
|
||||||
{
|
{
|
||||||
QList<IRunConfigurationFactory *> rcFactories = IRunConfigurationFactory::find(this);
|
const QList<IRunConfigurationFactory *> rcFactories = IRunConfigurationFactory::find(this);
|
||||||
if (rcFactories.isEmpty()) {
|
if (rcFactories.isEmpty()) {
|
||||||
qWarning("No run configuration factory found for target id '%s'.", qPrintable(id().toString()));
|
qWarning("No run configuration factory found for target id '%s'.", qPrintable(id().toString()));
|
||||||
return;
|
return;
|
||||||
@@ -565,42 +564,46 @@ void Target::updateDefaultRunConfigurations()
|
|||||||
int configuredCount = existingConfigured.count();
|
int configuredCount = existingConfigured.count();
|
||||||
|
|
||||||
// find all RC ids that can get created:
|
// find all RC ids that can get created:
|
||||||
QList<Core::Id> availableFactoryIds;
|
QList<RunConfigurationCreationInfo> availableFactories;
|
||||||
foreach (IRunConfigurationFactory *rcFactory, rcFactories)
|
for (IRunConfigurationFactory *rcFactory : rcFactories)
|
||||||
availableFactoryIds.append(rcFactory->availableCreationIds(this));
|
availableFactories.append(rcFactory->availableCreators(this));
|
||||||
|
|
||||||
QList<Core::Id> autoCreateFactoryIds;
|
QList<RunConfigurationCreationInfo> autoCreateFactories;
|
||||||
foreach (IRunConfigurationFactory *rcFactory, rcFactories)
|
for (IRunConfigurationFactory *rcFactory : rcFactories)
|
||||||
autoCreateFactoryIds.append(rcFactory->availableCreationIds(this,
|
autoCreateFactories.append(rcFactory->availableCreators(this,
|
||||||
IRunConfigurationFactory::AutoCreate));
|
IRunConfigurationFactory::AutoCreate));
|
||||||
|
|
||||||
// Put outdated RCs into toRemove, do not bother with factories
|
// Put outdated RCs into toRemove, do not bother with factories
|
||||||
// that produce already existing RCs
|
// that produce already existing RCs
|
||||||
QList<RunConfiguration *> toRemove;
|
QList<RunConfiguration *> toRemove;
|
||||||
QList<Core::Id> toIgnore;
|
QList<RunConfigurationCreationInfo> existing;
|
||||||
foreach (RunConfiguration *rc, existingConfigured) {
|
foreach (RunConfiguration *rc, existingConfigured) {
|
||||||
if (availableFactoryIds.contains(rc->id()))
|
bool present = false;
|
||||||
toIgnore.append(rc->id()); // Already there
|
for (const RunConfigurationCreationInfo &item : availableFactories) {
|
||||||
else if (project()->knowsAllBuildExecutables())
|
if (item.id == rc->id() && item.extra == rc->extraId()) {
|
||||||
toRemove << rc;
|
existing.append(item);
|
||||||
|
present = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!present && project()->knowsAllBuildExecutables())
|
||||||
|
toRemove.append(rc);
|
||||||
}
|
}
|
||||||
foreach (Core::Id i, toIgnore)
|
|
||||||
autoCreateFactoryIds.removeAll(i);
|
|
||||||
configuredCount -= toRemove.count();
|
configuredCount -= toRemove.count();
|
||||||
|
|
||||||
// Create new RCs and put them into newConfigured/newUnconfigured
|
// Create new RCs and put them into newConfigured/newUnconfigured
|
||||||
foreach (Core::Id id, autoCreateFactoryIds) {
|
foreach (const RunConfigurationCreationInfo &item, autoCreateFactories) {
|
||||||
IRunConfigurationFactory *factory = Utils::findOrDefault(rcFactories,
|
bool exists = false;
|
||||||
[this, id] (IRunConfigurationFactory *i) {
|
for (const RunConfigurationCreationInfo &ex : existing) {
|
||||||
return i->canCreate(this, id);
|
if (ex.id == item.id && ex.extra == item.extra)
|
||||||
});
|
exists = true;
|
||||||
if (!factory)
|
}
|
||||||
|
if (exists)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
RunConfiguration *rc = factory->create(this, id);
|
RunConfiguration *rc = item.factory->create(this, item.id, item.extra);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
continue;
|
continue;
|
||||||
QTC_CHECK(rc->id() == id);
|
QTC_CHECK(rc->id() == item.id);
|
||||||
if (!rc->isConfigured())
|
if (!rc->isConfigured())
|
||||||
newUnconfigured << rc;
|
newUnconfigured << rc;
|
||||||
else
|
else
|
||||||
@@ -643,7 +646,7 @@ void Target::updateDefaultRunConfigurations()
|
|||||||
|
|
||||||
// Make sure a configured RC will be active after we delete the RCs:
|
// Make sure a configured RC will be active after we delete the RCs:
|
||||||
RunConfiguration *active = activeRunConfiguration();
|
RunConfiguration *active = activeRunConfiguration();
|
||||||
if (removalList.contains(active) || !active->isEnabled()) {
|
if (active && (removalList.contains(active) || !active->isEnabled())) {
|
||||||
RunConfiguration *newConfiguredDefault = newConfigured.isEmpty() ? nullptr : newConfigured.at(0);
|
RunConfiguration *newConfiguredDefault = newConfigured.isEmpty() ? nullptr : newConfigured.at(0);
|
||||||
|
|
||||||
RunConfiguration *rc
|
RunConfiguration *rc
|
||||||
@@ -796,7 +799,7 @@ bool Target::fromMap(const QVariantMap &map)
|
|||||||
qWarning("Factory '%s' failed to restore deployment configuration!", qPrintable(factory->objectName()));
|
qWarning("Factory '%s' failed to restore deployment configuration!", qPrintable(factory->objectName()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QTC_CHECK(dc->id() == ProjectExplorer::idFromMap(valueMap));
|
QTC_CHECK(dc->id().withSuffix(dc->extraId()) == ProjectExplorer::idFromMap(valueMap));
|
||||||
addDeployConfiguration(dc);
|
addDeployConfiguration(dc);
|
||||||
if (i == activeConfiguration)
|
if (i == activeConfiguration)
|
||||||
setActiveDeployConfiguration(dc);
|
setActiveDeployConfiguration(dc);
|
||||||
@@ -824,7 +827,7 @@ bool Target::fromMap(const QVariantMap &map)
|
|||||||
RunConfiguration *rc = factory->restore(this, valueMap);
|
RunConfiguration *rc = factory->restore(this, valueMap);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
continue;
|
continue;
|
||||||
QTC_CHECK(rc->id() == ProjectExplorer::idFromMap(valueMap));
|
QTC_CHECK(rc->id().withSuffix(rc->extraId()) == ProjectExplorer::idFromMap(valueMap));
|
||||||
addRunConfiguration(rc);
|
addRunConfiguration(rc);
|
||||||
if (i == activeConfiguration)
|
if (i == activeConfiguration)
|
||||||
setActiveRunConfiguration(rc);
|
setActiveRunConfiguration(rc);
|
||||||
|
@@ -79,11 +79,6 @@ const char PythonProjectContext[] = "PythonProjectContext";
|
|||||||
class PythonRunConfiguration;
|
class PythonRunConfiguration;
|
||||||
class PythonProjectFile;
|
class PythonProjectFile;
|
||||||
|
|
||||||
static QString scriptFromId(Core::Id id)
|
|
||||||
{
|
|
||||||
return id.suffixAfter(PythonRunConfigurationPrefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
class PythonProject : public Project
|
class PythonProject : public Project
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -162,7 +157,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ProjectExplorer::IRunConfigurationFactory;
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
void initialize(Core::Id id) override;
|
|
||||||
|
|
||||||
QString defaultDisplayName() const;
|
QString defaultDisplayName() const;
|
||||||
|
|
||||||
@@ -173,24 +167,17 @@ private:
|
|||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
PythonRunConfiguration::PythonRunConfiguration(Target *target)
|
PythonRunConfiguration::PythonRunConfiguration(Target *target)
|
||||||
: RunConfiguration(target)
|
: RunConfiguration(target, PythonRunConfigurationPrefix)
|
||||||
{
|
{
|
||||||
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
|
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
|
||||||
addExtraAspect(new ArgumentsAspect(this, "PythonEditor.RunConfiguration.Arguments"));
|
addExtraAspect(new ArgumentsAspect(this, "PythonEditor.RunConfiguration.Arguments"));
|
||||||
addExtraAspect(new TerminalAspect(this, "PythonEditor.RunConfiguration.UseTerminal"));
|
addExtraAspect(new TerminalAspect(this, "PythonEditor.RunConfiguration.UseTerminal"));
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PythonRunConfiguration::initialize(Core::Id id)
|
|
||||||
{
|
|
||||||
RunConfiguration::initialize(id);
|
|
||||||
|
|
||||||
m_mainScript = scriptFromId(id);
|
|
||||||
setDisplayName(defaultDisplayName());
|
|
||||||
|
|
||||||
Environment sysEnv = Environment::systemEnvironment();
|
Environment sysEnv = Environment::systemEnvironment();
|
||||||
const QString exec = sysEnv.searchInPath("python").toString();
|
const QString exec = sysEnv.searchInPath("python").toString();
|
||||||
m_interpreter = exec.isEmpty() ? "python" : exec;
|
m_interpreter = exec.isEmpty() ? "python" : exec;
|
||||||
|
|
||||||
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap PythonRunConfiguration::toMap() const
|
QVariantMap PythonRunConfiguration::toMap() const
|
||||||
|
@@ -52,39 +52,70 @@
|
|||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static QString configNameKey() { return QStringLiteral("Qbs.configName"); }
|
static QString configNameKey() { return QStringLiteral("Qbs.configName"); }
|
||||||
|
|
||||||
const char QBS_BC_ID[] = "Qbs.QbsBuildConfiguration";
|
static FileName defaultBuildDirectory(const QString &projectFilePath, const Kit *k,
|
||||||
|
const QString &bcName,
|
||||||
|
BuildConfiguration::BuildType buildType)
|
||||||
|
{
|
||||||
|
const QString projectName = QFileInfo(projectFilePath).completeBaseName();
|
||||||
|
ProjectMacroExpander expander(projectFilePath, projectName, k, bcName, buildType);
|
||||||
|
QString projectDir = Project::projectDirectory(FileName::fromString(projectFilePath)).toString();
|
||||||
|
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
||||||
|
return FileName::fromString(FileUtils::resolvePath(projectDir, buildPath));
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// QbsBuildConfiguration:
|
// QbsBuildConfiguration:
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
QbsBuildConfiguration::QbsBuildConfiguration(Target *target) :
|
QbsBuildConfiguration::QbsBuildConfiguration(Target *target)
|
||||||
BuildConfiguration(target, Core::Id(QBS_BC_ID)),
|
: BuildConfiguration(target, Constants::QBS_BC_ID)
|
||||||
m_isParsing(true),
|
|
||||||
m_parsingError(false)
|
|
||||||
{
|
{
|
||||||
connect(project(), &Project::parsingStarted, this, &BuildConfiguration::enabledChanged);
|
connect(project(), &Project::parsingStarted, this, &BuildConfiguration::enabledChanged);
|
||||||
connect(project(), &Project::parsingFinished, this, &BuildConfiguration::enabledChanged);
|
connect(project(), &Project::parsingFinished, this, &BuildConfiguration::enabledChanged);
|
||||||
|
|
||||||
BuildStepList *bsl = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
||||||
connect(bsl, &BuildStepList::stepInserted, this, &QbsBuildConfiguration::buildStepInserted);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QbsBuildConfiguration::QbsBuildConfiguration(Target *target, Core::Id id) :
|
void QbsBuildConfiguration::initialize(const BuildInfo *info)
|
||||||
BuildConfiguration(target, id)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QbsBuildConfiguration::QbsBuildConfiguration(Target *target, QbsBuildConfiguration *source) :
|
|
||||||
BuildConfiguration(target, source)
|
|
||||||
{
|
{
|
||||||
m_configurationName = source->configurationName();
|
BuildConfiguration::initialize(info);
|
||||||
cloneSteps(source);
|
|
||||||
|
const QbsBuildInfo * const bi = static_cast<const QbsBuildInfo *>(info);
|
||||||
|
QVariantMap configData = bi->config;
|
||||||
|
configData.insert(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY),
|
||||||
|
(info->buildType == BuildConfiguration::Debug)
|
||||||
|
? QLatin1String(Constants::QBS_VARIANT_DEBUG)
|
||||||
|
: QLatin1String(Constants::QBS_VARIANT_RELEASE));
|
||||||
|
|
||||||
|
Utils::FileName buildDir = info->buildDirectory;
|
||||||
|
if (buildDir.isEmpty())
|
||||||
|
buildDir = defaultBuildDirectory(target()->project()->projectDirectory().toString(),
|
||||||
|
target()->kit(), info->displayName, info->buildType);
|
||||||
|
|
||||||
|
// Add the build configuration.
|
||||||
|
QVariantMap bd = configData;
|
||||||
|
QString configName = bd.take("configName").toString();
|
||||||
|
if (configName.isEmpty()) {
|
||||||
|
configName = "qtc_" + target()->kit()->fileSystemFriendlyName() + '_'
|
||||||
|
+ Utils::FileUtils::fileSystemFriendlyName(info->displayName);
|
||||||
|
}
|
||||||
|
setConfigurationName(configName);
|
||||||
|
|
||||||
|
BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
|
auto bs = new QbsBuildStep(buildSteps);
|
||||||
|
bs->setQbsConfiguration(bd);
|
||||||
|
buildSteps->appendStep(bs);
|
||||||
|
|
||||||
|
BuildStepList *cleanSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||||
|
cleanSteps->appendStep(new QbsCleanStep(cleanSteps));
|
||||||
|
|
||||||
|
connect(bs, &QbsBuildStep::qbsConfigurationChanged, this, &QbsBuildConfiguration::qbsConfigurationChanged);
|
||||||
|
emit qbsConfigurationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QbsBuildConfiguration::fromMap(const QVariantMap &map)
|
bool QbsBuildConfiguration::fromMap(const QVariantMap &map)
|
||||||
@@ -117,15 +148,6 @@ QVariantMap QbsBuildConfiguration::toMap() const
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsBuildConfiguration::buildStepInserted(int pos)
|
|
||||||
{
|
|
||||||
QbsBuildStep *step = qobject_cast<QbsBuildStep *>(stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)->at(pos));
|
|
||||||
if (step) {
|
|
||||||
connect(step, &QbsBuildStep::qbsConfigurationChanged, this, &QbsBuildConfiguration::qbsConfigurationChanged);
|
|
||||||
emit qbsConfigurationChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NamedWidget *QbsBuildConfiguration::createConfigWidget()
|
NamedWidget *QbsBuildConfiguration::createConfigWidget()
|
||||||
{
|
{
|
||||||
return new QbsBuildConfigurationWidget(this);
|
return new QbsBuildConfigurationWidget(this);
|
||||||
@@ -366,48 +388,15 @@ QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep)
|
|||||||
return commandLine;
|
return commandLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
QbsBuildConfiguration *QbsBuildConfiguration::setup(Target *t,
|
|
||||||
const QString &defaultDisplayName,
|
|
||||||
const QString &displayName,
|
|
||||||
const QVariantMap &buildData,
|
|
||||||
const Utils::FileName &directory)
|
|
||||||
{
|
|
||||||
// Add the build configuration.
|
|
||||||
QbsBuildConfiguration *bc = new QbsBuildConfiguration(t);
|
|
||||||
bc->setDefaultDisplayName(defaultDisplayName);
|
|
||||||
bc->setDisplayName(displayName);
|
|
||||||
bc->setBuildDirectory(directory);
|
|
||||||
QVariantMap bd = buildData;
|
|
||||||
QString configName = bd.take("configName").toString();
|
|
||||||
if (configName.isEmpty()) {
|
|
||||||
configName = "qtc_" + t->kit()->fileSystemFriendlyName() + QLatin1Char('_')
|
|
||||||
+ Utils::FileUtils::fileSystemFriendlyName(displayName);
|
|
||||||
}
|
|
||||||
bc->setConfigurationName(configName);
|
|
||||||
|
|
||||||
BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
||||||
QbsBuildStep *bs = new QbsBuildStep(buildSteps);
|
|
||||||
bs->setQbsConfiguration(bd);
|
|
||||||
buildSteps->insertStep(0, bs);
|
|
||||||
|
|
||||||
BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
|
||||||
QbsCleanStep *cs = new QbsCleanStep(cleanSteps);
|
|
||||||
cleanSteps->insertStep(0, cs);
|
|
||||||
|
|
||||||
return bc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// QbsBuildConfigurationFactory:
|
// QbsBuildConfigurationFactory:
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
QbsBuildConfigurationFactory::QbsBuildConfigurationFactory(QObject *parent) :
|
QbsBuildConfigurationFactory::QbsBuildConfigurationFactory()
|
||||||
IBuildConfigurationFactory(parent)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
bool QbsBuildConfigurationFactory::canHandle(const Target *t) const
|
|
||||||
{
|
{
|
||||||
return qobject_cast<Internal::QbsProject *>(t->project());
|
registerBuildConfiguration<QbsBuildConfiguration>(Constants::QBS_BC_ID);
|
||||||
|
setSupportedProjectType(Constants::PROJECT_ID);
|
||||||
|
setSupportedProjectMimeTypeName(Constants::MIME_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildInfo *QbsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
BuildInfo *QbsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||||
@@ -420,37 +409,9 @@ BuildInfo *QbsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QbsBuildConfigurationFactory::priority(const Target *parent) const
|
|
||||||
{
|
|
||||||
return canHandle(parent) ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<BuildInfo *> QbsBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
QList<BuildInfo *> QbsBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
||||||
{
|
{
|
||||||
QList<BuildInfo *> result;
|
return {createBuildInfo(parent->kit(), BuildConfiguration::Debug)};
|
||||||
|
|
||||||
BuildInfo *info = createBuildInfo(parent->kit(), BuildConfiguration::Debug);
|
|
||||||
result << info;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QbsBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
|
||||||
{
|
|
||||||
if (k && Utils::mimeTypeForFile(projectPath).matchesName(Constants::MIME_TYPE))
|
|
||||||
return 0;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Utils::FileName defaultBuildDirectory(const QString &projectFilePath, const Kit *k,
|
|
||||||
const QString &bcName,
|
|
||||||
BuildConfiguration::BuildType buildType)
|
|
||||||
{
|
|
||||||
const QString projectName = QFileInfo(projectFilePath).completeBaseName();
|
|
||||||
ProjectMacroExpander expander(projectFilePath, projectName, k, bcName, buildType);
|
|
||||||
QString projectDir = Project::projectDirectory(Utils::FileName::fromString(projectFilePath)).toString();
|
|
||||||
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
|
||||||
return Utils::FileName::fromString(Utils::FileUtils::resolvePath(projectDir, buildPath));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildInfo *> QbsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
QList<BuildInfo *> QbsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
||||||
@@ -478,61 +439,5 @@ QList<BuildInfo *> QbsBuildConfigurationFactory::availableSetups(const Kit *k, c
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildConfiguration *QbsBuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
|
||||||
{
|
|
||||||
QTC_ASSERT(info->factory() == this, return 0);
|
|
||||||
QTC_ASSERT(info->kitId == parent->kit()->id(), return 0);
|
|
||||||
QTC_ASSERT(!info->displayName.isEmpty(), return 0);
|
|
||||||
|
|
||||||
const QbsBuildInfo * const bi = static_cast<const QbsBuildInfo *>(info);
|
|
||||||
QVariantMap configData = bi->config;
|
|
||||||
configData.insert(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY),
|
|
||||||
(info->buildType == BuildConfiguration::Debug)
|
|
||||||
? QLatin1String(Constants::QBS_VARIANT_DEBUG)
|
|
||||||
: QLatin1String(Constants::QBS_VARIANT_RELEASE));
|
|
||||||
|
|
||||||
Utils::FileName buildDir = info->buildDirectory;
|
|
||||||
if (buildDir.isEmpty())
|
|
||||||
buildDir = defaultBuildDirectory(parent->project()->projectDirectory().toString(),
|
|
||||||
parent->kit(), info->displayName, info->buildType);
|
|
||||||
|
|
||||||
BuildConfiguration *bc
|
|
||||||
= QbsBuildConfiguration::setup(parent, info->displayName, info->displayName,
|
|
||||||
configData, buildDir);
|
|
||||||
|
|
||||||
return bc;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QbsBuildConfigurationFactory::canClone(const Target *parent, BuildConfiguration *source) const
|
|
||||||
{
|
|
||||||
return canHandle(parent) && qobject_cast<QbsBuildConfiguration *>(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *QbsBuildConfigurationFactory::clone(Target *parent, BuildConfiguration *source)
|
|
||||||
{
|
|
||||||
if (!canClone(parent, source))
|
|
||||||
return 0;
|
|
||||||
QbsBuildConfiguration *oldbc(static_cast<QbsBuildConfiguration *>(source));
|
|
||||||
return new QbsBuildConfiguration(parent, oldbc);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QbsBuildConfigurationFactory::canRestore(const Target *parent, const QVariantMap &map) const
|
|
||||||
{
|
|
||||||
if (!canHandle(parent))
|
|
||||||
return false;
|
|
||||||
return ProjectExplorer::idFromMap(map) == Core::Id(QBS_BC_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *QbsBuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
|
||||||
{
|
|
||||||
if (!canRestore(parent, map))
|
|
||||||
return 0;
|
|
||||||
QbsBuildConfiguration *bc = new QbsBuildConfiguration(parent);
|
|
||||||
if (bc->fromMap(map))
|
|
||||||
return bc;
|
|
||||||
delete bc;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace QbsProjectManager
|
} // namespace QbsProjectManager
|
||||||
|
@@ -32,16 +32,11 @@
|
|||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <qtsupport/baseqtversion.h>
|
#include <qtsupport/baseqtversion.h>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer { class BuildStep; }
|
||||||
class BuildStep;
|
|
||||||
class FileNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QbsBuildConfigurationFactory;
|
|
||||||
class QbsBuildConfigurationWidget;
|
class QbsBuildConfigurationWidget;
|
||||||
class QbsBuildStep;
|
class QbsBuildStep;
|
||||||
class QbsProject;
|
class QbsProject;
|
||||||
@@ -50,9 +45,11 @@ class QbsBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
friend class ProjectExplorer::IBuildConfigurationFactory;
|
||||||
explicit QbsBuildConfiguration(ProjectExplorer::Target *target);
|
explicit QbsBuildConfiguration(ProjectExplorer::Target *target);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void initialize(const ProjectExplorer::BuildInfo *info) override;
|
||||||
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
||||||
|
|
||||||
QbsBuildStep *qbsStep() const;
|
QbsBuildStep *qbsStep() const;
|
||||||
@@ -86,29 +83,17 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void qbsConfigurationChanged();
|
void qbsConfigurationChanged();
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
QbsBuildConfiguration(ProjectExplorer::Target *target, QbsBuildConfiguration *source);
|
|
||||||
QbsBuildConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
private:
|
bool m_isParsing = true;
|
||||||
void buildStepInserted(int pos);
|
bool m_parsingError = false;
|
||||||
|
|
||||||
static QbsBuildConfiguration *setup(ProjectExplorer::Target *t,
|
|
||||||
const QString &defaultDisplayName,
|
|
||||||
const QString &displayName,
|
|
||||||
const QVariantMap &buildData,
|
|
||||||
const Utils::FileName &directory);
|
|
||||||
|
|
||||||
bool m_isParsing;
|
|
||||||
bool m_parsingError;
|
|
||||||
QStringList m_changedFiles;
|
QStringList m_changedFiles;
|
||||||
QStringList m_activeFileTags;
|
QStringList m_activeFileTags;
|
||||||
QStringList m_products;
|
QStringList m_products;
|
||||||
QString m_configurationName;
|
QString m_configurationName;
|
||||||
|
|
||||||
friend class QbsBuildConfigurationFactory;
|
|
||||||
friend class QbsBuildConfigurationWidget;
|
friend class QbsBuildConfigurationWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -117,23 +102,13 @@ class QbsBuildConfigurationFactory : public ProjectExplorer::IBuildConfiguration
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QbsBuildConfigurationFactory(QObject *parent = 0);
|
QbsBuildConfigurationFactory();
|
||||||
|
|
||||||
int priority(const ProjectExplorer::Target *parent) const override;
|
|
||||||
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
|
||||||
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
|
|
||||||
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
|
||||||
const QString &projectPath) const override;
|
const QString &projectPath) const override;
|
||||||
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
|
|
||||||
const ProjectExplorer::BuildInfo *info) const override;
|
|
||||||
|
|
||||||
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const override;
|
|
||||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) override;
|
|
||||||
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const override;
|
|
||||||
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool canHandle(const ProjectExplorer::Target *t) const;
|
|
||||||
ProjectExplorer::BuildInfo *createBuildInfo(const ProjectExplorer::Kit *k,
|
ProjectExplorer::BuildInfo *createBuildInfo(const ProjectExplorer::Kit *k,
|
||||||
ProjectExplorer::BuildConfiguration::BuildType type) const;
|
ProjectExplorer::BuildConfiguration::BuildType type) const;
|
||||||
};
|
};
|
||||||
|
@@ -124,18 +124,11 @@ private:
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsBuildStep::QbsBuildStep(ProjectExplorer::BuildStepList *bsl) :
|
QbsBuildStep::QbsBuildStep(ProjectExplorer::BuildStepList *bsl) :
|
||||||
ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_BUILDSTEP_ID)),
|
ProjectExplorer::BuildStep(bsl, Constants::QBS_BUILDSTEP_ID)
|
||||||
m_job(0), m_parser(0), m_parsingProject(false)
|
|
||||||
{
|
{
|
||||||
setDisplayName(tr("Qbs Build"));
|
setDisplayName(tr("Qbs Build"));
|
||||||
setQbsConfiguration(QVariantMap());
|
setQbsConfiguration(QVariantMap());
|
||||||
}
|
// setQbsConfiguration(other->qbsConfiguration(PreserveVariables));
|
||||||
|
|
||||||
QbsBuildStep::QbsBuildStep(ProjectExplorer::BuildStepList *bsl, const QbsBuildStep *other) :
|
|
||||||
ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_BUILDSTEP_ID)),
|
|
||||||
m_qbsBuildOptions(other->m_qbsBuildOptions), m_job(0), m_parser(0), m_parsingProject(false)
|
|
||||||
{
|
|
||||||
setQbsConfiguration(other->qbsConfiguration(PreserveVariables));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QbsBuildStep::~QbsBuildStep()
|
QbsBuildStep::~QbsBuildStep()
|
||||||
@@ -846,29 +839,13 @@ bool QbsBuildStepConfigWidget::validateProperties(Utils::FancyLineEdit *edit, QS
|
|||||||
// QbsBuildStepFactory:
|
// QbsBuildStepFactory:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsBuildStepFactory::QbsBuildStepFactory(QObject *parent) :
|
QbsBuildStepFactory::QbsBuildStepFactory()
|
||||||
ProjectExplorer::IBuildStepFactory(parent)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo> QbsBuildStepFactory::availableSteps(ProjectExplorer::BuildStepList *parent) const
|
|
||||||
{
|
{
|
||||||
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_BUILD
|
registerStep<QbsBuildStep>(Constants::QBS_BUILDSTEP_ID);
|
||||||
&& qobject_cast<QbsBuildConfiguration *>(parent->parent())
|
setDisplayName(tr("Qbs Build"));
|
||||||
&& qobject_cast<QbsProject *>(parent->target()->project()))
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
return {{Constants::QBS_BUILDSTEP_ID, tr("Qbs Build")}};
|
setSupportedConfiguration(Constants::QBS_BC_ID);
|
||||||
|
setSupportedProjectType(Constants::PROJECT_ID);
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *QbsBuildStepFactory::create(ProjectExplorer::BuildStepList *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
Q_UNUSED(id);
|
|
||||||
return new QbsBuildStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *QbsBuildStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
|
|
||||||
{
|
|
||||||
return new QbsBuildStep(parent, static_cast<QbsBuildStep *>(product));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -52,7 +52,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
explicit QbsBuildStep(ProjectExplorer::BuildStepList *bsl);
|
explicit QbsBuildStep(ProjectExplorer::BuildStepList *bsl);
|
||||||
QbsBuildStep(ProjectExplorer::BuildStepList *bsl, const QbsBuildStep *other);
|
|
||||||
~QbsBuildStep() override;
|
~QbsBuildStep() override;
|
||||||
|
|
||||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||||
@@ -81,14 +80,14 @@ public:
|
|||||||
|
|
||||||
bool isQmlDebuggingEnabled() const;
|
bool isQmlDebuggingEnabled() const;
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
QVariantMap toMap() const override;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void qbsConfigurationChanged();
|
void qbsConfigurationChanged();
|
||||||
void qbsBuildOptionsChanged();
|
void qbsBuildOptionsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
void buildingDone(bool success);
|
void buildingDone(bool success);
|
||||||
void reparsingDone(bool success);
|
void reparsingDone(bool success);
|
||||||
void handleTaskStarted(const QString &desciption, int max);
|
void handleTaskStarted(const QString &desciption, int max);
|
||||||
@@ -124,27 +123,21 @@ private:
|
|||||||
QStringList m_products;
|
QStringList m_products;
|
||||||
|
|
||||||
QFutureInterface<bool> *m_fi;
|
QFutureInterface<bool> *m_fi;
|
||||||
qbs::BuildJob *m_job;
|
qbs::BuildJob *m_job = nullptr;
|
||||||
int m_progressBase;
|
int m_progressBase;
|
||||||
bool m_lastWasSuccess;
|
bool m_lastWasSuccess;
|
||||||
ProjectExplorer::IOutputParser *m_parser;
|
ProjectExplorer::IOutputParser *m_parser = nullptr;
|
||||||
bool m_parsingProject;
|
bool m_parsingProject = false;
|
||||||
|
|
||||||
friend class QbsBuildStepConfigWidget;
|
friend class QbsBuildStepConfigWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QbsBuildStepFactory : public ProjectExplorer::IBuildStepFactory
|
class QbsBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QbsBuildStepFactory(QObject *parent = 0);
|
QbsBuildStepFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -41,10 +41,6 @@
|
|||||||
static const char QBS_DRY_RUN[] = "Qbs.DryRun";
|
static const char QBS_DRY_RUN[] = "Qbs.DryRun";
|
||||||
static const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing";
|
static const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing";
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
|
||||||
// Constants:
|
|
||||||
// --------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -53,18 +49,11 @@ namespace Internal {
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsCleanStep::QbsCleanStep(ProjectExplorer::BuildStepList *bsl) :
|
QbsCleanStep::QbsCleanStep(ProjectExplorer::BuildStepList *bsl) :
|
||||||
ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_CLEANSTEP_ID)),
|
ProjectExplorer::BuildStep(bsl, Constants::QBS_CLEANSTEP_ID)
|
||||||
m_job(0), m_showCompilerOutput(true), m_parser(0)
|
|
||||||
{
|
{
|
||||||
setDisplayName(tr("Qbs Clean"));
|
setDisplayName(tr("Qbs Clean"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QbsCleanStep::QbsCleanStep(ProjectExplorer::BuildStepList *bsl, const QbsCleanStep *other) :
|
|
||||||
ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_CLEANSTEP_ID)),
|
|
||||||
m_qbsCleanOptions(other->m_qbsCleanOptions), m_job(0),
|
|
||||||
m_showCompilerOutput(other->m_showCompilerOutput), m_parser(0)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QbsCleanStep::~QbsCleanStep()
|
QbsCleanStep::~QbsCleanStep()
|
||||||
{
|
{
|
||||||
cancel();
|
cancel();
|
||||||
@@ -303,27 +292,12 @@ void QbsCleanStepConfigWidget::changeJobCount(int count)
|
|||||||
// QbsCleanStepFactory:
|
// QbsCleanStepFactory:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsCleanStepFactory::QbsCleanStepFactory(QObject *parent) :
|
QbsCleanStepFactory::QbsCleanStepFactory()
|
||||||
ProjectExplorer::IBuildStepFactory(parent)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo> QbsCleanStepFactory::availableSteps(ProjectExplorer::BuildStepList *parent) const
|
|
||||||
{
|
{
|
||||||
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN
|
registerStep<QbsCleanStep>(Constants::QBS_CLEANSTEP_ID);
|
||||||
&& qobject_cast<QbsBuildConfiguration *>(parent->parent()))
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
||||||
return {{Constants::QBS_CLEANSTEP_ID, tr("Qbs Clean")}};
|
setSupportedConfiguration(Constants::QBS_BC_ID);
|
||||||
return {};
|
setDisplayName(tr("Qbs Clean"));
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *QbsCleanStepFactory::create(ProjectExplorer::BuildStepList *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
Q_UNUSED(id);
|
|
||||||
return new QbsCleanStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *QbsCleanStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
|
|
||||||
{
|
|
||||||
return new QbsCleanStep(parent, static_cast<QbsCleanStep *>(product));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -43,7 +43,6 @@ class QbsCleanStep : public ProjectExplorer::BuildStep
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QbsCleanStep(ProjectExplorer::BuildStepList *bsl);
|
explicit QbsCleanStep(ProjectExplorer::BuildStepList *bsl);
|
||||||
QbsCleanStep(ProjectExplorer::BuildStepList *bsl, const QbsCleanStep *other);
|
|
||||||
~QbsCleanStep() override;
|
~QbsCleanStep() override;
|
||||||
|
|
||||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||||
@@ -80,11 +79,11 @@ private:
|
|||||||
qbs::CleanOptions m_qbsCleanOptions;
|
qbs::CleanOptions m_qbsCleanOptions;
|
||||||
QStringList m_products;
|
QStringList m_products;
|
||||||
|
|
||||||
QFutureInterface<bool> *m_fi;
|
QFutureInterface<bool> *m_fi = nullptr;
|
||||||
qbs::CleanJob *m_job;
|
qbs::CleanJob *m_job = nullptr;
|
||||||
int m_progressBase;
|
int m_progressBase;
|
||||||
bool m_showCompilerOutput;
|
bool m_showCompilerOutput = true;
|
||||||
ProjectExplorer::IOutputParser *m_parser;
|
ProjectExplorer::IOutputParser *m_parser = nullptr;
|
||||||
|
|
||||||
friend class QbsCleanStepConfigWidget;
|
friend class QbsCleanStepConfigWidget;
|
||||||
};
|
};
|
||||||
@@ -113,18 +112,12 @@ private:
|
|||||||
QString m_summary;
|
QString m_summary;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QbsCleanStepFactory : public ProjectExplorer::IBuildStepFactory
|
class QbsCleanStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QbsCleanStepFactory(QObject *parent = 0);
|
QbsCleanStepFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -25,121 +25,30 @@
|
|||||||
|
|
||||||
#include "qbsdeployconfigurationfactory.h"
|
#include "qbsdeployconfigurationfactory.h"
|
||||||
|
|
||||||
|
#include "qbsprojectmanagerconstants.h"
|
||||||
#include "qbsinstallstep.h"
|
#include "qbsinstallstep.h"
|
||||||
#include "qbsproject.h"
|
#include "qbsproject.h"
|
||||||
|
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
#include <projectexplorer/kitinformation.h>
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/target.h>
|
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
const char QBS_DEPLOYCONFIG_ID[] = "Qbs.Deploy";
|
||||||
// Helpers:
|
|
||||||
// --------------------------------------------------------------------
|
|
||||||
|
|
||||||
static QString genericQbsDisplayName() {
|
QbsDeployConfiguration::QbsDeployConfiguration(ProjectExplorer::Target *target) :
|
||||||
return QCoreApplication::translate("Qbs", "Qbs Install");
|
ProjectExplorer::DeployConfiguration(target, QBS_DEPLOYCONFIG_ID)
|
||||||
}
|
|
||||||
|
|
||||||
static Core::Id genericQbsDeployConfigurationId()
|
|
||||||
{
|
{
|
||||||
return "Qbs.Deploy";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
QbsDeployConfigurationFactory::QbsDeployConfigurationFactory()
|
||||||
// QbsDeployConfiguration:
|
|
||||||
// --------------------------------------------------------------------
|
|
||||||
|
|
||||||
QbsDeployConfiguration::QbsDeployConfiguration(ProjectExplorer::Target *target, Core::Id id) :
|
|
||||||
ProjectExplorer::DeployConfiguration(target, id)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QbsDeployConfiguration::QbsDeployConfiguration(ProjectExplorer::Target *target,
|
|
||||||
ProjectExplorer::DeployConfiguration *source) :
|
|
||||||
ProjectExplorer::DeployConfiguration(target, source)
|
|
||||||
{
|
{
|
||||||
cloneSteps(source);
|
setObjectName("QbsDeployConfiguration");
|
||||||
}
|
registerDeployConfiguration<QbsDeployConfiguration>(QBS_DEPLOYCONFIG_ID);
|
||||||
|
setSupportedTargetDeviceTypes({ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE});
|
||||||
// --------------------------------------------------------------------
|
setSupportedProjectType(Constants::PROJECT_ID);
|
||||||
// QbsDeployConfigurationFactory:
|
setDefaultDisplayName(QCoreApplication::translate("Qbs", "Qbs Install"));
|
||||||
// --------------------------------------------------------------------
|
|
||||||
|
|
||||||
QbsDeployConfigurationFactory::QbsDeployConfigurationFactory(QObject *parent) :
|
|
||||||
ProjectExplorer::DeployConfigurationFactory(parent)
|
|
||||||
{
|
|
||||||
setObjectName(QLatin1String("QbsDeployConfiguration"));
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Core::Id> QbsDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
|
||||||
{
|
|
||||||
QList<Core::Id> ids;
|
|
||||||
const Core::Id deviceId = ProjectExplorer::DeviceKitInformation::deviceId(parent->kit());
|
|
||||||
if (qobject_cast<QbsProject *>(parent->project())
|
|
||||||
&& deviceId == ProjectExplorer::Constants::DESKTOP_DEVICE_ID) {
|
|
||||||
ids << genericQbsDeployConfigurationId();
|
|
||||||
}
|
|
||||||
return ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QbsDeployConfigurationFactory::displayNameForId(Core::Id id) const
|
|
||||||
{
|
|
||||||
if (id == genericQbsDeployConfigurationId())
|
|
||||||
return genericQbsDisplayName();
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QbsDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent,
|
|
||||||
const Core::Id id) const
|
|
||||||
{
|
|
||||||
return availableCreationIds(parent).contains(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::DeployConfiguration
|
|
||||||
*QbsDeployConfigurationFactory::create(ProjectExplorer::Target *parent, Core::Id id)
|
|
||||||
{
|
|
||||||
Q_ASSERT(canCreate(parent, id));
|
|
||||||
|
|
||||||
QbsDeployConfiguration *dc = new QbsDeployConfiguration(parent, id);
|
|
||||||
dc->setDisplayName(genericQbsDisplayName());
|
|
||||||
return dc;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QbsDeployConfigurationFactory::canRestore(ProjectExplorer::Target *parent,
|
|
||||||
const QVariantMap &map) const
|
|
||||||
{
|
|
||||||
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::DeployConfiguration
|
|
||||||
*QbsDeployConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
|
||||||
{
|
|
||||||
if (!canRestore(parent, map))
|
|
||||||
return 0;
|
|
||||||
Core::Id id = ProjectExplorer::idFromMap(map);
|
|
||||||
QbsDeployConfiguration *dc = new QbsDeployConfiguration(parent, id);
|
|
||||||
if (!dc->fromMap(map)) {
|
|
||||||
delete dc;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return dc;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QbsDeployConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *product) const
|
|
||||||
{
|
|
||||||
return canCreate(parent, product->id());
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::DeployConfiguration
|
|
||||||
*QbsDeployConfigurationFactory::clone(ProjectExplorer::Target *parent,
|
|
||||||
ProjectExplorer::DeployConfiguration *product)
|
|
||||||
{
|
|
||||||
if (!canClone(parent, product))
|
|
||||||
return 0;
|
|
||||||
return new QbsDeployConfiguration(parent, qobject_cast<QbsDeployConfiguration *>(product));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -28,22 +28,14 @@
|
|||||||
#include <projectexplorer/deployconfiguration.h>
|
#include <projectexplorer/deployconfiguration.h>
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QbsDeployConfigurationFactory;
|
|
||||||
|
|
||||||
class QbsDeployConfiguration : public ProjectExplorer::DeployConfiguration
|
class QbsDeployConfiguration : public ProjectExplorer::DeployConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
public:
|
||||||
QbsDeployConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
explicit QbsDeployConfiguration(ProjectExplorer::Target *target);
|
||||||
QbsDeployConfiguration(ProjectExplorer::Target *target,
|
|
||||||
ProjectExplorer::DeployConfiguration *source);
|
|
||||||
|
|
||||||
friend class QbsDeployConfigurationFactory;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class QbsDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
class QbsDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
||||||
@@ -51,17 +43,7 @@ class QbsDeployConfigurationFactory : public ProjectExplorer::DeployConfiguratio
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QbsDeployConfigurationFactory(QObject *parent = 0);
|
QbsDeployConfigurationFactory();
|
||||||
|
|
||||||
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const override;
|
|
||||||
QString displayNameForId(Core::Id id) const override;
|
|
||||||
bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const override;
|
|
||||||
ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent, Core::Id id) override;
|
|
||||||
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const override;
|
|
||||||
ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
|
|
||||||
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *product) const override;
|
|
||||||
ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent,
|
|
||||||
ProjectExplorer::DeployConfiguration *product) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -58,19 +58,17 @@ namespace Internal {
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsInstallStep::QbsInstallStep(ProjectExplorer::BuildStepList *bsl) :
|
QbsInstallStep::QbsInstallStep(ProjectExplorer::BuildStepList *bsl) :
|
||||||
ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_INSTALLSTEP_ID)),
|
ProjectExplorer::BuildStep(bsl, Constants::QBS_INSTALLSTEP_ID)
|
||||||
m_job(0), m_showCompilerOutput(true), m_parser(0)
|
|
||||||
{
|
{
|
||||||
setDisplayName(tr("Qbs Install"));
|
setDisplayName(tr("Qbs Install"));
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
QbsInstallStep::QbsInstallStep(ProjectExplorer::BuildStepList *bsl, const QbsInstallStep *other) :
|
const QbsBuildConfiguration * const bc = buildConfig();
|
||||||
ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_INSTALLSTEP_ID)),
|
connect(bc, &QbsBuildConfiguration::qbsConfigurationChanged,
|
||||||
m_qbsInstallOptions(other->m_qbsInstallOptions), m_job(0),
|
this, &QbsInstallStep::handleBuildConfigChanged);
|
||||||
m_showCompilerOutput(other->m_showCompilerOutput), m_parser(0)
|
if (bc->qbsStep()) {
|
||||||
{
|
connect(bc->qbsStep(), &QbsBuildStep::qbsBuildOptionsChanged,
|
||||||
ctor();
|
this, &QbsInstallStep::handleBuildConfigChanged);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QbsInstallStep::~QbsInstallStep()
|
QbsInstallStep::~QbsInstallStep()
|
||||||
@@ -146,17 +144,6 @@ bool QbsInstallStep::keepGoing() const
|
|||||||
return m_qbsInstallOptions.keepGoing();
|
return m_qbsInstallOptions.keepGoing();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsInstallStep::ctor()
|
|
||||||
{
|
|
||||||
const QbsBuildConfiguration * const bc = buildConfig();
|
|
||||||
connect(bc, &QbsBuildConfiguration::qbsConfigurationChanged,
|
|
||||||
this, &QbsInstallStep::handleBuildConfigChanged);
|
|
||||||
if (bc->qbsStep()) {
|
|
||||||
connect(bc->qbsStep(), &QbsBuildStep::qbsBuildOptionsChanged,
|
|
||||||
this, &QbsInstallStep::handleBuildConfigChanged);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const QbsBuildConfiguration *QbsInstallStep::buildConfig() const
|
const QbsBuildConfiguration *QbsInstallStep::buildConfig() const
|
||||||
{
|
{
|
||||||
return static_cast<QbsBuildConfiguration *>(
|
return static_cast<QbsBuildConfiguration *>(
|
||||||
@@ -346,30 +333,13 @@ void QbsInstallStepConfigWidget::changeKeepGoing(bool kg)
|
|||||||
// QbsInstallStepFactory:
|
// QbsInstallStepFactory:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsInstallStepFactory::QbsInstallStepFactory(QObject *parent) :
|
QbsInstallStepFactory::QbsInstallStepFactory()
|
||||||
ProjectExplorer::IBuildStepFactory(parent)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo> QbsInstallStepFactory::availableSteps(ProjectExplorer::BuildStepList *parent) const
|
|
||||||
{
|
{
|
||||||
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_DEPLOY
|
registerStep<QbsInstallStep>(Constants::QBS_INSTALLSTEP_ID);
|
||||||
&& qobject_cast<ProjectExplorer::DeployConfiguration *>(parent->parent())
|
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||||
&& qobject_cast<QbsProject *>(parent->target()->project()))
|
setSupportedDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||||
return {{ Constants::QBS_INSTALLSTEP_ID, tr("Qbs Install") }};
|
setSupportedProjectType(Constants::PROJECT_ID);
|
||||||
return {};
|
setDisplayName(tr("Qbs Install"));
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *QbsInstallStepFactory::create(ProjectExplorer::BuildStepList *parent,
|
|
||||||
const Core::Id id)
|
|
||||||
{
|
|
||||||
Q_UNUSED(id);
|
|
||||||
return new QbsInstallStep(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *QbsInstallStepFactory::clone(ProjectExplorer::BuildStepList *parent,
|
|
||||||
ProjectExplorer::BuildStep *product)
|
|
||||||
{
|
|
||||||
return new QbsInstallStep(parent, static_cast<QbsInstallStep *>(product));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -43,7 +43,6 @@ class QbsInstallStep : public ProjectExplorer::BuildStep
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QbsInstallStep(ProjectExplorer::BuildStepList *bsl);
|
explicit QbsInstallStep(ProjectExplorer::BuildStepList *bsl);
|
||||||
QbsInstallStep(ProjectExplorer::BuildStepList *bsl, const QbsInstallStep *other);
|
|
||||||
~QbsInstallStep() override;
|
~QbsInstallStep() override;
|
||||||
|
|
||||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||||
@@ -68,7 +67,6 @@ signals:
|
|||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
|
||||||
const QbsBuildConfiguration *buildConfig() const;
|
const QbsBuildConfiguration *buildConfig() const;
|
||||||
void installDone(bool success);
|
void installDone(bool success);
|
||||||
void handleTaskStarted(const QString &desciption, int max);
|
void handleTaskStarted(const QString &desciption, int max);
|
||||||
@@ -84,11 +82,11 @@ private:
|
|||||||
|
|
||||||
qbs::InstallOptions m_qbsInstallOptions;
|
qbs::InstallOptions m_qbsInstallOptions;
|
||||||
|
|
||||||
QFutureInterface<bool> *m_fi;
|
QFutureInterface<bool> *m_fi = nullptr;
|
||||||
qbs::InstallJob *m_job;
|
qbs::InstallJob *m_job = nullptr;
|
||||||
int m_progressBase;
|
int m_progressBase;
|
||||||
bool m_showCompilerOutput;
|
bool m_showCompilerOutput = true;
|
||||||
ProjectExplorer::IOutputParser *m_parser;
|
ProjectExplorer::IOutputParser *m_parser = nullptr;
|
||||||
|
|
||||||
friend class QbsInstallStepConfigWidget;
|
friend class QbsInstallStepConfigWidget;
|
||||||
};
|
};
|
||||||
@@ -119,18 +117,12 @@ private:
|
|||||||
bool m_ignoreChange;
|
bool m_ignoreChange;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QbsInstallStepFactory : public ProjectExplorer::IBuildStepFactory
|
class QbsInstallStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QbsInstallStepFactory(QObject *parent = 0);
|
QbsInstallStepFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildStepInfo>
|
|
||||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
|
|
||||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -58,6 +58,7 @@ const char ACTION_REBUILD_SUBPROJECT[] = "Qbs.RebuildSubproject";
|
|||||||
const char QBS_BUILDSTEP_ID[] = "Qbs.BuildStep";
|
const char QBS_BUILDSTEP_ID[] = "Qbs.BuildStep";
|
||||||
const char QBS_CLEANSTEP_ID[] = "Qbs.CleanStep";
|
const char QBS_CLEANSTEP_ID[] = "Qbs.CleanStep";
|
||||||
const char QBS_INSTALLSTEP_ID[] = "Qbs.InstallStep";
|
const char QBS_INSTALLSTEP_ID[] = "Qbs.InstallStep";
|
||||||
|
const char QBS_BC_ID[] = "Qbs.QbsBuildConfiguration";
|
||||||
|
|
||||||
// QBS strings:
|
// QBS strings:
|
||||||
const char QBS_VARIANT_DEBUG[] = "debug";
|
const char QBS_VARIANT_DEBUG[] = "debug";
|
||||||
|
@@ -72,21 +72,6 @@ const char QBS_RC_PREFIX[] = "Qbs.RunConfiguration:";
|
|||||||
|
|
||||||
static QString rcNameSeparator() { return QLatin1String("---Qbs.RC.NameSeparator---"); }
|
static QString rcNameSeparator() { return QLatin1String("---Qbs.RC.NameSeparator---"); }
|
||||||
|
|
||||||
static QString uniqueProductNameFromId(Core::Id id)
|
|
||||||
{
|
|
||||||
const QString suffix = id.suffixAfter(QBS_RC_PREFIX);
|
|
||||||
return suffix.left(suffix.indexOf(rcNameSeparator()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString productDisplayNameFromId(Core::Id id)
|
|
||||||
{
|
|
||||||
const QString suffix = id.suffixAfter(QBS_RC_PREFIX);
|
|
||||||
const int sepPos = suffix.indexOf(rcNameSeparator());
|
|
||||||
if (sepPos == -1)
|
|
||||||
return suffix;
|
|
||||||
return suffix.mid(sepPos + rcNameSeparator().count());
|
|
||||||
}
|
|
||||||
|
|
||||||
const qbs::ProductData findProduct(const qbs::ProjectData &pro, const QString &uniqeName)
|
const qbs::ProductData findProduct(const qbs::ProjectData &pro, const QString &uniqeName)
|
||||||
{
|
{
|
||||||
foreach (const qbs::ProductData &product, pro.allProducts()) {
|
foreach (const qbs::ProductData &product, pro.allProducts()) {
|
||||||
@@ -101,7 +86,7 @@ const qbs::ProductData findProduct(const qbs::ProjectData &pro, const QString &u
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsRunConfiguration::QbsRunConfiguration(Target *target)
|
QbsRunConfiguration::QbsRunConfiguration(Target *target)
|
||||||
: RunConfiguration(target)
|
: RunConfiguration(target, QBS_RC_PREFIX)
|
||||||
{
|
{
|
||||||
auto envAspect = new LocalEnvironmentAspect(this,
|
auto envAspect = new LocalEnvironmentAspect(this,
|
||||||
[](RunConfiguration *rc, Environment &env) {
|
[](RunConfiguration *rc, Environment &env) {
|
||||||
@@ -138,14 +123,30 @@ QbsRunConfiguration::QbsRunConfiguration(Target *target)
|
|||||||
this, &QbsRunConfiguration::installStepChanged);
|
this, &QbsRunConfiguration::installStepChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsRunConfiguration::initialize(Core::Id id)
|
bool QbsRunConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
RunConfiguration::initialize(id);
|
if (!RunConfiguration::fromMap(map))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QString extraId = ProjectExplorer::idFromMap(map).suffixAfter(id());
|
||||||
|
if (!extraId.isEmpty()) {
|
||||||
|
const int sepPos = extraId.indexOf(rcNameSeparator());
|
||||||
|
m_uniqueProductName = extraId.left(sepPos);
|
||||||
|
m_productDisplayName = sepPos == -1 ? QString() : extraId.mid(sepPos + rcNameSeparator().size());
|
||||||
|
}
|
||||||
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
installStepChanged();
|
installStepChanged();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QbsRunConfiguration::extraId() const
|
||||||
|
{
|
||||||
|
return m_uniqueProductName + rcNameSeparator() + m_productDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QWidget *QbsRunConfiguration::createConfigurationWidget()
|
QWidget *QbsRunConfiguration::createConfigurationWidget()
|
||||||
{
|
{
|
||||||
return new QbsRunConfigurationWidget(this);
|
return new QbsRunConfigurationWidget(this);
|
||||||
@@ -266,17 +267,17 @@ void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
|
|||||||
|
|
||||||
QString QbsRunConfiguration::buildSystemTarget() const
|
QString QbsRunConfiguration::buildSystemTarget() const
|
||||||
{
|
{
|
||||||
return productDisplayNameFromId(id());
|
return m_productDisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QbsRunConfiguration::uniqueProductName() const
|
QString QbsRunConfiguration::uniqueProductName() const
|
||||||
{
|
{
|
||||||
return uniqueProductNameFromId(id());
|
return m_uniqueProductName;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QbsRunConfiguration::defaultDisplayName()
|
QString QbsRunConfiguration::defaultDisplayName()
|
||||||
{
|
{
|
||||||
QString defaultName = productDisplayNameFromId(id());
|
QString defaultName = m_productDisplayName;
|
||||||
if (defaultName.isEmpty())
|
if (defaultName.isEmpty())
|
||||||
defaultName = tr("Qbs Run Configuration");
|
defaultName = tr("Qbs Run Configuration");
|
||||||
return defaultName;
|
return defaultName;
|
||||||
|
@@ -68,9 +68,9 @@ signals:
|
|||||||
void targetInformationChanged();
|
void targetInformationChanged();
|
||||||
void usingDyldImageSuffixChanged(bool);
|
void usingDyldImageSuffixChanged(bool);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initialize(Core::Id id) override;
|
bool fromMap(const QVariantMap &map) final;
|
||||||
|
QString extraId() const final;
|
||||||
|
|
||||||
void installStepChanged();
|
void installStepChanged();
|
||||||
void installStepToBeRemoved(int pos);
|
void installStepToBeRemoved(int pos);
|
||||||
@@ -81,6 +81,8 @@ private:
|
|||||||
|
|
||||||
QbsInstallStep *m_currentInstallStep = nullptr; // We do not take ownership!
|
QbsInstallStep *m_currentInstallStep = nullptr; // We do not take ownership!
|
||||||
ProjectExplorer::BuildStepList *m_currentBuildStepList = nullptr; // We do not take ownership!
|
ProjectExplorer::BuildStepList *m_currentBuildStepList = nullptr; // We do not take ownership!
|
||||||
|
QString m_uniqueProductName;
|
||||||
|
QString m_productDisplayName;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QbsRunConfigurationWidget : public QWidget
|
class QbsRunConfigurationWidget : public QWidget
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user