diff options
-rw-r--r-- | src/plugins/android/android.pro | 8 | ||||
-rw-r--r-- | src/plugins/android/android.qbs | 4 | ||||
-rw-r--r-- | src/plugins/android/android_global.h | 41 | ||||
-rw-r--r-- | src/plugins/android/androiddebugsupport.cpp | 24 | ||||
-rw-r--r-- | src/plugins/android/androidmanager.cpp | 14 | ||||
-rw-r--r-- | src/plugins/android/androidmanager.h | 3 | ||||
-rw-r--r-- | src/plugins/android/androidplugin.cpp | 2 | ||||
-rw-r--r-- | src/plugins/android/androidqtsupport.h | 70 | ||||
-rw-r--r-- | src/plugins/android/qmakeandroidsupport.cpp | 75 | ||||
-rw-r--r-- | src/plugins/android/qmakeandroidsupport.h | 49 |
10 files changed, 274 insertions, 16 deletions
diff --git a/src/plugins/android/android.pro b/src/plugins/android/android.pro index 2004323830..83644462bb 100644 --- a/src/plugins/android/android.pro +++ b/src/plugins/android/android.pro @@ -6,6 +6,7 @@ else:ANDROID_EXPERIMENTAL_STR="false" QT += xml network HEADERS += \ + androidqtsupport.h \ androidconstants.h \ androidconfigurations.h \ androidmanager.h \ @@ -50,7 +51,9 @@ HEADERS += \ javaautocompleter.h \ javacompletionassistprovider.h \ javafilewizard.h \ - avddialog.h + avddialog.h \ + android_global.h \ + qmakeandroidsupport.h SOURCES += \ androidconfigurations.cpp \ @@ -95,7 +98,8 @@ SOURCES += \ javaautocompleter.cpp \ javacompletionassistprovider.cpp \ javafilewizard.cpp \ - avddialog.cpp + avddialog.cpp \ + qmakeandroidsupport.cpp FORMS += \ androidsettingswidget.ui \ diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs index 14dc80fd70..ae0371c960 100644 --- a/src/plugins/android/android.qbs +++ b/src/plugins/android/android.qbs @@ -20,6 +20,7 @@ QtcPlugin { pluginspecreplacements: ({"ANDROID_EXPERIMENTAL_STR": (enable ? "false": "true")}) files: [ + "android_global.h", "addnewavddialog.ui", "android.qrc", "androidanalyzesupport.cpp", @@ -71,6 +72,7 @@ QtcPlugin { "androidplugin.h", "androidpotentialkit.cpp", "androidpotentialkit.h", + "androidqtsupport.h", "androidqtversion.cpp", "androidqtversion.h", "androidqtversionfactory.cpp", @@ -114,5 +116,7 @@ QtcPlugin { "javaindenter.h", "javaparser.cpp", "javaparser.h", + "qmakeandroidsupport.cpp", + "qmakeandroidsupport.h", ] } diff --git a/src/plugins/android/android_global.h b/src/plugins/android/android_global.h new file mode 100644 index 0000000000..6f96e4190b --- /dev/null +++ b/src/plugins/android/android_global.h @@ -0,0 +1,41 @@ +/************************************************************************** +** +** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com> +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef ANDROID_GLOBAL_H +#define ANDROID_GLOBAL_H + +#include <qglobal.h> + +#if defined(ANDROID_LIBRARY) +# define ANDROID_EXPORT Q_DECL_EXPORT +#else +# define ANDROID_EXPORT Q_DECL_IMPORT +#endif + +#endif // ANDROID_GLOBAL_H diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp index 141a609297..f9f70595f6 100644 --- a/src/plugins/android/androiddebugsupport.cpp +++ b/src/plugins/android/androiddebugsupport.cpp @@ -32,6 +32,7 @@ #include "androidglobal.h" #include "androidrunner.h" #include "androidmanager.h" +#include "androidqtsupport.h" #include <debugger/debuggerengine.h> #include <debugger/debuggerplugin.h> @@ -40,19 +41,18 @@ #include <debugger/debuggerrunner.h> #include <debugger/debuggerstartparameters.h> +#include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/project.h> #include <projectexplorer/target.h> #include <projectexplorer/toolchain.h> -#include <qmakeprojectmanager/qmakebuildconfiguration.h> -#include <qmakeprojectmanager/qmakenodes.h> -#include <qmakeprojectmanager/qmakeproject.h> + #include <qtsupport/qtkitinformation.h> -#include <QDir> +#include <QDirIterator> #include <QTcpServer> using namespace Debugger; using namespace ProjectExplorer; -using namespace QmakeProjectManager; namespace Android { namespace Internal { @@ -85,7 +85,6 @@ static QStringList qtSoPaths(QtSupport::BaseQtVersion *qtVersion) RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *runConfig, QString *errorMessage) { Target *target = runConfig->target(); - QmakeProject *project = static_cast<QmakeProject *>(target->project()); DebuggerStartParameters params; params.startMode = AttachToRemoteServer; @@ -101,12 +100,9 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration * params.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString(); if (ToolChain *tc = ToolChainKitInformation::toolChain(kit)) params.toolChainAbi = tc->targetAbi(); - params.executable = project->rootQmakeProjectNode()->buildDir() + QLatin1String("/app_process"); + params.executable = target->activeBuildConfiguration()->buildDirectory().toString() + QLatin1String("/app_process"); params.remoteChannel = runConfig->remoteChannel(); - params.solibSearchPath.clear(); - QList<QmakeProFileNode *> nodes = project->allProFiles(); - foreach (QmakeProFileNode *node, nodes) - params.solibSearchPath.append(node->targetInformation().buildDir); + params.solibSearchPath = AndroidManager::androidQtSupport(target)->soLibSearchPath(target); QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit); params.solibSearchPath.append(qtSoPaths(version)); } @@ -118,9 +114,9 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration * params.qmlServerAddress = server.serverAddress().toString(); params.remoteSetupNeeded = true; //TODO: Not sure if these are the right paths. - params.projectSourceDirectory = project->projectDirectory().toString(); - params.projectSourceFiles = project->files(QmakeProject::ExcludeGeneratedFiles); - params.projectBuildDirectory = project->rootQmakeProjectNode()->buildDir(); + params.projectSourceDirectory = target->project()->projectDirectory().toString(); + params.projectSourceFiles = target->project()->files(Project::ExcludeGeneratedFiles); + params.projectBuildDirectory = target->activeBuildConfiguration()->buildDirectory().toString(); } DebuggerRunControl * const debuggerRunControl diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 5a95e59cd9..cd22d4443c 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -34,10 +34,14 @@ #include "androidglobal.h" #include "androidtoolchain.h" #include "androiddeployqtstep.h" +#include "androidqtsupport.h" #include <coreplugin/documentmanager.h> #include <coreplugin/messagemanager.h> #include <coreplugin/icore.h> + +#include <extensionsystem/pluginmanager.h> + #include <projectexplorer/projectexplorer.h> #include <projectexplorer/session.h> #include <projectexplorer/target.h> @@ -674,5 +678,15 @@ bool AndroidManager::checkForQt51Files(Utils::FileName fileName) return dstVersionDoc.documentElement().attribute(QLatin1String("value")).toDouble() < 5.2; } +AndroidQtSupport *AndroidManager::androidQtSupport(ProjectExplorer::Target *target) +{ + QList<AndroidQtSupport *> providerList = ExtensionSystem::PluginManager::getObjects<AndroidQtSupport>(); + foreach (AndroidQtSupport *provider, providerList) { + if (provider->canHandle(target)) + return provider; + } + return 0; +} + } // namespace Internal } // namespace Android diff --git a/src/plugins/android/androidmanager.h b/src/plugins/android/androidmanager.h index d4fe296c58..44eb9b57ab 100644 --- a/src/plugins/android/androidmanager.h +++ b/src/plugins/android/androidmanager.h @@ -40,6 +40,7 @@ namespace ProjectExplorer { class Target; } namespace Android { +class AndroidQtSupport; namespace Internal { class AndroidManager : public QObject @@ -106,6 +107,8 @@ public: static bool checkKeystorePassword(const QString &keystorePath, const QString &keystorePasswd); static bool checkCertificatePassword(const QString &keystorePath, const QString &keystorePasswd, const QString &alias, const QString &certificatePasswd); static bool checkForQt51Files(Utils::FileName fileName); + static AndroidQtSupport *androidQtSupport(ProjectExplorer::Target *target); + private: static void raiseError(const QString &reason); static bool openXmlFile(QDomDocument &doc, const Utils::FileName &fileName); diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp index 8f370a2ae5..37b6180f7e 100644 --- a/src/plugins/android/androidplugin.cpp +++ b/src/plugins/android/androidplugin.cpp @@ -47,6 +47,7 @@ #include "javaeditorfactory.h" #include "javacompletionassistprovider.h" #include "javafilewizard.h" +#include "qmakeandroidsupport.h" #ifdef HAVE_QBS # include "androidqbspropertyprovider.h" #endif @@ -85,6 +86,7 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa addAutoReleasedObject(new Internal::JavaEditorFactory); addAutoReleasedObject(new Internal::JavaCompletionAssistProvider); addAutoReleasedObject(new Internal::JavaFileWizard); + addAutoReleasedObject(new Internal::QmakeAndroidSupport); ProjectExplorer::KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation); // AndroidManifest.xml editor diff --git a/src/plugins/android/androidqtsupport.h b/src/plugins/android/androidqtsupport.h new file mode 100644 index 0000000000..8e60612151 --- /dev/null +++ b/src/plugins/android/androidqtsupport.h @@ -0,0 +1,70 @@ +/************************************************************************** +** +** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com> +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef ANDROIDSUPPORT_H +#define ANDROIDSUPPORT_H + +#include <QObject> +#include <QList> + +#include <projectexplorer/project.h> + +#include <utils/fileutils.h> + +#include "android_global.h" + +namespace ProjectExplorer { + class Target; + class DeployConfiguration; + class ProcessParameters; +} + +namespace Android { + +class ANDROID_EXPORT AndroidQtSupport : public QObject +{ + Q_OBJECT + +public: + enum BuildType { + DebugBuild, + ReleaseBuildUnsigned, + ReleaseBuildSigned + }; + + +public: + virtual bool canHandle(const ProjectExplorer::Target *target) const = 0; + virtual QStringList soLibSearchPath(const ProjectExplorer::Target *target) const = 0; +}; + +} // namespace QtSupport + + +#endif // ANDROIDSUPPORT_H diff --git a/src/plugins/android/qmakeandroidsupport.cpp b/src/plugins/android/qmakeandroidsupport.cpp new file mode 100644 index 0000000000..5c25ecfbae --- /dev/null +++ b/src/plugins/android/qmakeandroidsupport.cpp @@ -0,0 +1,75 @@ +/************************************************************************** +** +** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com> +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "qmakeandroidsupport.h" + +#include "androidconstants.h" +#include "androidpackageinstallationstep.h" + +#include <projectexplorer/buildmanager.h> +#include <projectexplorer/buildsteplist.h> +#include <projectexplorer/deployconfiguration.h> +#include <projectexplorer/projectexplorer.h> +#include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/target.h> +#include <qtsupport/qtkitinformation.h> + +#include <qmakeprojectmanager/qmakebuildconfiguration.h> +#include <qmakeprojectmanager/qmakenodes.h> +#include <qmakeprojectmanager/qmakeproject.h> +#include <qmakeprojectmanager/qmakestep.h> + +using namespace QmakeProjectManager; // The class will eventually be moved there anyway + +namespace Android { +namespace Internal { + +bool QmakeAndroidSupport::canHandle(const ProjectExplorer::Target *target) const +{ + return qobject_cast<QmakeProject*>(target->project()); +} + +QStringList QmakeAndroidSupport::soLibSearchPath(const ProjectExplorer::Target *target) const +{ + QStringList res; + QmakeBuildConfiguration *bc = qobject_cast<QmakeBuildConfiguration*>(target->activeBuildConfiguration()); + QmakeProject *project = qobject_cast<QmakeProject*>(target->project()); + Q_ASSERT(project); + if (!project) + return res; + + foreach (QmakeProFileNode *node, project->allProFiles()) { + res << node->buildDir(bc); + } + + return res; +} + +} // namespace Internal +} // namespace Android diff --git a/src/plugins/android/qmakeandroidsupport.h b/src/plugins/android/qmakeandroidsupport.h new file mode 100644 index 0000000000..65094d3727 --- /dev/null +++ b/src/plugins/android/qmakeandroidsupport.h @@ -0,0 +1,49 @@ +/************************************************************************** +** +** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com> +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMAKEANDROIDSUPPORT_H +#define QMAKEANDROIDSUPPORT_H + +#include "androidqtsupport.h" + +namespace Android { +namespace Internal { + +class QmakeAndroidSupport : public Android::AndroidQtSupport +{ + Q_OBJECT +public: + bool canHandle(const ProjectExplorer::Target *target) const; + QStringList soLibSearchPath(const ProjectExplorer::Target *target) const; +}; + +} // namespace Internal +} // namespace Android + +#endif // QMAKEANDROIDSUPPORT_H |