diff --git a/src/plugins/android/android.pro b/src/plugins/android/android.pro index f078e974617..9d2803e551c 100644 --- a/src/plugins/android/android.pro +++ b/src/plugins/android/android.pro @@ -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 \ diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs index 539a35f193c..d9cc7e7a874 100644 --- a/src/plugins/android/android.qbs +++ b/src/plugins/android/android.qbs @@ -68,6 +68,8 @@ Project { "androidmanifesteditorfactory.h", "androidmanifesteditorwidget.cpp", "androidmanifesteditorwidget.h", + "androidpackageinstallationstep.cpp", + "androidackageinstallationstep.h", "androidplugin.cpp", "androidplugin.h", "androidpotentialkit.cpp", diff --git a/src/plugins/android/androidconstants.h b/src/plugins/android/androidconstants.h index a76d830b205..4be9ea8afca 100644 --- a/src/plugins/android/androidconstants.h +++ b/src/plugins/android/androidconstants.h @@ -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 diff --git a/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp b/src/plugins/android/androidpackageinstallationstep.cpp similarity index 65% rename from src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp rename to src/plugins/android/androidpackageinstallationstep.cpp index b9280cc7e0d..c8fcb74501c 100644 --- a/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.cpp +++ b/src/plugins/android/androidpackageinstallationstep.cpp @@ -25,8 +25,8 @@ #include "androidpackageinstallationstep.h" -#include -#include +#include "androidconstants.h" +#include "androidmanager.h" #include #include @@ -35,17 +35,19 @@ #include #include #include + #include -#include #include -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 &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 &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 &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(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 diff --git a/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.h b/src/plugins/android/androidpackageinstallationstep.h similarity index 84% rename from src/plugins/qmakeandroidsupport/androidpackageinstallationstep.h rename to src/plugins/android/androidpackageinstallationstep.h index 3f163a0e276..42edd7f01e7 100644 --- a/src/plugins/qmakeandroidsupport/androidpackageinstallationstep.h +++ b/src/plugins/android/androidpackageinstallationstep.h @@ -25,13 +25,14 @@ #pragma once +#include "android_global.h" + #include #include -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 diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp index d77512fda61..b9fca126113 100644 --- a/src/plugins/android/androidplugin.cpp +++ b/src/plugins/android/androidplugin.cpp @@ -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); diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp index 8da4ccf5e6f..339e9ca723d 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp @@ -146,6 +146,7 @@ bool CMakeRunConfiguration::fromMap(const QVariantMap &map) extraAspect()->setDefaultWorkingDirectory(ct.workingDirectory); } + setDisplayName(defaultDisplayName()); setDefaultDisplayName(defaultDisplayName()); return true; diff --git a/src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.cpp b/src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.cpp deleted file mode 100644 index 9e7b27ba49d..00000000000 --- a/src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 BogDan Vatra -** 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 -#include -#include - -using namespace ProjectExplorer; - -namespace QmakeAndroidSupport { -namespace Internal { - -AndroidPackageInstallationFactory::AndroidPackageInstallationFactory() -{ - registerStep(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 diff --git a/src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.h b/src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.h deleted file mode 100644 index 9b4a2f10d44..00000000000 --- a/src/plugins/qmakeandroidsupport/androidpackageinstallationfactory.h +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 BogDan Vatra -** 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 - -namespace QmakeAndroidSupport { -namespace Internal { - -class AndroidPackageInstallationFactory: public ProjectExplorer::BuildStepFactory -{ - Q_OBJECT - -public: - AndroidPackageInstallationFactory(); - - bool canHandle(ProjectExplorer::BuildStepList *bsl) const override; -}; - -} // namespace Internal -} // namespace QmakeAndroidSupport diff --git a/src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.cpp b/src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.cpp index ef0ccca475a..99ddfa1972a 100644 --- a/src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.cpp +++ b/src/plugins/qmakeandroidsupport/androidqmakebuildconfigurationfactory.cpp @@ -25,10 +25,10 @@ #include "androidqmakebuildconfigurationfactory.h" #include "qmakeandroidbuildapkstep.h" -#include "androidpackageinstallationstep.h" -#include #include +#include +#include #include #include diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp index 42ff3b047cb..92f1a5d3f6d 100644 --- a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp +++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp @@ -23,7 +23,6 @@ ** ****************************************************************************/ -#include "androidpackageinstallationstep.h" #include "qmakeandroidbuildapkstep.h" #include "qmakeandroidsupport.h" #include "androidqmakebuildconfigurationfactory.h" diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro index 04a8cae51a5..875375e7d3b 100644 --- a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro +++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.pro @@ -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 += - diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs index 1766420659c..a18a23d5a04 100644 --- a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs +++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.qbs @@ -18,10 +18,6 @@ QtcPlugin { files: [ "androidextralibrarylistmodel.cpp", "androidextralibrarylistmodel.h", - "androidpackageinstallationfactory.cpp", - "androidpackageinstallationfactory.h", - "androidpackageinstallationstep.cpp", - "androidpackageinstallationstep.h", "createandroidmanifestwizard.cpp", "createandroidmanifestwizard.h", "qmakeandroidbuildapkstep.cpp", diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.cpp index a47ab1d4d95..d9b7566991a 100644 --- a/src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.cpp +++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupportplugin.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);