forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/master' into 4.12
Change-Id: I20de58817658e2c715ce550761976ae67b3bef4d
This commit is contained in:
@@ -234,8 +234,7 @@ bool AndroidBuildApkStep::init()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString buildTargetSdk = AndroidManager::buildTargetSDK(target());
|
if (m_buildTargetSdk.isEmpty()) {
|
||||||
if (buildTargetSdk.isEmpty()) {
|
|
||||||
emit addOutput(tr("Android build SDK not defined. Check Android settings."),
|
emit addOutput(tr("Android build SDK not defined. Check Android settings."),
|
||||||
OutputFormat::Stderr);
|
OutputFormat::Stderr);
|
||||||
return false;
|
return false;
|
||||||
@@ -243,7 +242,7 @@ bool AndroidBuildApkStep::init()
|
|||||||
|
|
||||||
QStringList arguments = {"--input", m_inputFile,
|
QStringList arguments = {"--input", m_inputFile,
|
||||||
"--output", outputDir,
|
"--output", outputDir,
|
||||||
"--android-platform", AndroidManager::buildTargetSDK(target()),
|
"--android-platform", m_buildTargetSdk,
|
||||||
"--jdk", AndroidConfigurations::currentConfig().openJDKLocation().toString()};
|
"--jdk", AndroidConfigurations::currentConfig().openJDKLocation().toString()};
|
||||||
|
|
||||||
if (m_verbose)
|
if (m_verbose)
|
||||||
|
@@ -98,7 +98,7 @@ QWidget *AndroidBuildApkWidget::createApplicationGroup()
|
|||||||
|
|
||||||
auto targetSDKComboBox = new QComboBox(group);
|
auto targetSDKComboBox = new QComboBox(group);
|
||||||
targetSDKComboBox->addItems(targets);
|
targetSDKComboBox->addItems(targets);
|
||||||
targetSDKComboBox->setCurrentIndex(targets.indexOf(AndroidManager::buildTargetSDK(step()->target())));
|
targetSDKComboBox->setCurrentIndex(targets.indexOf(m_step->buildTargetSdk()));
|
||||||
|
|
||||||
const auto cbActivated = QOverload<int>::of(&QComboBox::activated);
|
const auto cbActivated = QOverload<int>::of(&QComboBox::activated);
|
||||||
connect(targetSDKComboBox, cbActivated, this, [this, targetSDKComboBox](int idx) {
|
connect(targetSDKComboBox, cbActivated, this, [this, targetSDKComboBox](int idx) {
|
||||||
@@ -256,7 +256,7 @@ QWidget *AndroidBuildApkWidget::createCreateTemplatesGroup()
|
|||||||
|
|
||||||
auto createAndroidTemplatesButton = new QPushButton(tr("Create Templates"));
|
auto createAndroidTemplatesButton = new QPushButton(tr("Create Templates"));
|
||||||
connect(createAndroidTemplatesButton, &QAbstractButton::clicked, this, [this] {
|
connect(createAndroidTemplatesButton, &QAbstractButton::clicked, this, [this] {
|
||||||
CreateAndroidManifestWizard wizard(m_step->target());
|
CreateAndroidManifestWizard wizard(m_step->buildConfiguration()->buildSystem());
|
||||||
wizard.exec();
|
wizard.exec();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
|
#include <projectexplorer/buildsystem.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectnodes.h>
|
#include <projectexplorer/projectnodes.h>
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
|
|
||||||
#include <utils/infolabel.h>
|
#include <utils/infolabel.h>
|
||||||
|
#include <utils/pathchooser.h>
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
@@ -53,24 +55,49 @@ using namespace ProjectExplorer;
|
|||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
//
|
//
|
||||||
// NoApplicationProFilePage
|
// NoApplicationProFilePage
|
||||||
//
|
//
|
||||||
NoApplicationProFilePage::NoApplicationProFilePage(CreateAndroidManifestWizard *wizard)
|
|
||||||
: m_wizard(wizard)
|
class NoApplicationProFilePage : public QWizardPage
|
||||||
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(Android::NoApplicationProFilePage)
|
||||||
|
|
||||||
|
public:
|
||||||
|
NoApplicationProFilePage(CreateAndroidManifestWizard *wizard);
|
||||||
|
};
|
||||||
|
|
||||||
|
NoApplicationProFilePage::NoApplicationProFilePage(CreateAndroidManifestWizard *)
|
||||||
{
|
{
|
||||||
auto layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
QLabel *label = new QLabel(this);
|
auto label = new QLabel(this);
|
||||||
label->setWordWrap(true);
|
label->setWordWrap(true);
|
||||||
label->setText(tr("No application .pro file found in this project."));
|
label->setText(tr("No application .pro file found in this project."));
|
||||||
layout->addWidget(label);
|
layout->addWidget(label);
|
||||||
setTitle(tr("No Application .pro File"));
|
setTitle(tr("No Application .pro File"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ChooseProFilePage
|
// ChooseProFilePage
|
||||||
//
|
//
|
||||||
|
|
||||||
|
class ChooseProFilePage : public QWizardPage
|
||||||
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(Android::ChooseProfilePage)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ChooseProFilePage(CreateAndroidManifestWizard *wizard);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void nodeSelected(int index);
|
||||||
|
|
||||||
|
CreateAndroidManifestWizard *m_wizard;
|
||||||
|
QComboBox *m_comboBox;
|
||||||
|
};
|
||||||
|
|
||||||
ChooseProFilePage::ChooseProFilePage(CreateAndroidManifestWizard *wizard)
|
ChooseProFilePage::ChooseProFilePage(CreateAndroidManifestWizard *wizard)
|
||||||
: m_wizard(wizard)
|
: m_wizard(wizard)
|
||||||
{
|
{
|
||||||
@@ -80,13 +107,13 @@ ChooseProFilePage::ChooseProFilePage(CreateAndroidManifestWizard *wizard)
|
|||||||
label->setText(tr("Select the .pro file for which you want to create the Android template files."));
|
label->setText(tr("Select the .pro file for which you want to create the Android template files."));
|
||||||
fl->addRow(label);
|
fl->addRow(label);
|
||||||
|
|
||||||
Target *target = wizard->target();
|
BuildSystem *buildSystem = wizard->buildSystem();
|
||||||
QString currentBuildTarget;
|
QString currentBuildTarget;
|
||||||
if (RunConfiguration *rc = target->activeRunConfiguration())
|
if (RunConfiguration *rc = buildSystem->target()->activeRunConfiguration())
|
||||||
currentBuildTarget = rc->buildKey();
|
currentBuildTarget = rc->buildKey();
|
||||||
|
|
||||||
m_comboBox = new QComboBox(this);
|
m_comboBox = new QComboBox(this);
|
||||||
for (const BuildTargetInfo &bti : wizard->target()->applicationTargets()) {
|
for (const BuildTargetInfo &bti : buildSystem->applicationTargets()) {
|
||||||
const QString displayName = bti.buildKey;
|
const QString displayName = bti.buildKey;
|
||||||
m_comboBox->addItem(displayName, QVariant(bti.buildKey)); // TODO something more?
|
m_comboBox->addItem(displayName, QVariant(bti.buildKey)); // TODO something more?
|
||||||
if (bti.buildKey == currentBuildTarget)
|
if (bti.buildKey == currentBuildTarget)
|
||||||
@@ -111,8 +138,29 @@ void ChooseProFilePage::nodeSelected(int index)
|
|||||||
//
|
//
|
||||||
// ChooseDirectoryPage
|
// ChooseDirectoryPage
|
||||||
//
|
//
|
||||||
|
|
||||||
|
class ChooseDirectoryPage : public QWizardPage
|
||||||
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(Android::ChooseDirectoryPage)
|
||||||
|
|
||||||
|
public:
|
||||||
|
ChooseDirectoryPage(CreateAndroidManifestWizard *wizard);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initializePage();
|
||||||
|
bool isComplete() const;
|
||||||
|
void checkPackageSourceDir();
|
||||||
|
|
||||||
|
CreateAndroidManifestWizard *m_wizard;
|
||||||
|
PathChooser *m_androidPackageSourceDir = nullptr;
|
||||||
|
InfoLabel *m_sourceDirectoryWarning = nullptr;
|
||||||
|
QLabel *m_label;
|
||||||
|
QFormLayout *m_layout;
|
||||||
|
bool m_complete = true;
|
||||||
|
};
|
||||||
|
|
||||||
ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard)
|
ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard)
|
||||||
: m_wizard(wizard), m_androidPackageSourceDir(nullptr), m_complete(true)
|
: m_wizard(wizard)
|
||||||
{
|
{
|
||||||
m_layout = new QFormLayout(this);
|
m_layout = new QFormLayout(this);
|
||||||
m_label = new QLabel(this);
|
m_label = new QLabel(this);
|
||||||
@@ -124,8 +172,8 @@ ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard)
|
|||||||
m_layout->addRow(tr("Android package source directory:"), m_androidPackageSourceDir);
|
m_layout->addRow(tr("Android package source directory:"), m_androidPackageSourceDir);
|
||||||
|
|
||||||
m_sourceDirectoryWarning =
|
m_sourceDirectoryWarning =
|
||||||
new Utils::InfoLabel(tr("The Android package source directory cannot be the same as "
|
new InfoLabel(tr("The Android package source directory cannot be the same as "
|
||||||
"the project directory."), Utils::InfoLabel::Error, this);
|
"the project directory."), InfoLabel::Error, this);
|
||||||
m_sourceDirectoryWarning->setVisible(false);
|
m_sourceDirectoryWarning->setVisible(false);
|
||||||
m_sourceDirectoryWarning->setElideMode(Qt::ElideNone);
|
m_sourceDirectoryWarning->setElideMode(Qt::ElideNone);
|
||||||
m_sourceDirectoryWarning->setWordWrap(true);
|
m_sourceDirectoryWarning->setWordWrap(true);
|
||||||
@@ -147,7 +195,7 @@ ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard)
|
|||||||
void ChooseDirectoryPage::checkPackageSourceDir()
|
void ChooseDirectoryPage::checkPackageSourceDir()
|
||||||
{
|
{
|
||||||
const QString buildKey = m_wizard->buildKey();
|
const QString buildKey = m_wizard->buildKey();
|
||||||
const BuildTargetInfo bti = m_wizard->target()->buildTarget(buildKey);
|
const BuildTargetInfo bti = m_wizard->buildSystem()->buildTarget(buildKey);
|
||||||
const QString projectDir = bti.projectFilePath.toFileInfo().absolutePath();
|
const QString projectDir = bti.projectFilePath.toFileInfo().absolutePath();
|
||||||
|
|
||||||
const QString newDir = m_androidPackageSourceDir->path();
|
const QString newDir = m_androidPackageSourceDir->path();
|
||||||
@@ -168,7 +216,7 @@ bool ChooseDirectoryPage::isComplete() const
|
|||||||
|
|
||||||
void ChooseDirectoryPage::initializePage()
|
void ChooseDirectoryPage::initializePage()
|
||||||
{
|
{
|
||||||
const Target *target = m_wizard->target();
|
const Target *target = m_wizard->buildSystem()->target();
|
||||||
const QString buildKey = m_wizard->buildKey();
|
const QString buildKey = m_wizard->buildKey();
|
||||||
const BuildTargetInfo bti = target->buildTarget(buildKey);
|
const BuildTargetInfo bti = target->buildTarget(buildKey);
|
||||||
const QString projectDir = bti.projectFilePath.toFileInfo().absolutePath();
|
const QString projectDir = bti.projectFilePath.toFileInfo().absolutePath();
|
||||||
@@ -198,13 +246,13 @@ void ChooseDirectoryPage::initializePage()
|
|||||||
//
|
//
|
||||||
// CreateAndroidManifestWizard
|
// CreateAndroidManifestWizard
|
||||||
//
|
//
|
||||||
CreateAndroidManifestWizard::CreateAndroidManifestWizard(ProjectExplorer::Target *target)
|
CreateAndroidManifestWizard::CreateAndroidManifestWizard(BuildSystem *buildSystem)
|
||||||
: m_target(target), m_copyState(Ask)
|
: m_buildSystem(buildSystem), m_copyState(Ask)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Create Android Template Files Wizard"));
|
setWindowTitle(tr("Create Android Template Files Wizard"));
|
||||||
|
|
||||||
const QList<BuildTargetInfo> buildTargets = target->applicationTargets();
|
const QList<BuildTargetInfo> buildTargets = buildSystem->applicationTargets();
|
||||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target->kit());
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(buildSystem->kit());
|
||||||
m_copyGradle = version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0);
|
m_copyGradle = version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0);
|
||||||
|
|
||||||
if (buildTargets.isEmpty()) {
|
if (buildTargets.isEmpty()) {
|
||||||
@@ -308,7 +356,8 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QStringList addedFiles;
|
QStringList addedFiles;
|
||||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(m_target->kit());
|
Target *target = m_buildSystem->target();
|
||||||
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target->kit());
|
||||||
if (!version)
|
if (!version)
|
||||||
return;
|
return;
|
||||||
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
|
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
|
||||||
@@ -331,12 +380,12 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
|||||||
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
|
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidManager::updateGradleProperties(m_target, m_buildKey);
|
AndroidManager::updateGradleProperties(target, m_buildKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString androidPackageDir;
|
QString androidPackageDir;
|
||||||
ProjectNode *node = m_target->project()->findNodeForBuildKey(m_buildKey);
|
ProjectNode *node = target->project()->findNodeForBuildKey(m_buildKey);
|
||||||
if (node) {
|
if (node) {
|
||||||
node->addFiles(addedFiles);
|
node->addFiles(addedFiles);
|
||||||
androidPackageDir = node->data(Android::Constants::AndroidPackageSourceDir).toString();
|
androidPackageDir = node->data(Android::Constants::AndroidPackageSourceDir).toString();
|
||||||
@@ -344,7 +393,7 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
|||||||
|
|
||||||
if (androidPackageDir.isEmpty()) {
|
if (androidPackageDir.isEmpty()) {
|
||||||
// and now time for some magic
|
// and now time for some magic
|
||||||
const BuildTargetInfo bti = m_target->buildTarget(m_buildKey);
|
const BuildTargetInfo bti = target->buildTarget(m_buildKey);
|
||||||
const QString value = "$$PWD/" + bti.projectFilePath.toFileInfo().absoluteDir().relativeFilePath(m_directory);
|
const QString value = "$$PWD/" + bti.projectFilePath.toFileInfo().absoluteDir().relativeFilePath(m_directory);
|
||||||
bool result = node->setData(Android::Constants::AndroidPackageSourceDir, value);
|
bool result = node->setData(Android::Constants::AndroidPackageSourceDir, value);
|
||||||
|
|
||||||
@@ -357,9 +406,9 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
|||||||
Core::EditorManager::openEditor(m_directory + QLatin1String("/AndroidManifest.xml"));
|
Core::EditorManager::openEditor(m_directory + QLatin1String("/AndroidManifest.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Target *CreateAndroidManifestWizard::target() const
|
BuildSystem *CreateAndroidManifestWizard::buildSystem() const
|
||||||
{
|
{
|
||||||
return m_target;
|
return m_buildSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateAndroidManifestWizard::accept()
|
void CreateAndroidManifestWizard::accept()
|
||||||
@@ -368,4 +417,5 @@ void CreateAndroidManifestWizard::accept()
|
|||||||
Wizard::accept();
|
Wizard::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
} // namespace Android
|
} // namespace Android
|
||||||
|
@@ -28,71 +28,19 @@
|
|||||||
#include "android_global.h"
|
#include "android_global.h"
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/pathchooser.h>
|
|
||||||
#include <utils/wizard.h>
|
#include <utils/wizard.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
namespace ProjectExplorer { class BuildSystem; }
|
||||||
class QComboBox;
|
|
||||||
class QLabel;
|
|
||||||
class QFormLayout;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Utils {
|
|
||||||
class InfoLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ProjectExplorer { class Target; }
|
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
class CreateAndroidManifestWizard;
|
class CreateAndroidManifestWizard : public Utils::Wizard
|
||||||
|
|
||||||
class NoApplicationProFilePage : public QWizardPage
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_DECLARE_TR_FUNCTIONS(Android::CreateAndroidManifestWizard)
|
||||||
public:
|
|
||||||
NoApplicationProFilePage(CreateAndroidManifestWizard *wizard);
|
|
||||||
private:
|
|
||||||
CreateAndroidManifestWizard *m_wizard;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ChooseProFilePage : public QWizardPage
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
explicit ChooseProFilePage(CreateAndroidManifestWizard *wizard);
|
CreateAndroidManifestWizard(ProjectExplorer::BuildSystem *buildSystem);
|
||||||
|
|
||||||
private:
|
|
||||||
void nodeSelected(int index);
|
|
||||||
private:
|
|
||||||
CreateAndroidManifestWizard *m_wizard;
|
|
||||||
QComboBox *m_comboBox;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ChooseDirectoryPage : public QWizardPage
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ChooseDirectoryPage(CreateAndroidManifestWizard *wizard);
|
|
||||||
void initializePage();
|
|
||||||
protected:
|
|
||||||
bool isComplete() const;
|
|
||||||
private:
|
|
||||||
void checkPackageSourceDir();
|
|
||||||
private:
|
|
||||||
CreateAndroidManifestWizard *m_wizard;
|
|
||||||
Utils::PathChooser *m_androidPackageSourceDir;
|
|
||||||
Utils::InfoLabel *m_sourceDirectoryWarning;
|
|
||||||
QLabel *m_label;
|
|
||||||
QFormLayout *m_layout;
|
|
||||||
bool m_complete;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ANDROID_EXPORT CreateAndroidManifestWizard : public Utils::Wizard
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
CreateAndroidManifestWizard(ProjectExplorer::Target *target);
|
|
||||||
|
|
||||||
QString buildKey() const;
|
QString buildKey() const;
|
||||||
void setBuildKey(const QString &buildKey);
|
void setBuildKey(const QString &buildKey);
|
||||||
@@ -103,7 +51,7 @@ public:
|
|||||||
void setDirectory(const QString &directory);
|
void setDirectory(const QString &directory);
|
||||||
void setCopyGradle(bool copy);
|
void setCopyGradle(bool copy);
|
||||||
|
|
||||||
ProjectExplorer::Target *target() const;
|
ProjectExplorer::BuildSystem *buildSystem() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum CopyState {
|
enum CopyState {
|
||||||
@@ -115,11 +63,12 @@ private:
|
|||||||
|
|
||||||
void createAndroidManifestFile();
|
void createAndroidManifestFile();
|
||||||
void createAndroidTemplateFiles();
|
void createAndroidTemplateFiles();
|
||||||
ProjectExplorer::Target *m_target;
|
ProjectExplorer::BuildSystem *m_buildSystem;
|
||||||
QString m_buildKey;
|
QString m_buildKey;
|
||||||
QString m_directory;
|
QString m_directory;
|
||||||
CopyState m_copyState;
|
CopyState m_copyState;
|
||||||
bool m_copyGradle;
|
bool m_copyGradle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
} // namespace Android
|
} // namespace Android
|
||||||
|
Reference in New Issue
Block a user