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:
@@ -32,12 +32,14 @@
|
||||
#include "projectexplorer/kitinformation.h"
|
||||
#include "projectexplorer/namedwidget.h"
|
||||
#include "projectexplorer/target.h"
|
||||
|
||||
#include "qmakeprojectmanager/qmakebuildinfo.h"
|
||||
#include "qmakeprojectmanager/qmakeprojectmanagerconstants.h"
|
||||
|
||||
#include "utils/algorithm.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace QmakeProjectManager;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
@@ -47,13 +49,8 @@ const char qmakeProvisioningProfileSettings[] = "QMAKE_MAC_XCODE_SETTINGS+=qprof
|
||||
const char signingIdentifierKey[] = "Ios.SigningIdentifier";
|
||||
const char autoManagedSigningKey[] = "Ios.AutoManagedSigning";
|
||||
|
||||
IosBuildConfiguration::IosBuildConfiguration(ProjectExplorer::Target *target) :
|
||||
QmakeBuildConfiguration(target)
|
||||
{
|
||||
}
|
||||
|
||||
IosBuildConfiguration::IosBuildConfiguration(ProjectExplorer::Target *target, IosBuildConfiguration *source) :
|
||||
QmakeBuildConfiguration(target, source)
|
||||
IosBuildConfiguration::IosBuildConfiguration(Target *target)
|
||||
: QmakeBuildConfiguration(target)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -143,12 +140,11 @@ void IosBuildConfiguration::updateQmakeCommand()
|
||||
}
|
||||
}
|
||||
|
||||
IosBuildConfigurationFactory::IosBuildConfigurationFactory(QObject *parent)
|
||||
: QmakeBuildConfigurationFactory(parent)
|
||||
IosBuildConfigurationFactory::IosBuildConfigurationFactory()
|
||||
{
|
||||
registerBuildConfiguration<IosBuildConfiguration>(QmakeProjectManager::Constants::QMAKE_BC_ID);
|
||||
}
|
||||
|
||||
|
||||
int IosBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
|
||||
{
|
||||
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
|
||||
{
|
||||
return (QmakeBuildConfigurationFactory::priority(parent) >= 0
|
||||
return (IBuildConfigurationFactory::priority(parent) >= 0
|
||||
&& 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 Ios
|
||||
|
||||
@@ -26,49 +26,35 @@
|
||||
|
||||
#include "qmakeprojectmanager/qmakebuildconfiguration.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Target;
|
||||
class Kit;
|
||||
class NamedWidget;
|
||||
}
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
class IosBuildConfiguration : public QmakeProjectManager::QmakeBuildConfiguration
|
||||
{
|
||||
friend class IosBuildConfigurationFactory;
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
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:
|
||||
QList<ProjectExplorer::NamedWidget *> createSubConfigWidgets() override;
|
||||
QVariantMap toMap() const override;
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
||||
void onSigningSettingsChanged(bool autoManagedSigning, QString identifier);
|
||||
void updateQmakeCommand();
|
||||
|
||||
private:
|
||||
QString m_signingIdentifier;
|
||||
bool m_autoManagedSigning = true;
|
||||
};
|
||||
|
||||
|
||||
class IosBuildConfigurationFactory : public QmakeProjectManager::QmakeBuildConfigurationFactory
|
||||
{
|
||||
public:
|
||||
explicit IosBuildConfigurationFactory(QObject *parent = 0);
|
||||
IosBuildConfigurationFactory();
|
||||
|
||||
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) 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
|
||||
|
||||
@@ -60,30 +60,14 @@ const char BUILD_ARGUMENTS_KEY[] = "Ios.IosBuildStep.XcodeArguments";
|
||||
const char CLEAN_KEY[] = "Ios.IosBuildStep.Clean";
|
||||
|
||||
IosBuildStep::IosBuildStep(BuildStepList *parent) :
|
||||
AbstractProcessStep(parent, Id(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()
|
||||
AbstractProcessStep(parent, IOS_BUILD_STEP_ID)
|
||||
{
|
||||
setDefaultDisplayName(QCoreApplication::translate("GenericProjectManager::Internal::IosBuildStep",
|
||||
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)
|
||||
@@ -127,16 +111,6 @@ bool IosBuildStep::init(QList<const BuildStep *> &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 map(AbstractProcessStep::toMap());
|
||||
@@ -323,49 +297,20 @@ void IosBuildStepConfigWidget::extraArgumentsChanged()
|
||||
m_buildStep->setExtraArguments(Utils::QtcProcess::splitArgs(
|
||||
m_ui->extraArgumentsLineEdit->text()));
|
||||
}
|
||||
|
||||
//
|
||||
// IosBuildStepFactory
|
||||
//
|
||||
|
||||
IosBuildStepFactory::IosBuildStepFactory(QObject *parent) :
|
||||
IBuildStepFactory(parent)
|
||||
IosBuildStepFactory::IosBuildStepFactory()
|
||||
{
|
||||
}
|
||||
|
||||
BuildStep *IosBuildStepFactory::create(BuildStepList *parent, const Id id)
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
IosBuildStep *step = new IosBuildStep(parent);
|
||||
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
|
||||
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)}};
|
||||
registerStep<IosBuildStep>(IOS_BUILD_STEP_ID);
|
||||
setSupportedDeviceTypes({Constants::IOS_DEVICE_TYPE,
|
||||
Constants::IOS_SIMULATOR_TYPE});
|
||||
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_CLEAN,
|
||||
ProjectExplorer::Constants::BUILDSTEPS_BUILD});
|
||||
setDisplayName(QCoreApplication::translate("GenericProjectManager::Internal::IosBuildStep",
|
||||
IOS_BUILD_STEP_DISPLAY_NAME));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -60,17 +60,9 @@ public:
|
||||
QStringList defaultArguments() 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:
|
||||
void ctor();
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
QVariantMap toMap() const override;
|
||||
|
||||
QStringList m_baseBuildArguments;
|
||||
QStringList m_extraArguments;
|
||||
@@ -99,19 +91,10 @@ private:
|
||||
QString m_summaryText;
|
||||
};
|
||||
|
||||
class IosBuildStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
class IosBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IosBuildStepFactory(QObject *parent = 0);
|
||||
|
||||
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;
|
||||
IosBuildStepFactory();
|
||||
};
|
||||
|
||||
} // 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_DEVICE_ID[] = "iOS 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 quint16 IOS_DEVICE_PORT_START = 30000;
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qmakeprojectmanager/qmakeproject.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
@@ -41,89 +40,28 @@ namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
const char IOS_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.IosDeployConfiguration";
|
||||
const char IOS_DC_PREFIX[] = "Qt4ProjectManager.IosDeployConfiguration.";
|
||||
|
||||
IosDeployConfiguration::IosDeployConfiguration(Target *parent, Core::Id id)
|
||||
: DeployConfiguration(parent, id)
|
||||
IosDeployConfiguration::IosDeployConfiguration(Target *parent)
|
||||
: DeployConfiguration(parent, IOS_DEPLOYCONFIGURATION_ID)
|
||||
{
|
||||
setDisplayName(tr("Deploy to iOS"));
|
||||
setDefaultDisplayName(displayName());
|
||||
}
|
||||
|
||||
IosDeployConfiguration::IosDeployConfiguration(Target *parent, DeployConfiguration *source)
|
||||
: DeployConfiguration(parent, source)
|
||||
void IosDeployConfiguration::initialize()
|
||||
{
|
||||
cloneSteps(source);
|
||||
stepList()->insertStep(0, new IosDeployStep(stepList()));
|
||||
}
|
||||
|
||||
IosDeployConfigurationFactory::IosDeployConfigurationFactory(QObject *parent)
|
||||
: DeployConfigurationFactory(parent)
|
||||
IosDeployConfigurationFactory::IosDeployConfigurationFactory()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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();
|
||||
return DeployConfigurationFactory::canHandle(target) && IosManager::supportsIos(target->kit());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -33,15 +33,10 @@ namespace Internal {
|
||||
class IosDeployConfiguration : public ProjectExplorer::DeployConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class IosDeployConfigurationFactory;
|
||||
|
||||
public:
|
||||
IosDeployConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
||||
|
||||
protected:
|
||||
IosDeployConfiguration(ProjectExplorer::Target *parent,
|
||||
ProjectExplorer::DeployConfiguration *source);
|
||||
|
||||
explicit IosDeployConfiguration(ProjectExplorer::Target *parent);
|
||||
void initialize() override;
|
||||
};
|
||||
|
||||
class IosDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
||||
@@ -49,21 +44,9 @@ class IosDeployConfigurationFactory : public ProjectExplorer::DeployConfiguratio
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IosDeployConfigurationFactory(QObject *parent = 0);
|
||||
IosDeployConfigurationFactory();
|
||||
|
||||
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 *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;
|
||||
bool canHandle(ProjectExplorer::Target *target) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -59,24 +59,7 @@ const Core::Id IosDeployStep::Id("Qt4ProjectManager.IosDeployStep");
|
||||
|
||||
IosDeployStep::IosDeployStep(BuildStepList *parent)
|
||||
: 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();
|
||||
connect(DeviceManager::instance(), &DeviceManager::updated,
|
||||
this, &IosDeployStep::updateDisplayNames);
|
||||
|
||||
@@ -36,16 +36,9 @@
|
||||
#include <QFutureInterface>
|
||||
#include <QProcess>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QEventLoop;
|
||||
class QTimer;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Ios {
|
||||
class IosToolHandler;
|
||||
namespace Internal {
|
||||
class IosDeviceConfigListModel;
|
||||
class IosPackageCreationStep;
|
||||
|
||||
class IosDeployStep : public ProjectExplorer::BuildStep
|
||||
{
|
||||
@@ -67,9 +60,6 @@ public:
|
||||
void run(QFutureInterface<bool> &fi) override;
|
||||
void cleanup();
|
||||
void cancel() override;
|
||||
signals:
|
||||
//void done();
|
||||
//void error();
|
||||
|
||||
private:
|
||||
void handleIsTransferringApp(Ios::IosToolHandler *handler, const QString &bundlePath,
|
||||
@@ -80,7 +70,7 @@ private:
|
||||
void handleFinished(Ios::IosToolHandler *handler);
|
||||
void handleErrorMsg(Ios::IosToolHandler *handler, const QString &msg);
|
||||
void updateDisplayNames();
|
||||
IosDeployStep(ProjectExplorer::BuildStepList *bc, IosDeployStep *other);
|
||||
|
||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||
bool immutable() const override { return true; }
|
||||
@@ -89,21 +79,20 @@ private:
|
||||
IosDevice::ConstPtr iosdevice() const;
|
||||
IosSimulator::ConstPtr iossimulator() const;
|
||||
|
||||
void ctor();
|
||||
QString deviceId() const;
|
||||
QString appBundle() const;
|
||||
void raiseError(const QString &error);
|
||||
void writeOutput(const QString &text, OutputFormat = OutputFormat::NormalMessage);
|
||||
void checkProvisioningProfile();
|
||||
|
||||
TransferStatus m_transferStatus;
|
||||
IosToolHandler *m_toolHandler;
|
||||
TransferStatus m_transferStatus = NoTransfer;
|
||||
IosToolHandler *m_toolHandler = nullptr;
|
||||
QFutureInterface<bool> m_futureInterface;
|
||||
ProjectExplorer::IDevice::ConstPtr m_device;
|
||||
QString m_bundlePath;
|
||||
IosDeviceType m_deviceType;
|
||||
static const Core::Id Id;
|
||||
bool m_expectFail;
|
||||
bool m_expectFail = false;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
@@ -41,29 +39,18 @@ using namespace ProjectExplorer;
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
IosDeployStepFactory::IosDeployStepFactory(QObject *parent)
|
||||
: IBuildStepFactory(parent)
|
||||
IosDeployStepFactory::IosDeployStepFactory()
|
||||
{
|
||||
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
|
||||
&& 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));
|
||||
return BuildStepFactory::canHandle(parent)
|
||||
&& IosManager::supportsIos(parent->target());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -30,19 +30,13 @@
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
class IosDeployStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
class IosDeployStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IosDeployStepFactory(QObject *parent = 0);
|
||||
|
||||
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;
|
||||
IosDeployStepFactory();
|
||||
bool canHandle(ProjectExplorer::BuildStepList *parent) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -56,31 +56,13 @@ static const char COMMAND_PARTIAL_KEY[] = ".Command";
|
||||
static const char ARGUMENTS_PARTIAL_KEY[] = ".Arguments";
|
||||
static const char CLEAN_PARTIAL_KEY[] = ".Clean";
|
||||
|
||||
IosPresetBuildStep::IosPresetBuildStep(BuildStepList *parent, const Id id) :
|
||||
AbstractProcessStep(parent, id),
|
||||
IosDsymBuildStep::IosDsymBuildStep(BuildStepList *parent) :
|
||||
AbstractProcessStep(parent, Constants::IOS_DSYM_BUILD_STEP_ID),
|
||||
m_clean(parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN)
|
||||
{
|
||||
}
|
||||
|
||||
bool IosPresetBuildStep::completeSetup()
|
||||
{
|
||||
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)
|
||||
bool IosDsymBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
if (!bc)
|
||||
@@ -108,7 +90,7 @@ bool IosPresetBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
return AbstractProcessStep::init(earlierSteps);
|
||||
}
|
||||
|
||||
QVariantMap IosPresetBuildStep::toMap() const
|
||||
QVariantMap IosDsymBuildStep::toMap() const
|
||||
{
|
||||
QVariantMap map(AbstractProcessStep::toMap());
|
||||
|
||||
@@ -121,7 +103,7 @@ QVariantMap IosPresetBuildStep::toMap() const
|
||||
return map;
|
||||
}
|
||||
|
||||
bool IosPresetBuildStep::fromMap(const QVariantMap &map)
|
||||
bool IosDsymBuildStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
QVariant bArgs = map.value(id().withSuffix(ARGUMENTS_PARTIAL_KEY).toString());
|
||||
m_arguments = bArgs.toStringList();
|
||||
@@ -138,14 +120,14 @@ bool IosPresetBuildStep::fromMap(const QVariantMap &map)
|
||||
return BuildStep::fromMap(map);
|
||||
}
|
||||
|
||||
QStringList IosPresetBuildStep::defaultArguments() const
|
||||
QStringList IosDsymBuildStep::defaultArguments() const
|
||||
{
|
||||
if (m_clean)
|
||||
return defaultCleanCmdList().mid(1);
|
||||
return defaultCmdList().mid(1);
|
||||
}
|
||||
|
||||
QString IosPresetBuildStep::defaultCommand() const
|
||||
QString IosDsymBuildStep::defaultCommand() const
|
||||
{
|
||||
if (m_clean)
|
||||
return defaultCleanCmdList().at(0);
|
||||
@@ -153,248 +135,9 @@ QString IosPresetBuildStep::defaultCommand() const
|
||||
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
|
||||
{
|
||||
IosRunConfiguration *runConf =
|
||||
qobject_cast<IosRunConfiguration *>(target()->activeRunConfiguration());
|
||||
auto runConf = qobject_cast<IosRunConfiguration *>(target()->activeRunConfiguration());
|
||||
QTC_ASSERT(runConf, return QStringList("echo"));
|
||||
QString dsymPath = runConf->bundleDirectory().toUserOutput();
|
||||
dsymPath.chop(4);
|
||||
@@ -418,6 +161,181 @@ QStringList IosDsymBuildStep::defaultCmdList() const
|
||||
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 Ios
|
||||
|
||||
@@ -31,17 +31,17 @@ namespace Ios {
|
||||
namespace Internal {
|
||||
namespace Ui { class IosPresetBuildStep; }
|
||||
|
||||
class IosPresetBuildStepConfigWidget;
|
||||
class IosPresetBuildStepFactory;
|
||||
class IosDsymBuildStepConfigWidget;
|
||||
|
||||
class IosPresetBuildStep : public ProjectExplorer::AbstractProcessStep
|
||||
class IosDsymBuildStep : public ProjectExplorer::AbstractProcessStep
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class IosPresetBuildStepConfigWidget;
|
||||
friend class IosPresetBuildStepFactory;
|
||||
friend class IosDsymBuildStepConfigWidget;
|
||||
|
||||
public:
|
||||
IosDsymBuildStep(ProjectExplorer::BuildStepList *parent);
|
||||
|
||||
bool init(QList<const BuildStep *> &earlierSteps) override;
|
||||
void run(QFutureInterface<bool> &fi) override;
|
||||
|
||||
@@ -53,31 +53,27 @@ public:
|
||||
QString defaultCommand() const;
|
||||
QString command() const;
|
||||
void setCommand(const QString &command);
|
||||
bool clean() const;
|
||||
void setClean(bool clean);
|
||||
bool isDefault() const;
|
||||
|
||||
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:
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
QStringList defaultCleanCmdList() const;
|
||||
QStringList defaultCmdList() const;
|
||||
|
||||
QStringList m_arguments;
|
||||
QString m_command;
|
||||
bool m_clean;
|
||||
};
|
||||
|
||||
class IosPresetBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
class IosDsymBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IosPresetBuildStepConfigWidget(IosPresetBuildStep *buildStep);
|
||||
~IosPresetBuildStepConfigWidget();
|
||||
IosDsymBuildStepConfigWidget(IosDsymBuildStep *buildStep);
|
||||
~IosDsymBuildStepConfigWidget();
|
||||
QString displayName() const override;
|
||||
QString summaryText() const override;
|
||||
|
||||
@@ -88,47 +84,15 @@ private:
|
||||
void updateDetails();
|
||||
|
||||
Ui::IosPresetBuildStep *m_ui;
|
||||
IosPresetBuildStep *m_buildStep;
|
||||
IosDsymBuildStep *m_buildStep;
|
||||
QString m_summaryText;
|
||||
};
|
||||
|
||||
class IosPresetBuildStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
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
|
||||
class IosDsymBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QList<ProjectExplorer::BuildStepInfo>
|
||||
availableSteps(ProjectExplorer::BuildStepList *parent) const override;
|
||||
|
||||
IosPresetBuildStep *createPresetStep(ProjectExplorer::BuildStepList *parent,
|
||||
const Core::Id id) const override;
|
||||
explicit IosDsymBuildStepFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -95,7 +95,7 @@ private:
|
||||
};
|
||||
|
||||
IosRunConfiguration::IosRunConfiguration(Target *target)
|
||||
: RunConfiguration(target)
|
||||
: RunConfiguration(target, Constants::IOS_RC_ID_PREFIX)
|
||||
{
|
||||
addExtraAspect(new ArgumentsAspect(this, "Ios.run_arguments"));
|
||||
|
||||
@@ -105,15 +105,13 @@ IosRunConfiguration::IosRunConfiguration(Target *target)
|
||||
this, &IosRunConfiguration::deviceChanges);
|
||||
}
|
||||
|
||||
void IosRunConfiguration::initialize(Core::Id id)
|
||||
QString IosRunConfiguration::extraId() const
|
||||
{
|
||||
RunConfiguration::initialize(id);
|
||||
m_profilePath = pathFromId(id);
|
||||
|
||||
updateDisplayNames();
|
||||
return m_profilePath.toString();
|
||||
}
|
||||
|
||||
void IosRunConfiguration::deviceChanges() {
|
||||
void IosRunConfiguration::deviceChanges()
|
||||
{
|
||||
updateDisplayNames();
|
||||
updateEnabledState();
|
||||
}
|
||||
@@ -242,6 +240,12 @@ FileName IosRunConfiguration::localExecutable() const
|
||||
|
||||
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;
|
||||
map.value(deviceTypeKey).toInt(&deviceTypeIsInt);
|
||||
if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).toMap())) {
|
||||
@@ -250,7 +254,9 @@ bool IosRunConfiguration::fromMap(const QVariantMap &map)
|
||||
else
|
||||
m_deviceType = IosDeviceType(IosDeviceType::SimulatedDevice);
|
||||
}
|
||||
return RunConfiguration::fromMap(map);
|
||||
|
||||
updateDisplayNames();
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap IosRunConfiguration::toMap() const
|
||||
@@ -265,15 +271,6 @@ QString IosRunConfiguration::buildSystemTarget() const
|
||||
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
|
||||
{
|
||||
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||
|
||||
@@ -66,14 +66,11 @@ public:
|
||||
|
||||
QString buildSystemTarget() const final;
|
||||
|
||||
static Utils::FileName pathFromId(Core::Id id);
|
||||
|
||||
signals:
|
||||
void localExecutableChanged();
|
||||
|
||||
private:
|
||||
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||
void initialize(Core::Id id) override;
|
||||
QString extraId() const final;
|
||||
|
||||
void deviceChanges();
|
||||
friend class IosRunConfigurationWidget;
|
||||
|
||||
Reference in New Issue
Block a user