forked from qt-creator/qt-creator
Android: Move CreateAndroidManifestWizard and related build step to base
It does not directly depend on qmake anymore. Change-Id: I3b9625e54d98c79ef137059cf4554b3f2807e88e Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
@@ -54,7 +54,8 @@ HEADERS += \
|
||||
androidsdkmodel.h \
|
||||
androidsdkmanagerwidget.h \
|
||||
androidpackageinstallationstep.h \
|
||||
androidextralibrarylistmodel.h
|
||||
androidextralibrarylistmodel.h \
|
||||
createandroidmanifestwizard.h
|
||||
|
||||
SOURCES += \
|
||||
androidconfigurations.cpp \
|
||||
@@ -102,7 +103,8 @@ SOURCES += \
|
||||
androidsdkmodel.cpp \
|
||||
androidsdkmanagerwidget.cpp \
|
||||
androidpackageinstallationstep.cpp \
|
||||
androidextralibrarylistmodel.cpp
|
||||
androidextralibrarylistmodel.cpp \
|
||||
createandroidmanifestwizard.cpp
|
||||
|
||||
FORMS += \
|
||||
androidsettingswidget.ui \
|
||||
|
||||
@@ -116,6 +116,8 @@ Project {
|
||||
"avddialog.h",
|
||||
"certificatesmodel.cpp",
|
||||
"certificatesmodel.h",
|
||||
"createandroidmanifestwizard.h",
|
||||
"createandroidmanifestwizard.cpp",
|
||||
"javaeditor.cpp",
|
||||
"javaeditor.h",
|
||||
"javaindenter.cpp",
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "androidbuildapkstep.h"
|
||||
|
||||
#include "androidbuildapkwidget.h"
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidconstants.h"
|
||||
@@ -40,6 +41,7 @@
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
@@ -48,6 +50,8 @@
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
@@ -61,12 +65,15 @@
|
||||
#include <memory>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Android::Internal;
|
||||
|
||||
namespace {
|
||||
Q_LOGGING_CATEGORY(buildapkstepLog, "qtc.android.build.androidbuildapkstep")
|
||||
}
|
||||
|
||||
namespace Android {
|
||||
using namespace Internal;
|
||||
|
||||
const Core::Id ANDROID_BUILD_APK_ID("QmakeProjectManager.AndroidBuildApkStep");
|
||||
|
||||
const QVersionNumber gradleScriptRevokedSdkVersion(25, 3, 0);
|
||||
const char KeystoreLocationKey[] = "KeystoreLocation";
|
||||
@@ -115,8 +122,8 @@ private:
|
||||
this);
|
||||
};
|
||||
|
||||
AndroidBuildApkStep::AndroidBuildApkStep(ProjectExplorer::BuildStepList *parent, Core::Id id)
|
||||
: ProjectExplorer::AbstractProcessStep(parent, id),
|
||||
AndroidBuildApkStep::AndroidBuildApkStep(BuildStepList *parent)
|
||||
: AbstractProcessStep(parent, ANDROID_BUILD_APK_ID),
|
||||
m_buildTargetSdk(AndroidConfig::apiLevelNameFor(AndroidConfigurations::
|
||||
sdkManager()->latestAndroidSdkPlatform()))
|
||||
{
|
||||
@@ -263,7 +270,7 @@ void AndroidBuildApkStep::showInGraphicalShell()
|
||||
|
||||
ProjectExplorer::BuildStepConfigWidget *AndroidBuildApkStep::createConfigWidget()
|
||||
{
|
||||
return new AndroidBuildApkInnerWidget(this);
|
||||
return new AndroidBuildApkWidget(this);
|
||||
}
|
||||
|
||||
void AndroidBuildApkStep::processFinished(int exitCode, QProcess::ExitStatus status)
|
||||
@@ -537,6 +544,22 @@ QString PasswordInputDialog::getPassword(Context context, std::function<bool (co
|
||||
return isAccepted ? dlg->inputEdit->text() : "";
|
||||
}
|
||||
|
||||
|
||||
namespace Internal {
|
||||
|
||||
// AndroidBuildApkStepFactory
|
||||
|
||||
AndroidBuildApkStepFactory::AndroidBuildApkStepFactory()
|
||||
{
|
||||
registerStep<AndroidBuildApkStep>(ANDROID_BUILD_APK_ID);
|
||||
setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
||||
setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE);
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
setDisplayName(AndroidBuildApkStep::tr("Build Android APK"));
|
||||
setRepeatable(false);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
#include "androidbuildapkstep.moc"
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "android_global.h"
|
||||
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -39,10 +40,9 @@ class ANDROID_EXPORT AndroidBuildApkStep : public ProjectExplorer::AbstractProce
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
AndroidBuildApkStep(ProjectExplorer::BuildStepList *bc, Core::Id id);
|
||||
|
||||
public:
|
||||
AndroidBuildApkStep(ProjectExplorer::BuildStepList *bc);
|
||||
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
QVariantMap toMap() const override;
|
||||
|
||||
@@ -104,4 +104,13 @@ private:
|
||||
bool m_skipBuilding = false;
|
||||
};
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class AndroidBuildApkStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
AndroidBuildApkStepFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
@@ -30,11 +30,9 @@
|
||||
#include "androidcreatekeystorecertificate.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidsdkmanager.h"
|
||||
#include "createandroidmanifestwizard.h"
|
||||
#include "ui_androidbuildapkwidget.h"
|
||||
|
||||
#include <android/androidbuildapkwidget.h>
|
||||
#include <android/androidmanager.h>
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -55,10 +53,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace Android;
|
||||
using namespace Internal;
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
const int minApiSupported = 9;
|
||||
|
||||
@@ -240,7 +236,7 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step) :
|
||||
{
|
||||
m_extraLibraryListModel = new AndroidExtraLibraryListModel(m_step->target(), this);
|
||||
|
||||
auto base = new Android::AndroidBuildApkInnerWidget(step);
|
||||
auto base = new AndroidBuildApkInnerWidget(step);
|
||||
base->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
auto createTemplatesGroupBox = new QGroupBox(tr("Android"));
|
||||
@@ -284,8 +280,10 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step) :
|
||||
topLayout->addWidget(createTemplatesGroupBox);
|
||||
topLayout->addWidget(additionalLibrariesGroupBox);
|
||||
|
||||
connect(createAndroidTemplatesButton, &QAbstractButton::clicked,
|
||||
this, &AndroidBuildApkWidget::requestAndroidTemplates);
|
||||
connect(createAndroidTemplatesButton, &QAbstractButton::clicked, this, [this] {
|
||||
CreateAndroidManifestWizard wizard(m_step->target());
|
||||
wizard.exec();
|
||||
});
|
||||
|
||||
connect(addAndroidExtraLibButton, &QAbstractButton::clicked,
|
||||
this, &AndroidBuildApkWidget::addAndroidExtraLib);
|
||||
@@ -336,4 +334,5 @@ QString AndroidBuildApkWidget::displayName() const
|
||||
return summaryText();
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // Android
|
||||
|
||||
@@ -42,10 +42,9 @@ namespace Ui { class AndroidBuildApkWidget; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
class AndroidBuildApkStep;
|
||||
|
||||
class ANDROID_EXPORT AndroidBuildApkInnerWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
class AndroidBuildApkInnerWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -72,12 +71,12 @@ private:
|
||||
AndroidBuildApkStep *m_step;
|
||||
};
|
||||
|
||||
class ANDROID_EXPORT AndroidBuildApkWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
class AndroidBuildApkWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AndroidBuildApkWidget(Android::AndroidBuildApkStep *step);
|
||||
explicit AndroidBuildApkWidget(AndroidBuildApkStep *step);
|
||||
|
||||
signals:
|
||||
void requestAndroidTemplates();
|
||||
@@ -94,9 +93,10 @@ private:
|
||||
QListView *m_androidExtraLibsListView = nullptr;
|
||||
QToolButton *m_removeAndroidExtraLibButton = nullptr;
|
||||
|
||||
Android::AndroidBuildApkStep *m_step = nullptr;
|
||||
AndroidBuildApkStep *m_step = nullptr;
|
||||
Android::AndroidExtraLibraryListModel *m_extraLibraryListModel = nullptr;
|
||||
bool m_ignoreChange = false;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
@@ -92,6 +92,7 @@ public:
|
||||
AndroidPackageInstallationFactory packackeInstallationFactory;
|
||||
AndroidManifestEditorFactory manifestEditorFactory;
|
||||
AndroidRunConfigurationFactory runConfigFactory;
|
||||
AndroidBuildApkStepFactory buildApkStepFactory;
|
||||
};
|
||||
|
||||
AndroidPlugin::~AndroidPlugin()
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
using namespace Android::Internal;
|
||||
|
||||
Utils::FileName Android::AndroidQtSupport::apkPath(const ProjectExplorer::Target *target) const
|
||||
{
|
||||
if (!target)
|
||||
|
||||
@@ -47,11 +47,11 @@
|
||||
#include <QMessageBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
using namespace Android;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace QmakeAndroidSupport::Internal;
|
||||
using namespace Utils;
|
||||
|
||||
namespace Android {
|
||||
|
||||
//
|
||||
// NoApplicationProFilePage
|
||||
//
|
||||
@@ -375,3 +375,5 @@ void CreateAndroidManifestWizard::accept()
|
||||
createAndroidTemplateFiles();
|
||||
Wizard::accept();
|
||||
}
|
||||
|
||||
} // namespace Android
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "android_global.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/wizard.h>
|
||||
@@ -37,8 +39,7 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer { class Target; }
|
||||
|
||||
namespace QmakeAndroidSupport {
|
||||
namespace Internal {
|
||||
namespace Android {
|
||||
|
||||
class CreateAndroidManifestWizard;
|
||||
|
||||
@@ -84,7 +85,7 @@ private:
|
||||
bool m_complete;
|
||||
};
|
||||
|
||||
class CreateAndroidManifestWizard : public Utils::Wizard
|
||||
class ANDROID_EXPORT CreateAndroidManifestWizard : public Utils::Wizard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -118,5 +119,4 @@ private:
|
||||
bool m_copyGradle;
|
||||
};
|
||||
|
||||
} //namespace QmakeAndroidSupport
|
||||
} //namespace Internal
|
||||
} // namespace Android
|
||||
@@ -24,8 +24,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "androidqmakebuildconfigurationfactory.h"
|
||||
#include "qmakeandroidbuildapkstep.h"
|
||||
|
||||
#include <android/androidbuildapkstep.h>
|
||||
#include <android/androidconfigurations.h>
|
||||
#include <android/androidconstants.h>
|
||||
#include <android/androidmanager.h>
|
||||
@@ -71,7 +71,7 @@ void AndroidQmakeBuildConfiguration::initialize(const BuildInfo *info)
|
||||
|
||||
BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
buildSteps->appendStep(new AndroidPackageInstallationStep(buildSteps));
|
||||
buildSteps->appendStep(new QmakeAndroidBuildApkStep(buildSteps));
|
||||
buildSteps->appendStep(new Android::AndroidBuildApkStep(buildSteps));
|
||||
|
||||
updateCacheAndEmitEnvironmentChanged();
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||
** 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 "qmakeandroidbuildapkstep.h"
|
||||
|
||||
#include "createandroidmanifestwizard.h"
|
||||
|
||||
#include <android/androidconstants.h>
|
||||
#include <android/androidbuildapkwidget.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
|
||||
|
||||
using namespace Android;
|
||||
|
||||
namespace QmakeAndroidSupport {
|
||||
namespace Internal {
|
||||
|
||||
const Core::Id ANDROID_BUILD_APK_ID("QmakeProjectManager.AndroidBuildApkStep");
|
||||
|
||||
|
||||
// QmakeAndroidBuildApkStepFactory
|
||||
|
||||
QmakeAndroidBuildApkStepFactory::QmakeAndroidBuildApkStepFactory()
|
||||
{
|
||||
registerStep<QmakeAndroidBuildApkStep>(ANDROID_BUILD_APK_ID);
|
||||
setSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
||||
setSupportedDeviceType(Constants::ANDROID_DEVICE_TYPE);
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
setDisplayName(QmakeAndroidBuildApkStep::tr("Build Android APK"));
|
||||
setRepeatable(false);
|
||||
}
|
||||
|
||||
// QmakeAndroidBuildApkStep
|
||||
|
||||
QmakeAndroidBuildApkStep::QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc)
|
||||
: AndroidBuildApkStep(bc, ANDROID_BUILD_APK_ID)
|
||||
{
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStepConfigWidget *QmakeAndroidBuildApkStep::createConfigWidget()
|
||||
{
|
||||
auto widget = new AndroidBuildApkWidget(this);
|
||||
connect(widget, &AndroidBuildApkWidget::requestAndroidTemplates, this, [this] {
|
||||
CreateAndroidManifestWizard wizard(target());
|
||||
wizard.exec();
|
||||
});
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeAndroidSupport
|
||||
@@ -1,51 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||
** 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 <android/androidbuildapkstep.h>
|
||||
|
||||
namespace QmakeAndroidSupport {
|
||||
namespace Internal {
|
||||
|
||||
class QmakeAndroidBuildApkStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
QmakeAndroidBuildApkStepFactory();
|
||||
};
|
||||
|
||||
class QmakeAndroidBuildApkStep : public Android::AndroidBuildApkStep
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc);
|
||||
|
||||
protected:
|
||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeAndroidSupport
|
||||
@@ -23,10 +23,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qmakeandroidbuildapkstep.h"
|
||||
#include "qmakeandroidsupport.h"
|
||||
#include "androidqmakebuildconfigurationfactory.h"
|
||||
|
||||
#include <android/androidbuildapkstep.h>
|
||||
#include <android/androidconstants.h>
|
||||
#include <android/androidglobal.h>
|
||||
|
||||
|
||||
@@ -5,15 +5,11 @@ DEFINES += \
|
||||
QMAKEANDROID_LIBRARY
|
||||
|
||||
HEADERS += \
|
||||
createandroidmanifestwizard.h \
|
||||
qmakeandroidsupport.h \
|
||||
qmakeandroidbuildapkstep.h \
|
||||
androidqmakebuildconfigurationfactory.h \
|
||||
qmakeandroidsupportplugin.h
|
||||
|
||||
SOURCES += \
|
||||
createandroidmanifestwizard.cpp \
|
||||
qmakeandroidsupport.cpp \
|
||||
qmakeandroidbuildapkstep.cpp \
|
||||
androidqmakebuildconfigurationfactory.cpp \
|
||||
qmakeandroidsupportplugin.cpp
|
||||
|
||||
@@ -16,10 +16,6 @@ QtcPlugin {
|
||||
Depends { name: "Qt.widgets" }
|
||||
|
||||
files: [
|
||||
"createandroidmanifestwizard.cpp",
|
||||
"createandroidmanifestwizard.h",
|
||||
"qmakeandroidbuildapkstep.cpp",
|
||||
"qmakeandroidbuildapkstep.h",
|
||||
"androidqmakebuildconfigurationfactory.cpp",
|
||||
"androidqmakebuildconfigurationfactory.h",
|
||||
"qmakeandroidsupport.cpp",
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "qmakeandroidsupportplugin.h"
|
||||
|
||||
#include "androidqmakebuildconfigurationfactory.h"
|
||||
#include "qmakeandroidbuildapkstep.h"
|
||||
#include "qmakeandroidsupport.h"
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
@@ -38,7 +37,6 @@ class QmakeAndroidSupportPluginPrivate
|
||||
{
|
||||
public:
|
||||
AndroidQmakeBuildConfigurationFactory buildConfigFactory;
|
||||
QmakeAndroidBuildApkStepFactory buildApkStepFactory;
|
||||
QmakeAndroidSupport androidSupport;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user