Commit 1f3ba4ce authored by hjk's avatar hjk

QmakeAndroidSupport: Move AndroidPackageInstallationStep to Android plugin

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

Change-Id: I8842d4824065cf3cba61d50b6f333ec3b52e3851
Reviewed-by: Vikas Pachdha's avatarVikas Pachdha <vikas.pachdha@qt.io>
parent 6b48beee
......@@ -53,7 +53,8 @@ HEADERS += \
adbcommandswidget.h \
androidsdkpackage.h \
androidsdkmodel.h \
androidsdkmanagerwidget.h
androidsdkmanagerwidget.h \
androidpackageinstallationstep.h
SOURCES += \
androidconfigurations.cpp \
......@@ -100,7 +101,8 @@ SOURCES += \
adbcommandswidget.cpp \
androidsdkpackage.cpp \
androidsdkmodel.cpp \
androidsdkmanagerwidget.cpp
androidsdkmanagerwidget.cpp \
androidpackageinstallationstep.cpp
FORMS += \
androidsettingswidget.ui \
......
......@@ -68,6 +68,8 @@ Project {
"androidmanifesteditorfactory.h",
"androidmanifesteditorwidget.cpp",
"androidmanifesteditorwidget.h",
"androidpackageinstallationstep.cpp",
"androidackageinstallationstep.h",
"androidplugin.cpp",
"androidplugin.h",
"androidpotentialkit.cpp",
......
......@@ -65,5 +65,7 @@ const char ANDROID_DEPLOY_SETTINGS_FILE[] = "AndroidDeploySettingsFile";
const char ANDROID_PACKAGE_SOURCE_DIR[] = "AndroidPackageSourceDir";
const char ANDROID_EXTRA_LIBS[] = "AndroidExtraLibs";
const char ANDROID_PACKAGE_INSTALLATION_STEP_ID[] = "Qt4ProjectManager.AndroidPackageInstallationStep";
} // namespace Constants;
} // namespace Android
......@@ -25,8 +25,8 @@
#include "androidpackageinstallationstep.h"
#include <android/androidconstants.h>
#include <android/androidmanager.h>
#include "androidconstants.h"
#include "androidmanager.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/target.h>
......@@ -35,17 +35,19 @@
#include <projectexplorer/toolchain.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/gnumakeparser.h>
#include <utils/hostosinfo.h>
#include <utils/qtcprocess.h>
#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)
: AbstractProcessStep(bsl, AndroidPackageInstallationStep::Id)
AndroidPackageInstallationStep::AndroidPackageInstallationStep(BuildStepList *bsl)
: AbstractProcessStep(bsl, Constants::ANDROID_PACKAGE_INSTALLATION_STEP_ID)
{
const QString name = tr("Copy application data");
setDefaultDisplayName(name);
......@@ -54,30 +56,29 @@ AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::
bool AndroidPackageInstallationStep::init(QList<const BuildStep *> &earlierSteps)
{
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
QString dirPath = bc->buildDirectory().appendPath(Android::Constants::ANDROID_BUILDDIRECTORY).toString();
if (Utils::HostOsInfo::isWindowsHost())
BuildConfiguration *bc = buildConfiguration();
QString dirPath = bc->buildDirectory().appendPath(Constants::ANDROID_BUILDDIRECTORY).toString();
if (HostOsInfo::isWindowsHost())
if (bc->environment().searchInPath("sh.exe").isEmpty())
dirPath = QDir::toNativeSeparators(dirPath);
ProjectExplorer::ToolChain *tc
= ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit(),
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(),
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
ProjectExplorer::ProcessParameters *pp = processParameters();
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setWorkingDirectory(bc->buildDirectory().toString());
pp->setCommand(tc->makeCommand(bc->environment()));
Utils::Environment env = bc->environment();
Utils::Environment::setupEnglishOutput(&env);
Environment env = bc->environment();
Environment::setupEnglishOutput(&env);
pp->setEnvironment(env);
const QString innerQuoted = Utils::QtcProcess::quoteArg(dirPath);
const QString outerQuoted = Utils::QtcProcess::quoteArg(QString::fromLatin1("INSTALL_ROOT=") + innerQuoted);
pp->setArguments(outerQuoted + QString::fromLatin1(" install"));
const QString innerQuoted = QtcProcess::quoteArg(dirPath);
const QString outerQuoted = QtcProcess::quoteArg("INSTALL_ROOT=" + innerQuoted);
pp->setArguments(outerQuoted + " install");
pp->resolveAll();
setOutputParser(new ProjectExplorer::GnuMakeParser());
ProjectExplorer::IOutputParser *parser = target()->kit()->createOutputParser();
setOutputParser(new GnuMakeParser());
IOutputParser *parser = target()->kit()->createOutputParser();
if (parser)
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
......@@ -94,10 +95,10 @@ void AndroidPackageInstallationStep::run(QFutureInterface<bool> &fi)
{
QString error;
foreach (const QString &dir, m_androidDirsToClean) {
Utils::FileName androidDir = Utils::FileName::fromString(dir);
FileName androidDir = FileName::fromString(dir);
if (!dir.isEmpty() && androidDir.exists()) {
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);
reportRunResult(fi, false);
return;
......@@ -107,7 +108,7 @@ void AndroidPackageInstallationStep::run(QFutureInterface<bool> &fi)
AbstractProcessStep::run(fi);
}
ProjectExplorer::BuildStepConfigWidget *AndroidPackageInstallationStep::createConfigWidget()
BuildStepConfigWidget *AndroidPackageInstallationStep::createConfigWidget()
{
return new AndroidPackageInstallationStepWidget(this);
}
......@@ -122,10 +123,11 @@ bool AndroidPackageInstallationStep::immutable() const
// AndroidPackageInstallationStepWidget
//
namespace Internal {
AndroidPackageInstallationStepWidget::AndroidPackageInstallationStepWidget(AndroidPackageInstallationStep *step)
: m_step(step)
{
}
QString AndroidPackageInstallationStepWidget::summaryText() const
......@@ -142,3 +144,23 @@ bool AndroidPackageInstallationStepWidget::showWidget() const
{
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
......@@ -25,13 +25,14 @@
#pragma once
#include "android_global.h"
#include <projectexplorer/buildstep.h>
#include <projectexplorer/abstractprocessstep.h>
namespace QmakeAndroidSupport {
namespace Internal {
namespace Android {
class AndroidPackageInstallationStep : public ProjectExplorer::AbstractProcessStep
class ANDROID_EXPORT AndroidPackageInstallationStep : public ProjectExplorer::AbstractProcessStep
{
Q_OBJECT
friend class AndroidPackageInstallationFactory;
......@@ -47,9 +48,10 @@ public:
private:
QStringList m_androidDirsToClean;
static const Core::Id Id;
};
namespace Internal {
class AndroidPackageInstallationStepWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
......@@ -63,5 +65,15 @@ private:
AndroidPackageInstallationStep *m_step;
};
class AndroidPackageInstallationFactory: public ProjectExplorer::BuildStepFactory
{
Q_OBJECT
public:
AndroidPackageInstallationFactory();
bool canHandle(ProjectExplorer::BuildStepList *bsl) const override;
};
} // namespace Internal
} // namespace QmakeAndroidSupport
} // namespace Android
......@@ -25,7 +25,6 @@
#include "androidplugin.h"
#include "androidqmltoolingsupport.h"
#include "androidconfigurations.h"
#include "androidconstants.h"
#include "androiddebugsupport.h"
......@@ -36,7 +35,9 @@
#include "androidgdbserverkitinformation.h"
#include "androidmanager.h"
#include "androidmanifesteditorfactory.h"
#include "androidpackageinstallationstep.h"
#include "androidpotentialkit.h"
#include "androidqmltoolingsupport.h"
#include "androidqtversionfactory.h"
#include "androidrunconfiguration.h"
#include "androidruncontrol.h"
......@@ -88,6 +89,7 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
addAutoReleasedObject(new Internal::AndroidDeviceFactory);
addAutoReleasedObject(new Internal::AndroidPotentialKit);
addAutoReleasedObject(new Internal::JavaEditorFactory);
addAutoReleasedObject(new AndroidPackageInstallationFactory);
KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation);
addAutoReleasedObject(new Internal::AndroidManifestEditorFactory);
......
......@@ -146,6 +146,7 @@ bool CMakeRunConfiguration::fromMap(const QVariantMap &map)
extraAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(ct.workingDirectory);
}
setDisplayName(defaultDisplayName());
setDefaultDisplayName(defaultDisplayName());
return true;
......
/****************************************************************************
**
** 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
/****************************************************************************
**
** 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
......@@ -25,10 +25,10 @@
#include "androidqmakebuildconfigurationfactory.h"
#include "qmakeandroidbuildapkstep.h"
#include "androidpackageinstallationstep.h"
#include <android/androidmanager.h>
#include <android/androidconfigurations.h>
#include <android/androidmanager.h>
#include <android/androidpackageinstallationstep.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/buildsteplist.h>
......
......@@ -23,7 +23,6 @@
**
****************************************************************************/
#include "androidpackageinstallationstep.h"
#include "qmakeandroidbuildapkstep.h"
#include "qmakeandroidsupport.h"
#include "androidqmakebuildconfigurationfactory.h"
......
......@@ -6,8 +6,6 @@ DEFINES += \
HEADERS += \
androidextralibrarylistmodel.h \
androidpackageinstallationfactory.h \
androidpackageinstallationstep.h \
createandroidmanifestwizard.h \
qmakeandroidsupport.h \
qmakeandroidrunconfiguration.h \
......@@ -19,8 +17,6 @@ HEADERS += \
SOURCES += \
androidextralibrarylistmodel.cpp \
androidpackageinstallationfactory.cpp \
androidpackageinstallationstep.cpp \
createandroidmanifestwizard.cpp \
qmakeandroidsupport.cpp \
qmakeandroidrunconfiguration.cpp \
......@@ -31,6 +27,3 @@ SOURCES += \
qmakeandroidsupportplugin.cpp
FORMS += qmakeandroidbuildapkwidget.ui
RESOURCES +=
......@@ -18,10 +18,6 @@ QtcPlugin {
files: [
"androidextralibrarylistmodel.cpp",
"androidextralibrarylistmodel.h",
"androidpackageinstallationfactory.cpp",
"androidpackageinstallationfactory.h",
"androidpackageinstallationstep.cpp",
"androidpackageinstallationstep.h",
"createandroidmanifestwizard.cpp",
"createandroidmanifestwizard.h",
"qmakeandroidbuildapkstep.cpp",
......
......@@ -25,7 +25,6 @@
#include "qmakeandroidsupportplugin.h"
#include "androidpackageinstallationfactory.h"
#include "androidqmakebuildconfigurationfactory.h"
#include "qmakeandroidbuildapkstep.h"
#include "qmakeandroidrunfactories.h"
......@@ -52,7 +51,6 @@ bool QmakeAndroidSupportPlugin::initialize(const QStringList &arguments, QString
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
addAutoReleasedObject(new AndroidQmakeBuildConfigurationFactory);
addAutoReleasedObject(new AndroidPackageInstallationFactory);
addAutoReleasedObject(new QmakeAndroidBuildApkStepFactory);
addAutoReleasedObject(new QmakeAndroidRunConfigurationFactory);
addAutoReleasedObject(new QmakeAndroidSupport);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment