QmakeAndroidSupport: Move AndroidPackageInstallationStep to Android plugin

There's nothing Qmake related in there (anymore?).

Change-Id: I8842d4824065cf3cba61d50b6f333ec3b52e3851
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
hjk
2017-12-07 15:30:16 +01:00
parent 6b48beeeb0
commit 1f3ba4ce15
14 changed files with 78 additions and 145 deletions

View File

@@ -53,7 +53,8 @@ HEADERS += \
adbcommandswidget.h \ adbcommandswidget.h \
androidsdkpackage.h \ androidsdkpackage.h \
androidsdkmodel.h \ androidsdkmodel.h \
androidsdkmanagerwidget.h androidsdkmanagerwidget.h \
androidpackageinstallationstep.h
SOURCES += \ SOURCES += \
androidconfigurations.cpp \ androidconfigurations.cpp \
@@ -100,7 +101,8 @@ SOURCES += \
adbcommandswidget.cpp \ adbcommandswidget.cpp \
androidsdkpackage.cpp \ androidsdkpackage.cpp \
androidsdkmodel.cpp \ androidsdkmodel.cpp \
androidsdkmanagerwidget.cpp androidsdkmanagerwidget.cpp \
androidpackageinstallationstep.cpp
FORMS += \ FORMS += \
androidsettingswidget.ui \ androidsettingswidget.ui \

View File

@@ -68,6 +68,8 @@ Project {
"androidmanifesteditorfactory.h", "androidmanifesteditorfactory.h",
"androidmanifesteditorwidget.cpp", "androidmanifesteditorwidget.cpp",
"androidmanifesteditorwidget.h", "androidmanifesteditorwidget.h",
"androidpackageinstallationstep.cpp",
"androidackageinstallationstep.h",
"androidplugin.cpp", "androidplugin.cpp",
"androidplugin.h", "androidplugin.h",
"androidpotentialkit.cpp", "androidpotentialkit.cpp",

View File

@@ -65,5 +65,7 @@ const char ANDROID_DEPLOY_SETTINGS_FILE[] = "AndroidDeploySettingsFile";
const char ANDROID_PACKAGE_SOURCE_DIR[] = "AndroidPackageSourceDir"; const char ANDROID_PACKAGE_SOURCE_DIR[] = "AndroidPackageSourceDir";
const char ANDROID_EXTRA_LIBS[] = "AndroidExtraLibs"; const char ANDROID_EXTRA_LIBS[] = "AndroidExtraLibs";
const char ANDROID_PACKAGE_INSTALLATION_STEP_ID[] = "Qt4ProjectManager.AndroidPackageInstallationStep";
} // namespace Constants; } // namespace Constants;
} // namespace Android } // namespace Android

View File

@@ -25,8 +25,8 @@
#include "androidpackageinstallationstep.h" #include "androidpackageinstallationstep.h"
#include <android/androidconstants.h> #include "androidconstants.h"
#include <android/androidmanager.h> #include "androidmanager.h"
#include <projectexplorer/buildsteplist.h> #include <projectexplorer/buildsteplist.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
@@ -35,17 +35,19 @@
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <projectexplorer/gnumakeparser.h> #include <projectexplorer/gnumakeparser.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcprocess.h>
#include <QDir> #include <QDir>
using namespace QmakeAndroidSupport::Internal; using namespace ProjectExplorer;
using namespace Utils;
using namespace Android::Internal;
const Core::Id AndroidPackageInstallationStep::Id = Core::Id("Qt4ProjectManager.AndroidPackageInstallationStep"); namespace Android {
AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bsl) AndroidPackageInstallationStep::AndroidPackageInstallationStep(BuildStepList *bsl)
: AbstractProcessStep(bsl, AndroidPackageInstallationStep::Id) : AbstractProcessStep(bsl, Constants::ANDROID_PACKAGE_INSTALLATION_STEP_ID)
{ {
const QString name = tr("Copy application data"); const QString name = tr("Copy application data");
setDefaultDisplayName(name); setDefaultDisplayName(name);
@@ -54,30 +56,29 @@ AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::
bool AndroidPackageInstallationStep::init(QList<const BuildStep *> &earlierSteps) bool AndroidPackageInstallationStep::init(QList<const BuildStep *> &earlierSteps)
{ {
ProjectExplorer::BuildConfiguration *bc = buildConfiguration(); BuildConfiguration *bc = buildConfiguration();
QString dirPath = bc->buildDirectory().appendPath(Android::Constants::ANDROID_BUILDDIRECTORY).toString(); QString dirPath = bc->buildDirectory().appendPath(Constants::ANDROID_BUILDDIRECTORY).toString();
if (Utils::HostOsInfo::isWindowsHost()) if (HostOsInfo::isWindowsHost())
if (bc->environment().searchInPath("sh.exe").isEmpty()) if (bc->environment().searchInPath("sh.exe").isEmpty())
dirPath = QDir::toNativeSeparators(dirPath); dirPath = QDir::toNativeSeparators(dirPath);
ProjectExplorer::ToolChain *tc ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(),
= ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
ProjectExplorer::ProcessParameters *pp = processParameters(); ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander()); pp->setMacroExpander(bc->macroExpander());
pp->setWorkingDirectory(bc->buildDirectory().toString()); pp->setWorkingDirectory(bc->buildDirectory().toString());
pp->setCommand(tc->makeCommand(bc->environment())); pp->setCommand(tc->makeCommand(bc->environment()));
Utils::Environment env = bc->environment(); Environment env = bc->environment();
Utils::Environment::setupEnglishOutput(&env); Environment::setupEnglishOutput(&env);
pp->setEnvironment(env); pp->setEnvironment(env);
const QString innerQuoted = Utils::QtcProcess::quoteArg(dirPath); const QString innerQuoted = QtcProcess::quoteArg(dirPath);
const QString outerQuoted = Utils::QtcProcess::quoteArg(QString::fromLatin1("INSTALL_ROOT=") + innerQuoted); const QString outerQuoted = QtcProcess::quoteArg("INSTALL_ROOT=" + innerQuoted);
pp->setArguments(outerQuoted + QString::fromLatin1(" install")); pp->setArguments(outerQuoted + " install");
pp->resolveAll(); pp->resolveAll();
setOutputParser(new ProjectExplorer::GnuMakeParser()); setOutputParser(new GnuMakeParser());
ProjectExplorer::IOutputParser *parser = target()->kit()->createOutputParser(); IOutputParser *parser = target()->kit()->createOutputParser();
if (parser) if (parser)
appendOutputParser(parser); appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory()); outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
@@ -94,10 +95,10 @@ void AndroidPackageInstallationStep::run(QFutureInterface<bool> &fi)
{ {
QString error; QString error;
foreach (const QString &dir, m_androidDirsToClean) { foreach (const QString &dir, m_androidDirsToClean) {
Utils::FileName androidDir = Utils::FileName::fromString(dir); FileName androidDir = FileName::fromString(dir);
if (!dir.isEmpty() && androidDir.exists()) { if (!dir.isEmpty() && androidDir.exists()) {
emit addOutput(tr("Removing directory %1").arg(dir), OutputFormat::NormalMessage); emit addOutput(tr("Removing directory %1").arg(dir), OutputFormat::NormalMessage);
if (!Utils::FileUtils::removeRecursively(androidDir, &error)) { if (!FileUtils::removeRecursively(androidDir, &error)) {
emit addOutput(error, OutputFormat::Stderr); emit addOutput(error, OutputFormat::Stderr);
reportRunResult(fi, false); reportRunResult(fi, false);
return; return;
@@ -107,7 +108,7 @@ void AndroidPackageInstallationStep::run(QFutureInterface<bool> &fi)
AbstractProcessStep::run(fi); AbstractProcessStep::run(fi);
} }
ProjectExplorer::BuildStepConfigWidget *AndroidPackageInstallationStep::createConfigWidget() BuildStepConfigWidget *AndroidPackageInstallationStep::createConfigWidget()
{ {
return new AndroidPackageInstallationStepWidget(this); return new AndroidPackageInstallationStepWidget(this);
} }
@@ -122,10 +123,11 @@ bool AndroidPackageInstallationStep::immutable() const
// AndroidPackageInstallationStepWidget // AndroidPackageInstallationStepWidget
// //
namespace Internal {
AndroidPackageInstallationStepWidget::AndroidPackageInstallationStepWidget(AndroidPackageInstallationStep *step) AndroidPackageInstallationStepWidget::AndroidPackageInstallationStepWidget(AndroidPackageInstallationStep *step)
: m_step(step) : m_step(step)
{ {
} }
QString AndroidPackageInstallationStepWidget::summaryText() const QString AndroidPackageInstallationStepWidget::summaryText() const
@@ -142,3 +144,23 @@ bool AndroidPackageInstallationStepWidget::showWidget() const
{ {
return false; return false;
} }
//
// AndroidPackageInstallationStepFactory
//
AndroidPackageInstallationFactory::AndroidPackageInstallationFactory()
{
registerStep<AndroidPackageInstallationStep>(Constants::ANDROID_PACKAGE_INSTALLATION_STEP_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
setRepeatable(false);
setDisplayName(tr("Deploy to device"));
}
bool AndroidPackageInstallationFactory::canHandle(BuildStepList *bsl) const
{
return BuildStepFactory::canHandle(bsl) && AndroidManager::supportsAndroid(bsl->target());
}
} // namespace Internal
} // namespace Android

View File

@@ -25,13 +25,14 @@
#pragma once #pragma once
#include "android_global.h"
#include <projectexplorer/buildstep.h> #include <projectexplorer/buildstep.h>
#include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/abstractprocessstep.h>
namespace QmakeAndroidSupport { namespace Android {
namespace Internal {
class AndroidPackageInstallationStep : public ProjectExplorer::AbstractProcessStep class ANDROID_EXPORT AndroidPackageInstallationStep : public ProjectExplorer::AbstractProcessStep
{ {
Q_OBJECT Q_OBJECT
friend class AndroidPackageInstallationFactory; friend class AndroidPackageInstallationFactory;
@@ -47,9 +48,10 @@ public:
private: private:
QStringList m_androidDirsToClean; QStringList m_androidDirsToClean;
static const Core::Id Id;
}; };
namespace Internal {
class AndroidPackageInstallationStepWidget : public ProjectExplorer::BuildStepConfigWidget class AndroidPackageInstallationStepWidget : public ProjectExplorer::BuildStepConfigWidget
{ {
Q_OBJECT Q_OBJECT
@@ -63,5 +65,15 @@ private:
AndroidPackageInstallationStep *m_step; AndroidPackageInstallationStep *m_step;
}; };
class AndroidPackageInstallationFactory: public ProjectExplorer::BuildStepFactory
{
Q_OBJECT
public:
AndroidPackageInstallationFactory();
bool canHandle(ProjectExplorer::BuildStepList *bsl) const override;
};
} // namespace Internal } // namespace Internal
} // namespace QmakeAndroidSupport } // namespace Android

View File

@@ -25,7 +25,6 @@
#include "androidplugin.h" #include "androidplugin.h"
#include "androidqmltoolingsupport.h"
#include "androidconfigurations.h" #include "androidconfigurations.h"
#include "androidconstants.h" #include "androidconstants.h"
#include "androiddebugsupport.h" #include "androiddebugsupport.h"
@@ -36,7 +35,9 @@
#include "androidgdbserverkitinformation.h" #include "androidgdbserverkitinformation.h"
#include "androidmanager.h" #include "androidmanager.h"
#include "androidmanifesteditorfactory.h" #include "androidmanifesteditorfactory.h"
#include "androidpackageinstallationstep.h"
#include "androidpotentialkit.h" #include "androidpotentialkit.h"
#include "androidqmltoolingsupport.h"
#include "androidqtversionfactory.h" #include "androidqtversionfactory.h"
#include "androidrunconfiguration.h" #include "androidrunconfiguration.h"
#include "androidruncontrol.h" #include "androidruncontrol.h"
@@ -88,6 +89,7 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
addAutoReleasedObject(new Internal::AndroidDeviceFactory); addAutoReleasedObject(new Internal::AndroidDeviceFactory);
addAutoReleasedObject(new Internal::AndroidPotentialKit); addAutoReleasedObject(new Internal::AndroidPotentialKit);
addAutoReleasedObject(new Internal::JavaEditorFactory); addAutoReleasedObject(new Internal::JavaEditorFactory);
addAutoReleasedObject(new AndroidPackageInstallationFactory);
KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation); KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation);
addAutoReleasedObject(new Internal::AndroidManifestEditorFactory); addAutoReleasedObject(new Internal::AndroidManifestEditorFactory);

View File

@@ -146,6 +146,7 @@ bool CMakeRunConfiguration::fromMap(const QVariantMap &map)
extraAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(ct.workingDirectory); extraAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(ct.workingDirectory);
} }
setDisplayName(defaultDisplayName());
setDefaultDisplayName(defaultDisplayName()); setDefaultDisplayName(defaultDisplayName());
return true; return true;

View File

@@ -1,52 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
** 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 "androidpackageinstallationfactory.h"
#include "androidpackageinstallationstep.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <android/androidmanager.h>
using namespace ProjectExplorer;
namespace QmakeAndroidSupport {
namespace Internal {
AndroidPackageInstallationFactory::AndroidPackageInstallationFactory()
{
registerStep<AndroidPackageInstallationStep>(AndroidPackageInstallationStep::Id);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
setRepeatable(false);
setDisplayName(tr("Deploy to device"));
}
bool AndroidPackageInstallationFactory::canHandle(BuildStepList *bsl) const
{
return BuildStepFactory::canHandle(bsl) && Android::AndroidManager::supportsAndroid(bsl->target());
}
} // namespace Internal
} // namespace Android

View File

@@ -1,44 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
** 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 <projectexplorer/buildstep.h>
namespace QmakeAndroidSupport {
namespace Internal {
class AndroidPackageInstallationFactory: public ProjectExplorer::BuildStepFactory
{
Q_OBJECT
public:
AndroidPackageInstallationFactory();
bool canHandle(ProjectExplorer::BuildStepList *bsl) const override;
};
} // namespace Internal
} // namespace QmakeAndroidSupport

View File

@@ -25,10 +25,10 @@
#include "androidqmakebuildconfigurationfactory.h" #include "androidqmakebuildconfigurationfactory.h"
#include "qmakeandroidbuildapkstep.h" #include "qmakeandroidbuildapkstep.h"
#include "androidpackageinstallationstep.h"
#include <android/androidmanager.h>
#include <android/androidconfigurations.h> #include <android/androidconfigurations.h>
#include <android/androidmanager.h>
#include <android/androidpackageinstallationstep.h>
#include <projectexplorer/buildmanager.h> #include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildsteplist.h> #include <projectexplorer/buildsteplist.h>

View File

@@ -23,7 +23,6 @@
** **
****************************************************************************/ ****************************************************************************/
#include "androidpackageinstallationstep.h"
#include "qmakeandroidbuildapkstep.h" #include "qmakeandroidbuildapkstep.h"
#include "qmakeandroidsupport.h" #include "qmakeandroidsupport.h"
#include "androidqmakebuildconfigurationfactory.h" #include "androidqmakebuildconfigurationfactory.h"

View File

@@ -6,8 +6,6 @@ DEFINES += \
HEADERS += \ HEADERS += \
androidextralibrarylistmodel.h \ androidextralibrarylistmodel.h \
androidpackageinstallationfactory.h \
androidpackageinstallationstep.h \
createandroidmanifestwizard.h \ createandroidmanifestwizard.h \
qmakeandroidsupport.h \ qmakeandroidsupport.h \
qmakeandroidrunconfiguration.h \ qmakeandroidrunconfiguration.h \
@@ -19,8 +17,6 @@ HEADERS += \
SOURCES += \ SOURCES += \
androidextralibrarylistmodel.cpp \ androidextralibrarylistmodel.cpp \
androidpackageinstallationfactory.cpp \
androidpackageinstallationstep.cpp \
createandroidmanifestwizard.cpp \ createandroidmanifestwizard.cpp \
qmakeandroidsupport.cpp \ qmakeandroidsupport.cpp \
qmakeandroidrunconfiguration.cpp \ qmakeandroidrunconfiguration.cpp \
@@ -31,6 +27,3 @@ SOURCES += \
qmakeandroidsupportplugin.cpp qmakeandroidsupportplugin.cpp
FORMS += qmakeandroidbuildapkwidget.ui FORMS += qmakeandroidbuildapkwidget.ui
RESOURCES +=

View File

@@ -18,10 +18,6 @@ QtcPlugin {
files: [ files: [
"androidextralibrarylistmodel.cpp", "androidextralibrarylistmodel.cpp",
"androidextralibrarylistmodel.h", "androidextralibrarylistmodel.h",
"androidpackageinstallationfactory.cpp",
"androidpackageinstallationfactory.h",
"androidpackageinstallationstep.cpp",
"androidpackageinstallationstep.h",
"createandroidmanifestwizard.cpp", "createandroidmanifestwizard.cpp",
"createandroidmanifestwizard.h", "createandroidmanifestwizard.h",
"qmakeandroidbuildapkstep.cpp", "qmakeandroidbuildapkstep.cpp",

View File

@@ -25,7 +25,6 @@
#include "qmakeandroidsupportplugin.h" #include "qmakeandroidsupportplugin.h"
#include "androidpackageinstallationfactory.h"
#include "androidqmakebuildconfigurationfactory.h" #include "androidqmakebuildconfigurationfactory.h"
#include "qmakeandroidbuildapkstep.h" #include "qmakeandroidbuildapkstep.h"
#include "qmakeandroidrunfactories.h" #include "qmakeandroidrunfactories.h"
@@ -52,7 +51,6 @@ bool QmakeAndroidSupportPlugin::initialize(const QStringList &arguments, QString
Q_UNUSED(arguments) Q_UNUSED(arguments)
Q_UNUSED(errorMessage) Q_UNUSED(errorMessage)
addAutoReleasedObject(new AndroidQmakeBuildConfigurationFactory); addAutoReleasedObject(new AndroidQmakeBuildConfigurationFactory);
addAutoReleasedObject(new AndroidPackageInstallationFactory);
addAutoReleasedObject(new QmakeAndroidBuildApkStepFactory); addAutoReleasedObject(new QmakeAndroidBuildApkStepFactory);
addAutoReleasedObject(new QmakeAndroidRunConfigurationFactory); addAutoReleasedObject(new QmakeAndroidRunConfigurationFactory);
addAutoReleasedObject(new QmakeAndroidSupport); addAutoReleasedObject(new QmakeAndroidSupport);