forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.3'
Change-Id: Ib0dc9fe5d7c507eb7330f61daedc945a4308292d
This commit is contained in:
@@ -34,7 +34,9 @@ HEADERS += \
|
||||
iosdeploystepfactory.h \
|
||||
iosdeploystepwidget.h \
|
||||
iosanalyzesupport.h \
|
||||
simulatorcontrol.h
|
||||
simulatorcontrol.h \
|
||||
iosbuildconfiguration.h \
|
||||
iosbuildsettingswidget.h
|
||||
|
||||
|
||||
SOURCES += \
|
||||
@@ -63,13 +65,16 @@ SOURCES += \
|
||||
iosdeploystepfactory.cpp \
|
||||
iosdeploystepwidget.cpp \
|
||||
iosanalyzesupport.cpp \
|
||||
simulatorcontrol.cpp
|
||||
simulatorcontrol.cpp \
|
||||
iosbuildconfiguration.cpp \
|
||||
iosbuildsettingswidget.cpp
|
||||
|
||||
FORMS += \
|
||||
iossettingswidget.ui \
|
||||
iosbuildstep.ui \
|
||||
iosdeploystepwidget.ui \
|
||||
iospresetbuildstep.ui
|
||||
iospresetbuildstep.ui \
|
||||
iosbuildsettingswidget.ui
|
||||
|
||||
DEFINES += IOS_LIBRARY
|
||||
|
||||
|
||||
193
src/plugins/ios/iosbuildconfiguration.cpp
Normal file
193
src/plugins/ios/iosbuildconfiguration.cpp
Normal file
@@ -0,0 +1,193 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 "iosbuildconfiguration.h"
|
||||
|
||||
#include "iosconfigurations.h"
|
||||
#include "iosconstants.h"
|
||||
#include "iosbuildsettingswidget.h"
|
||||
#include "iosmanager.h"
|
||||
|
||||
#include "projectexplorer/kitinformation.h"
|
||||
#include "projectexplorer/namedwidget.h"
|
||||
#include "projectexplorer/target.h"
|
||||
#include "qmakeprojectmanager/qmakebuildinfo.h"
|
||||
#include "utils/algorithm.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace QmakeProjectManager;
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
const char qmakeIosTeamSettings[] = "QMAKE_MAC_XCODE_SETTINGS+=qteam qteam.name=DEVELOPMENT_TEAM qteam.value=";
|
||||
const char qmakeProvisioningProfileSettings[] = "QMAKE_MAC_XCODE_SETTINGS+=qprofile qprofile.name=PROVISIONING_PROFILE_SPECIFIER qprofile.value=";
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::NamedWidget *> IosBuildConfiguration::createSubConfigWidgets()
|
||||
{
|
||||
auto subConfigWidgets = QmakeBuildConfiguration::createSubConfigWidgets();
|
||||
|
||||
Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||
// Ownership of this widget is with BuildSettingsWidget
|
||||
auto buildSettingsWidget = new IosBuildSettingsWidget(devType, m_signingIdentifier,
|
||||
m_autoManagedSigning);
|
||||
subConfigWidgets.prepend(buildSettingsWidget);
|
||||
connect(buildSettingsWidget, &IosBuildSettingsWidget::signingSettingsChanged,
|
||||
this, &IosBuildConfiguration::onSigningSettingsChanged);
|
||||
return subConfigWidgets;
|
||||
}
|
||||
|
||||
QVariantMap IosBuildConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map(QmakeBuildConfiguration::toMap());
|
||||
map.insert(signingIdentifierKey, m_signingIdentifier);
|
||||
map.insert(autoManagedSigningKey, m_autoManagedSigning);
|
||||
return map;
|
||||
}
|
||||
|
||||
bool IosBuildConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!QmakeBuildConfiguration::fromMap(map))
|
||||
return false;
|
||||
m_autoManagedSigning = map.value(autoManagedSigningKey).toBool();
|
||||
m_signingIdentifier = map.value(signingIdentifierKey).toString();
|
||||
updateQmakeCommand();
|
||||
return true;
|
||||
}
|
||||
|
||||
void IosBuildConfiguration::onSigningSettingsChanged(bool autoManagedSigning, QString identifier)
|
||||
{
|
||||
if (m_signingIdentifier.compare(identifier) != 0
|
||||
|| m_autoManagedSigning != autoManagedSigning) {
|
||||
m_autoManagedSigning = autoManagedSigning;
|
||||
m_signingIdentifier = identifier;
|
||||
updateQmakeCommand();
|
||||
}
|
||||
}
|
||||
|
||||
void IosBuildConfiguration::updateQmakeCommand()
|
||||
{
|
||||
QMakeStep *qmakeStepInstance = qmakeStep();
|
||||
const QString forceOverrideArg("-after");
|
||||
if (qmakeStepInstance) {
|
||||
QStringList extraArgs = qmakeStepInstance->extraArguments();
|
||||
// remove old extra arguments.
|
||||
Utils::erase(extraArgs, [forceOverrideArg](const QString& arg) {
|
||||
return arg.startsWith(qmakeIosTeamSettings)
|
||||
|| arg.startsWith(qmakeProvisioningProfileSettings)
|
||||
|| arg == forceOverrideArg;
|
||||
});
|
||||
|
||||
// Set force ovveride qmake switch
|
||||
if (!m_signingIdentifier.isEmpty() )
|
||||
extraArgs << forceOverrideArg;
|
||||
|
||||
Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||
if (devType == Constants::IOS_DEVICE_TYPE && !m_signingIdentifier.isEmpty()) {
|
||||
if (m_autoManagedSigning) {
|
||||
extraArgs << qmakeIosTeamSettings + m_signingIdentifier;
|
||||
} else {
|
||||
// Get the team id from provisioning profile
|
||||
ProvisioningProfilePtr profile =
|
||||
IosConfigurations::provisioningProfile(m_signingIdentifier);
|
||||
QString teamId;
|
||||
if (profile)
|
||||
teamId = profile->developmentTeam()->identifier();
|
||||
else
|
||||
qCDebug(iosLog) << "No provisioing profile found for id:"<< m_signingIdentifier;
|
||||
|
||||
if (!teamId.isEmpty()) {
|
||||
extraArgs << qmakeProvisioningProfileSettings + m_signingIdentifier;
|
||||
extraArgs << qmakeIosTeamSettings + teamId;
|
||||
} else {
|
||||
qCDebug(iosLog) << "Development team unavailable for profile:" << profile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qmakeStepInstance->setExtraArguments(extraArgs);
|
||||
}
|
||||
}
|
||||
|
||||
IosBuildConfigurationFactory::IosBuildConfigurationFactory(QObject *parent)
|
||||
: QmakeBuildConfigurationFactory(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
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 (QmakeBuildConfigurationFactory::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
|
||||
75
src/plugins/ios/iosbuildconfiguration.h
Normal file
75
src/plugins/ios/iosbuildconfiguration.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 "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:
|
||||
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);
|
||||
|
||||
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
|
||||
} // namespace Ios
|
||||
290
src/plugins/ios/iosbuildsettingswidget.cpp
Normal file
290
src/plugins/ios/iosbuildsettingswidget.cpp
Normal file
@@ -0,0 +1,290 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 "iosbuildsettingswidget.h"
|
||||
#include "ui_iosbuildsettingswidget.h"
|
||||
#include "iosconfigurations.h"
|
||||
#include "iosconstants.h"
|
||||
|
||||
#include "utils/utilsicons.h"
|
||||
#include "utils/algorithm.h"
|
||||
#include "qmakeprojectmanager/qmakeproject.h"
|
||||
#include "qmakeprojectmanager/qmakenodes.h"
|
||||
#include "utils/detailswidget.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
using namespace QmakeProjectManager;
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
namespace {
|
||||
Q_LOGGING_CATEGORY(iosSettingsLog, "qtc.ios.common")
|
||||
}
|
||||
|
||||
static const int IdentifierRole = Qt::UserRole+1;
|
||||
|
||||
IosBuildSettingsWidget::IosBuildSettingsWidget(const Core::Id &deviceType,
|
||||
const QString &signingIdentifier,
|
||||
bool isSigningAutoManaged, QWidget *parent) :
|
||||
ProjectExplorer::NamedWidget(parent),
|
||||
ui(new Ui::IosBuildSettingsWidget),
|
||||
m_detailsWidget(new Utils::DetailsWidget(this)),
|
||||
m_deviceType(deviceType)
|
||||
{
|
||||
auto rootLayout = new QVBoxLayout(this);
|
||||
rootLayout->setMargin(0);
|
||||
rootLayout->addWidget(m_detailsWidget);
|
||||
|
||||
auto container = new QWidget(m_detailsWidget);
|
||||
ui->setupUi(container);
|
||||
ui->m_autoSignCheckbox->setChecked(isSigningAutoManaged);
|
||||
connect(ui->m_qmakeDefaults, &QPushButton::clicked, this, &IosBuildSettingsWidget::onReset);
|
||||
|
||||
ui->m_infoIconLabel->hide();
|
||||
ui->m_infoIconLabel->setPixmap(Utils::Icons::INFO.pixmap());
|
||||
ui->m_infoLabel->hide();
|
||||
|
||||
ui->m_warningIconLabel->hide();
|
||||
ui->m_warningIconLabel->setPixmap(Utils::Icons::WARNING.pixmap());
|
||||
ui->m_warningLabel->hide();
|
||||
|
||||
m_detailsWidget->setState(Utils::DetailsWidget::NoSummary);
|
||||
m_detailsWidget->setWidget(container);
|
||||
|
||||
setDisplayName(tr("iOS Settings"));
|
||||
|
||||
const bool isDevice = m_deviceType == Constants::IOS_DEVICE_TYPE;
|
||||
if (isDevice) {
|
||||
connect(IosConfigurations::instance(), &IosConfigurations::provisioningDataChanged,
|
||||
this, &IosBuildSettingsWidget::populateDevelopmentTeams);
|
||||
connect(ui->m_signEntityCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &IosBuildSettingsWidget::onSigningEntityComboIndexChanged);
|
||||
connect(ui->m_autoSignCheckbox, &QCheckBox::toggled,
|
||||
this, &IosBuildSettingsWidget::configureSigningUi);
|
||||
configureSigningUi(ui->m_autoSignCheckbox->isChecked());
|
||||
setDefaultSigningIdentfier(signingIdentifier);
|
||||
}
|
||||
|
||||
ui->m_autoSignCheckbox->setEnabled(isDevice);
|
||||
ui->m_signEntityCombo->setEnabled(isDevice);
|
||||
ui->m_qmakeDefaults->setEnabled(isDevice);
|
||||
ui->m_signEntityLabel->setEnabled(isDevice);
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
IosBuildSettingsWidget::~IosBuildSettingsWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void IosBuildSettingsWidget::setDefaultSigningIdentfier(const QString &identifier) const
|
||||
{
|
||||
if (identifier.isEmpty()) {
|
||||
ui->m_signEntityCombo->setCurrentIndex(0);
|
||||
return;
|
||||
}
|
||||
|
||||
int defaultIndex = -1;
|
||||
for (int index = 0; index < ui->m_signEntityCombo->count(); ++index) {
|
||||
QString teamID = ui->m_signEntityCombo->itemData(index, IdentifierRole).toString();
|
||||
if (teamID == identifier) {
|
||||
defaultIndex = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (defaultIndex > -1) {
|
||||
ui->m_signEntityCombo->setCurrentIndex(defaultIndex);
|
||||
} else {
|
||||
// Reset to default
|
||||
ui->m_signEntityCombo->setCurrentIndex(0);
|
||||
qCDebug(iosSettingsLog) << "Can not find default"
|
||||
<< (ui->m_autoSignCheckbox->isChecked() ? "team": "provisioning profile")
|
||||
<< ". Identifier: " << identifier;
|
||||
}
|
||||
}
|
||||
|
||||
bool IosBuildSettingsWidget::isSigningAutomaticallyManaged() const
|
||||
{
|
||||
return ui->m_autoSignCheckbox->isChecked() && ui->m_signEntityCombo->currentIndex() > 0;
|
||||
}
|
||||
|
||||
void IosBuildSettingsWidget::onSigningEntityComboIndexChanged()
|
||||
{
|
||||
QString identifier = selectedIdentifier();
|
||||
(ui->m_autoSignCheckbox->isChecked() ? m_lastTeamSelection : m_lastProfileSelection) = identifier;
|
||||
|
||||
updateInfoText();
|
||||
updateWarningText();
|
||||
emit signingSettingsChanged(ui->m_autoSignCheckbox->isChecked(), identifier);
|
||||
}
|
||||
|
||||
void IosBuildSettingsWidget::onReset()
|
||||
{
|
||||
m_lastTeamSelection.clear();
|
||||
m_lastProfileSelection.clear();
|
||||
ui->m_autoSignCheckbox->setChecked(true);
|
||||
setDefaultSigningIdentfier("");
|
||||
}
|
||||
|
||||
void IosBuildSettingsWidget::configureSigningUi(bool autoManageSigning)
|
||||
{
|
||||
ui->m_signEntityLabel->setText(autoManageSigning ? tr("Development team:")
|
||||
: tr("Provisioning profile:"));
|
||||
if (autoManageSigning)
|
||||
populateDevelopmentTeams();
|
||||
else
|
||||
populateProvisioningProfiles();
|
||||
|
||||
updateInfoText();
|
||||
emit signingSettingsChanged(autoManageSigning, selectedIdentifier());
|
||||
}
|
||||
|
||||
void IosBuildSettingsWidget::populateDevelopmentTeams()
|
||||
{
|
||||
// Populate Team id's
|
||||
ui->m_signEntityCombo->blockSignals(true);
|
||||
ui->m_signEntityCombo->clear();
|
||||
ui->m_signEntityCombo->addItem(tr("Default"));
|
||||
foreach (auto team, IosConfigurations::developmentTeams()) {
|
||||
ui->m_signEntityCombo->addItem(team->displayName());
|
||||
const int index = ui->m_signEntityCombo->count() - 1;
|
||||
ui->m_signEntityCombo->setItemData(index, team->identifier(), IdentifierRole);
|
||||
ui->m_signEntityCombo->setItemData(index, team->details(), Qt::ToolTipRole);
|
||||
}
|
||||
ui->m_signEntityCombo->blockSignals(false);
|
||||
// Maintain previous selection.
|
||||
setDefaultSigningIdentfier(m_lastTeamSelection);
|
||||
updateWarningText();
|
||||
}
|
||||
|
||||
void IosBuildSettingsWidget::populateProvisioningProfiles()
|
||||
{
|
||||
// Populate Team id's
|
||||
ui->m_signEntityCombo->blockSignals(true);
|
||||
ui->m_signEntityCombo->clear();
|
||||
ProvisioningProfiles profiles = IosConfigurations::provisioningProfiles();
|
||||
if (profiles.count() > 0) {
|
||||
foreach (auto profile, profiles) {
|
||||
ui->m_signEntityCombo->addItem(profile->displayName());
|
||||
const int index = ui->m_signEntityCombo->count() - 1;
|
||||
ui->m_signEntityCombo->setItemData(index, profile->identifier(), IdentifierRole);
|
||||
ui->m_signEntityCombo->setItemData(index, profile->details(), Qt::ToolTipRole);
|
||||
}
|
||||
} else {
|
||||
ui->m_signEntityCombo->addItem(tr("None"));
|
||||
}
|
||||
ui->m_signEntityCombo->blockSignals(false);
|
||||
// Maintain previous selection.
|
||||
setDefaultSigningIdentfier(m_lastProfileSelection);
|
||||
updateWarningText();
|
||||
}
|
||||
|
||||
QString IosBuildSettingsWidget::selectedIdentifier() const
|
||||
{
|
||||
return ui->m_signEntityCombo->currentData(IdentifierRole).toString();
|
||||
}
|
||||
|
||||
void IosBuildSettingsWidget::updateInfoText()
|
||||
{
|
||||
if (m_deviceType != Constants::IOS_DEVICE_TYPE)
|
||||
return;
|
||||
|
||||
QString infoMessage;
|
||||
auto addMessage = [&infoMessage](const QString &msg) {
|
||||
if (!infoMessage.isEmpty())
|
||||
infoMessage += "\n";
|
||||
infoMessage += msg;
|
||||
};
|
||||
|
||||
QString identifier = selectedIdentifier();
|
||||
bool configuringTeams = ui->m_autoSignCheckbox->isChecked();
|
||||
|
||||
if (identifier.isEmpty()) {
|
||||
// No signing entity selection.
|
||||
if (configuringTeams)
|
||||
addMessage(tr("Development team is not selected."));
|
||||
else
|
||||
addMessage(tr("Provisioning profile is not selected."));
|
||||
|
||||
addMessage(tr("Using default development team and provisioning profile."));
|
||||
} else {
|
||||
if (!configuringTeams) {
|
||||
ProvisioningProfilePtr profile = IosConfigurations::provisioningProfile(identifier);
|
||||
QTC_ASSERT(profile, return);
|
||||
auto team = profile->developmentTeam();
|
||||
if (team) {
|
||||
// Display corresponding team information.
|
||||
addMessage(tr("Development team: %1 (%2)").arg(team->displayName())
|
||||
.arg(team->identifier()));
|
||||
addMessage(tr("Settings defined here override the QMake environment."));
|
||||
} else {
|
||||
qCDebug(iosSettingsLog) << "Development team not found for profile" << profile;
|
||||
}
|
||||
} else {
|
||||
addMessage(tr("Settings defined here override the QMake environment."));
|
||||
}
|
||||
}
|
||||
|
||||
ui->m_infoIconLabel->setVisible(!infoMessage.isEmpty());
|
||||
ui->m_infoLabel->setVisible(!infoMessage.isEmpty());
|
||||
ui->m_infoLabel->setText(infoMessage);
|
||||
}
|
||||
|
||||
void IosBuildSettingsWidget::updateWarningText()
|
||||
{
|
||||
if (m_deviceType != Constants::IOS_DEVICE_TYPE)
|
||||
return;
|
||||
|
||||
QString warningText;
|
||||
bool configuringTeams = ui->m_autoSignCheckbox->isChecked();
|
||||
if (ui->m_signEntityCombo->count() < 2) {
|
||||
warningText = tr("%1 not configured. Use Xcode and Apple developer account to configure the "
|
||||
"provisioning profiles and teams.")
|
||||
.arg(configuringTeams ? tr("Development teams") : tr("Provisioning profiles"));
|
||||
} else {
|
||||
QString identifier = selectedIdentifier();
|
||||
if (configuringTeams) {
|
||||
auto team = IosConfigurations::developmentTeam(identifier);
|
||||
if (team && !team->hasProvisioningProfile())
|
||||
warningText = tr("No provisioning profile found for the selected team.");
|
||||
} else {
|
||||
auto profile = IosConfigurations::provisioningProfile(identifier);
|
||||
if (profile && QDateTime::currentDateTimeUtc() > profile->expirationDate()) {
|
||||
warningText = tr("Provisioning profile expired. Expiration date: %1")
|
||||
.arg(profile->expirationDate().toLocalTime().toString(Qt::SystemLocaleLongDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui->m_warningLabel->setVisible(!warningText.isEmpty());
|
||||
ui->m_warningIconLabel->setVisible(!warningText.isEmpty());
|
||||
ui->m_warningLabel->setText(warningText);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Ios
|
||||
80
src/plugins/ios/iosbuildsettingswidget.h
Normal file
80
src/plugins/ios/iosbuildsettingswidget.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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 "coreplugin/id.h"
|
||||
#include "projectexplorer/namedwidget.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Utils {
|
||||
class DetailsWidget;
|
||||
}
|
||||
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
namespace Ui {
|
||||
class IosBuildSettingsWidget;
|
||||
}
|
||||
|
||||
class IosBuildSettingsWidget : public ProjectExplorer::NamedWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IosBuildSettingsWidget(const Core::Id &deviceType, const QString &signingIdentifier,
|
||||
bool isSigningAutoManaged, QWidget *parent = 0);
|
||||
~IosBuildSettingsWidget();
|
||||
|
||||
public:
|
||||
bool isSigningAutomaticallyManaged() const;
|
||||
|
||||
private slots:
|
||||
void onSigningEntityComboIndexChanged();
|
||||
void onReset();
|
||||
|
||||
signals:
|
||||
void signingSettingsChanged(bool isAutoManaged, QString identifier);
|
||||
|
||||
private:
|
||||
void setDefaultSigningIdentfier(const QString &identifier) const;
|
||||
void configureSigningUi(bool autoManageSigning);
|
||||
void populateDevelopmentTeams();
|
||||
void populateProvisioningProfiles();
|
||||
QString selectedIdentifier() const;
|
||||
void updateInfoText();
|
||||
void updateWarningText();
|
||||
|
||||
private:
|
||||
Ui::IosBuildSettingsWidget *ui;
|
||||
Utils::DetailsWidget *m_detailsWidget;
|
||||
QString m_lastProfileSelection;
|
||||
QString m_lastTeamSelection;
|
||||
const Core::Id m_deviceType;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Ios
|
||||
137
src/plugins/ios/iosbuildsettingswidget.ui
Normal file
137
src/plugins/ios/iosbuildsettingswidget.ui
Normal file
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Ios::Internal::IosBuildSettingsWidget</class>
|
||||
<widget class="QWidget" name="Ios::Internal::IosBuildSettingsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>467</width>
|
||||
<height>141</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="m_qmakeDefaults">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_signEntityCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="m_autoSignCheckbox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Automatically manage signing</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_signEntityLabel">
|
||||
<property name="text">
|
||||
<string>Development team:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="m_infoIconLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_infoLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="m_warningIconLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_warningLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
@@ -49,12 +50,15 @@
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
#include <qtsupport/qtversionfactory.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QDomDocument>
|
||||
#include <QFileInfo>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QLoggingCategory>
|
||||
#include <QProcess>
|
||||
#include <QSettings>
|
||||
#include <QStringList>
|
||||
#include <QTimer>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
@@ -74,6 +78,21 @@ namespace Internal {
|
||||
const QLatin1String SettingsGroup("IosConfigurations");
|
||||
const QLatin1String ignoreAllDevicesKey("IgnoreAllDevices");
|
||||
|
||||
const char provisioningTeamsTag[] = "IDEProvisioningTeams";
|
||||
const char freeTeamTag[] = "isFreeProvisioningTeam";
|
||||
const char emailTag[] = "eMail";
|
||||
const char teamNameTag[] = "teamName";
|
||||
const char teamIdTag[] = "teamID";
|
||||
|
||||
const char udidTag[] = "UUID";
|
||||
const char profileNameTag[] = "Name";
|
||||
const char appIdTag[] = "AppIDName";
|
||||
const char expirationDateTag[] = "ExpirationDate";
|
||||
const char profileTeamIdTag[] = "TeamIdentifier";
|
||||
|
||||
static const QString xcodePlistPath = QDir::homePath() + "/Library/Preferences/com.apple.dt.Xcode.plist";
|
||||
static const QString provisioningProfileDirPath = QDir::homePath() + "/Library/MobileDevice/Provisioning Profiles";
|
||||
|
||||
static Core::Id deviceId(const Platform &platform)
|
||||
{
|
||||
if (platform.name.startsWith(QLatin1String("iphoneos-")))
|
||||
@@ -246,6 +265,20 @@ static QVersionNumber findXcodeVersion()
|
||||
return QVersionNumber();
|
||||
}
|
||||
|
||||
static QByteArray decodeProvisioningProfile(const QString &path)
|
||||
{
|
||||
QTC_ASSERT(!path.isEmpty(), return QByteArray());
|
||||
|
||||
Utils::SynchronousProcess p;
|
||||
p.setTimeoutS(3);
|
||||
// path is assumed to be valid file path to .mobileprovision
|
||||
const QStringList args = {"smime", "-inform", "der", "-verify", "-in", path};
|
||||
Utils::SynchronousProcessResponse res = p.runBlocking("openssl", args);
|
||||
if (res.result != Utils::SynchronousProcessResponse::Finished)
|
||||
qCDebug(iosCommonLog) << "Reading signed provisioning file failed" << path;
|
||||
return res.stdOut().toLatin1();
|
||||
}
|
||||
|
||||
void IosConfigurations::updateAutomaticKitList()
|
||||
{
|
||||
const QList<Platform> platforms = handledPlatforms();
|
||||
@@ -320,9 +353,9 @@ void IosConfigurations::updateAutomaticKitList()
|
||||
KitManager::deregisterKit(kit);
|
||||
}
|
||||
|
||||
static IosConfigurations *m_instance = 0;
|
||||
static IosConfigurations *m_instance = nullptr;
|
||||
|
||||
QObject *IosConfigurations::instance()
|
||||
IosConfigurations *IosConfigurations::instance()
|
||||
{
|
||||
return m_instance;
|
||||
}
|
||||
@@ -409,6 +442,137 @@ void IosConfigurations::setDeveloperPath(const FileName &devPath)
|
||||
}
|
||||
}
|
||||
|
||||
void IosConfigurations::initializeProvisioningData()
|
||||
{
|
||||
// Initialize provisioning data only on demand. i.e. when first call to a provisioing data API
|
||||
// is made.
|
||||
static bool initialized = false;
|
||||
if (initialized)
|
||||
return;
|
||||
initialized = true;
|
||||
|
||||
m_instance->loadProvisioningData(false);
|
||||
|
||||
// Watch the provisioing profiles folder and xcode plist for changes and
|
||||
// update the content accordingly.
|
||||
m_provisioningDataWatcher = new QFileSystemWatcher(this);
|
||||
m_provisioningDataWatcher->addPath(xcodePlistPath);
|
||||
m_provisioningDataWatcher->addPath(provisioningProfileDirPath);
|
||||
connect(m_provisioningDataWatcher, &QFileSystemWatcher::directoryChanged,
|
||||
std::bind(&IosConfigurations::loadProvisioningData, this, true));
|
||||
connect(m_provisioningDataWatcher, &QFileSystemWatcher::fileChanged,
|
||||
std::bind(&IosConfigurations::loadProvisioningData, this, true));
|
||||
}
|
||||
|
||||
void IosConfigurations::loadProvisioningData(bool notify)
|
||||
{
|
||||
m_developerTeams.clear();
|
||||
m_provisioningProfiles.clear();
|
||||
|
||||
// Populate Team id's
|
||||
const QSettings xcodeSettings(xcodePlistPath, QSettings::NativeFormat);
|
||||
const QVariantMap teamMap = xcodeSettings.value(provisioningTeamsTag).toMap();
|
||||
QList<QVariantMap> teams;
|
||||
QMapIterator<QString, QVariant> accountiterator(teamMap);
|
||||
while (accountiterator.hasNext()) {
|
||||
accountiterator.next();
|
||||
QVariantMap teamInfo = accountiterator.value().toMap();
|
||||
int provisioningTeamIsFree = teamInfo.value(freeTeamTag).toBool() ? 1 : 0;
|
||||
teamInfo[freeTeamTag] = provisioningTeamIsFree;
|
||||
teamInfo[emailTag] = accountiterator.key();
|
||||
teams.append(teamInfo);
|
||||
}
|
||||
|
||||
// Sort team id's to move the free provisioning teams at last of the list.
|
||||
Utils::sort(teams, [](const QVariantMap &teamInfo1, const QVariantMap &teamInfo2) {
|
||||
return teamInfo1.value(freeTeamTag).toInt() < teamInfo2.value(freeTeamTag).toInt();
|
||||
});
|
||||
|
||||
foreach (auto teamInfo, teams) {
|
||||
auto team = std::make_shared<DevelopmentTeam>();
|
||||
team->m_name = teamInfo.value(teamNameTag).toString();
|
||||
team->m_email = teamInfo.value(emailTag).toString();
|
||||
team->m_identifier = teamInfo.value(teamIdTag).toString();
|
||||
team->m_freeTeam = teamInfo.value(freeTeamTag).toInt() == 1;
|
||||
m_developerTeams.append(team);
|
||||
}
|
||||
|
||||
const QDir provisioningProflesDir(provisioningProfileDirPath);
|
||||
foreach (QFileInfo fileInfo, provisioningProflesDir.entryInfoList({"*.mobileprovision"}, QDir::NoDotAndDotDot | QDir::Files)) {
|
||||
QDomDocument provisioningDoc;
|
||||
auto profile = std::make_shared<ProvisioningProfile>();
|
||||
QString teamID;
|
||||
if (provisioningDoc.setContent(decodeProvisioningProfile(fileInfo.absoluteFilePath()))) {
|
||||
QDomNodeList nodes = provisioningDoc.elementsByTagName("key");
|
||||
for (int i = 0;i<nodes.count(); ++i) {
|
||||
QDomElement e = nodes.at(i).toElement();
|
||||
|
||||
if (e.text().compare(udidTag) == 0)
|
||||
profile->m_identifier = e.nextSiblingElement().text();
|
||||
|
||||
if (e.text().compare(profileNameTag) == 0)
|
||||
profile->m_name = e.nextSiblingElement().text();
|
||||
|
||||
if (e.text().compare(appIdTag) == 0)
|
||||
profile->m_appID = e.nextSiblingElement().text();
|
||||
|
||||
if (e.text().compare(expirationDateTag) == 0)
|
||||
profile->m_expirationDate = QDateTime::fromString(e.nextSiblingElement().text(),
|
||||
Qt::ISODate).toUTC();
|
||||
|
||||
if (e.text().compare(profileTeamIdTag) == 0) {
|
||||
teamID = e.nextSibling().firstChildElement().text();
|
||||
auto team = developmentTeam(teamID);
|
||||
if (team) {
|
||||
profile->m_team = team;
|
||||
team->m_profiles.append(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qCDebug(iosCommonLog) << "Error reading provisoing profile" << fileInfo.absoluteFilePath();
|
||||
}
|
||||
|
||||
if (profile->m_team)
|
||||
m_provisioningProfiles.append(profile);
|
||||
else
|
||||
qCDebug(iosCommonLog) << "Skipping profile. No corresponding team found" << profile;
|
||||
}
|
||||
|
||||
if (notify)
|
||||
emit provisioningDataChanged();
|
||||
}
|
||||
|
||||
const DevelopmentTeams &IosConfigurations::developmentTeams()
|
||||
{
|
||||
QTC_CHECK(m_instance);
|
||||
m_instance->initializeProvisioningData();
|
||||
return m_instance->m_developerTeams;
|
||||
}
|
||||
|
||||
DevelopmentTeamPtr IosConfigurations::developmentTeam(const QString &teamID)
|
||||
{
|
||||
QTC_CHECK(m_instance);
|
||||
m_instance->initializeProvisioningData();
|
||||
return findOrDefault(m_instance->m_developerTeams,
|
||||
Utils::equal(&DevelopmentTeam::identifier, teamID));
|
||||
}
|
||||
|
||||
const ProvisioningProfiles &IosConfigurations::provisioningProfiles()
|
||||
{
|
||||
QTC_CHECK(m_instance);
|
||||
m_instance->initializeProvisioningData();
|
||||
return m_instance->m_provisioningProfiles;
|
||||
}
|
||||
|
||||
ProvisioningProfilePtr IosConfigurations::provisioningProfile(const QString &profileID)
|
||||
{
|
||||
QTC_CHECK(m_instance);
|
||||
m_instance->initializeProvisioningData();
|
||||
return Utils::findOrDefault(m_instance->m_provisioningProfiles,
|
||||
Utils::equal(&ProvisioningProfile::identifier, profileID));
|
||||
}
|
||||
|
||||
static ClangToolChain *createToolChain(const Platform &platform, Core::Id l)
|
||||
{
|
||||
if (!l.isValid())
|
||||
@@ -455,5 +619,52 @@ QList<ToolChain *> IosToolChainFactory::autoDetect(const QList<ToolChain *> &exi
|
||||
return Utils::transform(toolChains, [](ClangToolChain *tc) -> ToolChain * { return tc; });
|
||||
}
|
||||
|
||||
QString DevelopmentTeam::identifier() const
|
||||
{
|
||||
return m_identifier;
|
||||
}
|
||||
|
||||
QString DevelopmentTeam::displayName() const
|
||||
{
|
||||
return QString("%1 - %2").arg(m_email).arg(m_name);
|
||||
}
|
||||
|
||||
QString DevelopmentTeam::details() const
|
||||
{
|
||||
return tr("%1 - Free Provisioning Team : %2")
|
||||
.arg(m_identifier).arg(m_freeTeam ? tr("Yes") : tr("No"));
|
||||
}
|
||||
|
||||
QDebug &operator<<(QDebug &stream, DevelopmentTeamPtr team)
|
||||
{
|
||||
QTC_ASSERT(team, return stream);
|
||||
stream << team->displayName() << team->identifier() << team->isFreeProfile();
|
||||
foreach (auto profile, team->m_profiles)
|
||||
stream << "Profile:" << profile;
|
||||
return stream;
|
||||
}
|
||||
|
||||
QString ProvisioningProfile::identifier() const
|
||||
{
|
||||
return m_identifier;
|
||||
}
|
||||
|
||||
QString ProvisioningProfile::displayName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
QString ProvisioningProfile::details() const
|
||||
{
|
||||
return tr("Team: %1\nApp ID: %2\nExpiration date: %3").arg(m_team->identifier()).arg(m_appID)
|
||||
.arg(m_expirationDate.toLocalTime().toString(Qt::SystemLocaleShortDate));
|
||||
}
|
||||
|
||||
QDebug &operator<<(QDebug &stream, std::shared_ptr<ProvisioningProfile> profile)
|
||||
{
|
||||
QTC_ASSERT(profile, return stream);
|
||||
return stream << profile->displayName() << profile->identifier() << profile->details();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Ios
|
||||
|
||||
@@ -29,18 +29,72 @@
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QVersionNumber>
|
||||
|
||||
#include <memory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
class QFileSystemWatcher;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
class DevelopmentTeam;
|
||||
|
||||
class ProvisioningProfile
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(ProvisioningProfile)
|
||||
public:
|
||||
ProvisioningProfile() {}
|
||||
std::shared_ptr<DevelopmentTeam> developmentTeam() { return m_team; }
|
||||
QString identifier() const;
|
||||
QString displayName() const;
|
||||
QString details() const;
|
||||
const QDateTime &expirationDate() const { return m_expirationDate; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<DevelopmentTeam> m_team;
|
||||
QString m_identifier;
|
||||
QString m_name;
|
||||
QString m_appID;
|
||||
QDateTime m_expirationDate;
|
||||
friend class IosConfigurations;
|
||||
friend QDebug &operator<<(QDebug &stream, std::shared_ptr<ProvisioningProfile> profile);
|
||||
};
|
||||
|
||||
using ProvisioningProfilePtr = std::shared_ptr<ProvisioningProfile>;
|
||||
using ProvisioningProfiles = QList<ProvisioningProfilePtr>;
|
||||
|
||||
class DevelopmentTeam
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(DevelopmentTeam)
|
||||
public:
|
||||
DevelopmentTeam() {}
|
||||
QString identifier() const;
|
||||
QString displayName() const;
|
||||
QString details() const;
|
||||
bool isFreeProfile() const { return m_freeTeam; }
|
||||
bool hasProvisioningProfile() const { return !m_profiles.isEmpty(); }
|
||||
|
||||
private:
|
||||
QString m_identifier;
|
||||
QString m_name;
|
||||
QString m_email;
|
||||
bool m_freeTeam = false;
|
||||
ProvisioningProfiles m_profiles;
|
||||
friend class IosConfigurations;
|
||||
friend QDebug &operator<<(QDebug &stream, std::shared_ptr<DevelopmentTeam> team);
|
||||
};
|
||||
|
||||
using DevelopmentTeamPtr = std::shared_ptr<DevelopmentTeam>;
|
||||
using DevelopmentTeams = QList<DevelopmentTeamPtr>;
|
||||
|
||||
class IosToolChainFactory : public ProjectExplorer::ToolChainFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -50,13 +104,12 @@ public:
|
||||
QList<ProjectExplorer::ToolChain *> autoDetect(const QList<ProjectExplorer::ToolChain *> &existingToolChains) override;
|
||||
};
|
||||
|
||||
|
||||
class IosConfigurations : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QObject *instance();
|
||||
static IosConfigurations *instance();
|
||||
static void initialize();
|
||||
static bool ignoreAllDevices();
|
||||
static void setIgnoreAllDevices(bool ignoreDevices);
|
||||
@@ -64,6 +117,13 @@ public:
|
||||
static QVersionNumber xcodeVersion();
|
||||
static Utils::FileName lldbPath();
|
||||
static void updateAutomaticKitList();
|
||||
static const DevelopmentTeams &developmentTeams();
|
||||
static DevelopmentTeamPtr developmentTeam(const QString &teamID);
|
||||
static const ProvisioningProfiles &provisioningProfiles();
|
||||
static ProvisioningProfilePtr provisioningProfile(const QString &profileID);
|
||||
|
||||
signals:
|
||||
void provisioningDataChanged();
|
||||
|
||||
private:
|
||||
IosConfigurations(QObject *parent);
|
||||
@@ -71,11 +131,17 @@ private:
|
||||
void save();
|
||||
void updateSimulators();
|
||||
static void setDeveloperPath(const Utils::FileName &devPath);
|
||||
void initializeProvisioningData();
|
||||
void loadProvisioningData(bool notify = true);
|
||||
|
||||
Utils::FileName m_developerPath;
|
||||
QVersionNumber m_xcodeVersion;
|
||||
bool m_ignoreAllDevices;
|
||||
QFileSystemWatcher *m_provisioningDataWatcher;
|
||||
ProvisioningProfiles m_provisioningProfiles;
|
||||
DevelopmentTeams m_developerTeams;
|
||||
};
|
||||
|
||||
QDebug &operator<<(QDebug &stream, std::shared_ptr<ProvisioningProfile> profile);
|
||||
QDebug &operator<<(QDebug &stream, std::shared_ptr<DevelopmentTeam> team);
|
||||
} // namespace Internal
|
||||
} // namespace Ios
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "iosplugin.h"
|
||||
|
||||
#include "iosbuildconfiguration.h"
|
||||
#include "iosbuildstep.h"
|
||||
#include "iosconfigurations.h"
|
||||
#include "iosconstants.h"
|
||||
@@ -64,6 +65,7 @@ bool IosPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
|
||||
Internal::IosConfigurations::initialize();
|
||||
|
||||
addAutoReleasedObject(new Internal::IosBuildConfigurationFactory);
|
||||
addAutoReleasedObject(new Internal::IosToolChainFactory);
|
||||
addAutoReleasedObject(new Internal::IosRunControlFactory);
|
||||
addAutoReleasedObject(new Internal::IosRunConfigurationFactory);
|
||||
|
||||
Reference in New Issue
Block a user