Ios: Use device types as restrictions on project configurations

Change-Id: I3c31f14eba9d9f68a333a814bea800a3da38d4a2
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
hjk
2017-11-30 18:43:44 +01:00
parent 44ee8b9068
commit 280b7e2109
21 changed files with 16 additions and 182 deletions

View File

@@ -10,7 +10,6 @@ macx: LIBS += -framework CoreFoundation -framework IOKit
HEADERS += \
iosconstants.h \
iosconfigurations.h \
iosmanager.h \
iosrunconfiguration.h \
iosrunfactories.h \
iossettingspage.h \
@@ -41,7 +40,6 @@ HEADERS += \
SOURCES += \
iosconfigurations.cpp \
iosmanager.cpp \
iosrunconfiguration.cpp \
iosrunfactories.cpp \
iossettingspage.cpp \

View File

@@ -44,8 +44,6 @@ QtcPlugin {
"iosdevicefactory.h",
"iosdsymbuildstep.cpp",
"iosdsymbuildstep.h",
"iosmanager.cpp",
"iosmanager.h",
"iosplugin.cpp",
"iosplugin.h",
"iospresetbuildstep.ui",

View File

@@ -22,12 +22,12 @@
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "iosbuildconfiguration.h"
#include "iosconfigurations.h"
#include "iosconstants.h"
#include "iosbuildsettingswidget.h"
#include "iosmanager.h"
#include "projectexplorer/kitinformation.h"
#include "projectexplorer/namedwidget.h"
@@ -143,20 +143,9 @@ void IosBuildConfiguration::updateQmakeCommand()
IosBuildConfigurationFactory::IosBuildConfigurationFactory()
{
registerBuildConfiguration<IosBuildConfiguration>(QmakeProjectManager::Constants::QMAKE_BC_ID);
setSupportedTargetDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE});
setBasePriority(1);
}
int IosBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
{
return (QmakeBuildConfigurationFactory::priority(k, projectPath) >= 0
&& IosManager::supportsIos(k)) ? 1 : -1;
}
int IosBuildConfigurationFactory::priority(const ProjectExplorer::Target *parent) const
{
return (IBuildConfigurationFactory::priority(parent) >= 0
&& IosManager::supportsIos(parent)) ? 1 : -1;
}
} // namespace Internal
} // namespace Ios

View File

@@ -52,9 +52,6 @@ class IosBuildConfigurationFactory : public QmakeProjectManager::QmakeBuildConfi
{
public:
IosBuildConfigurationFactory();
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
int priority(const ProjectExplorer::Target *parent) const override;
};
} // namespace Internal

View File

@@ -26,7 +26,6 @@
#include "iosbuildstep.h"
#include "iosconstants.h"
#include "ui_iosbuildstep.h"
#include "iosmanager.h"
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/target.h>
@@ -162,7 +161,7 @@ QStringList IosBuildStep::defaultArguments() const
}
if (!SysRootKitInformation::sysRoot(kit).isEmpty())
res << "-sdk" << SysRootKitInformation::sysRoot(kit).toString();
res << "SYMROOT=" + IosManager::resDirForTarget(target());
res << "SYMROOT=" + target()->activeBuildConfiguration()->buildDirectory().toString();
return res;
}

View File

@@ -26,7 +26,6 @@
#include "iosconstants.h"
#include "iosdeploystep.h"
#include "iosdeployconfiguration.h"
#include "iosmanager.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/target.h>
@@ -56,13 +55,9 @@ IosDeployConfigurationFactory::IosDeployConfigurationFactory()
setObjectName("IosDeployConfigurationFactory");
registerDeployConfiguration<IosDeployConfiguration>(IOS_DEPLOYCONFIGURATION_ID);
setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
setSupportedTargetDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE});
setDefaultDisplayName(tr("Deploy on iOS"));
}
bool IosDeployConfigurationFactory::canHandle(Target *target) const
{
return DeployConfigurationFactory::canHandle(target) && IosManager::supportsIos(target->kit());
}
} // namespace Internal
} // namespace Ios

View File

@@ -45,8 +45,6 @@ class IosDeployConfigurationFactory : public ProjectExplorer::DeployConfiguratio
public:
IosDeployConfigurationFactory();
bool canHandle(ProjectExplorer::Target *target) const override;
};
} // namespace Internal

View File

@@ -28,7 +28,6 @@
#include "iosbuildstep.h"
#include "iosconstants.h"
#include "iosrunconfiguration.h"
#include "iosmanager.h"
#include "iostoolhandler.h"
#include <coreplugin/messagemanager.h>

View File

@@ -25,16 +25,10 @@
#include "iosdeploystepfactory.h"
#include "iosconstants.h"
#include "iosdeploystep.h"
#include "iosmanager.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <QCoreApplication>
using namespace ProjectExplorer;
namespace Ios {
namespace Internal {
@@ -44,14 +38,9 @@ IosDeployStepFactory::IosDeployStepFactory()
registerStep<IosDeployStep>(IosDeployStep::Id);
setDisplayName(tr("Deploy to iOS device or emulator"));
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
setSupportedDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE});
setRepeatable(false);
}
bool IosDeployStepFactory::canHandle(BuildStepList *parent) const
{
return BuildStepFactory::canHandle(parent)
&& IosManager::supportsIos(parent->target());
}
} // namespace Internal
} // namespace Ios

View File

@@ -36,7 +36,6 @@ class IosDeployStepFactory : public ProjectExplorer::BuildStepFactory
public:
IosDeployStepFactory();
bool canHandle(ProjectExplorer::BuildStepList *parent) const;
};
} // namespace Internal

View File

@@ -27,7 +27,6 @@
#include "iosconstants.h"
#include "ui_iospresetbuildstep.h"
#include "iosmanager.h"
#include "iosconfigurations.h"
#include "iosrunconfiguration.h"

View File

@@ -1,70 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://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 "iosmanager.h"
#include "iosconfigurations.h"
#include "iosrunconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <qmakeprojectmanager/qmakeproject.h>
#include <qtsupport/qtkitinformation.h>
using namespace QmakeProjectManager;
using namespace ProjectExplorer;
namespace Ios {
namespace Internal {
/*!
Returns \c true if the target supports iOS build, \c false otherwise.
*/
bool IosManager::supportsIos(const Target *target)
{
return qobject_cast<QmakeProject *>(target->project()) && supportsIos(target->kit());
}
/*!
Returns \c true if the kit supports iOS build, \c false otherwise.
*/
bool IosManager::supportsIos(const Kit *kit)
{
bool supports = false;
if (kit) {
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
supports = version && version->type() == QLatin1String(Ios::Constants::IOSQT);
}
return supports;
}
QString IosManager::resDirForTarget(Target *target)
{
return target->activeBuildConfiguration()->buildDirectory().toString();
}
} // namespace Internal
} // namespace Ios

View File

@@ -1,53 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://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 <utils/fileutils.h>
#include <QDomDocument>
#include <QObject>
#include <QStringList>
namespace ProjectExplorer {
class Target;
class Kit;
}
namespace Ios {
namespace Internal {
class IosManager : public QObject
{
Q_OBJECT
public:
static bool supportsIos(const ProjectExplorer::Target *target);
static bool supportsIos(const ProjectExplorer::Kit *kit);
static QString resDirForTarget(ProjectExplorer::Target *target);
};
} // namespace Internal
} // namespace Ios

View File

@@ -32,7 +32,6 @@
#include "iosdeployconfiguration.h"
#include "iosdeploystepfactory.h"
#include "iosdevicefactory.h"
#include "iosmanager.h"
#include "iosdsymbuildstep.h"
#include "iosqtversionfactory.h"
#include "iosrunfactories.h"

View File

@@ -26,7 +26,6 @@
#include "iosqtversion.h"
#include "iosconstants.h"
#include "iosconfigurations.h"
#include "iosmanager.h"
#include <utils/environment.h>
#include <utils/hostosinfo.h>

View File

@@ -25,7 +25,6 @@
#include "iosrunconfiguration.h"
#include "iosconstants.h"
#include "iosmanager.h"
#include "iosdeploystep.h"
#include "simulatorcontrol.h"

View File

@@ -27,7 +27,6 @@
#include "iosconstants.h"
#include "iosrunconfiguration.h"
#include "iosmanager.h"
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
@@ -48,6 +47,7 @@ IosRunConfigurationFactory::IosRunConfigurationFactory(QObject *parent)
{
setObjectName("IosRunConfigurationFactory");
registerRunConfiguration<IosRunConfiguration>(Constants::IOS_RC_ID_PREFIX);
setSupportedTargetDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE});
setSupportedProjectType<QmakeProject>();
}
@@ -69,11 +69,6 @@ QString IosRunConfigurationFactory::displayNameForBuildTarget(const QString &bui
return QFileInfo(buildTarget).completeBaseName();
}
bool IosRunConfigurationFactory::canHandle(Target *t) const
{
return IRunConfigurationFactory::canHandle(t) && IosManager::supportsIos(t->kit());
}
QList<RunConfiguration *> IosRunConfigurationFactory::runConfigurationsForNode(Target *t, const Node *n)
{
QList<RunConfiguration *> result;

View File

@@ -46,7 +46,6 @@ public:
QList<QString> availableBuildTargets(ProjectExplorer::Target *parent, CreationMode mode) const override;
QString displayNameForBuildTarget(const QString &buildTarget) const override;
bool canHandle(ProjectExplorer::Target *t) const override;
bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,

View File

@@ -26,7 +26,6 @@
#include "iosbuildstep.h"
#include "iosconfigurations.h"
#include "iosdevice.h"
#include "iosmanager.h"
#include "iosrunconfiguration.h"
#include "iosrunner.h"
#include "iossimulator.h"