diff options
-rw-r--r-- | src/plugins/android/android.pro | 6 | ||||
-rw-r--r-- | src/plugins/android/android.qbs | 3 | ||||
-rw-r--r-- | src/plugins/android/android_dependencies.pri | 3 | ||||
-rw-r--r-- | src/plugins/android/androidconfigurations.cpp | 2 | ||||
-rw-r--r-- | src/plugins/android/androidgdbserverkitinformation.cpp | 26 | ||||
-rw-r--r-- | src/plugins/android/androidgdbserverkitinformation.h | 1 | ||||
-rw-r--r-- | src/plugins/android/androidplugin.cpp | 3 | ||||
-rw-r--r-- | src/plugins/android/androidqbspropertyprovider.cpp | 80 | ||||
-rw-r--r-- | src/plugins/android/androidqbspropertyprovider.h | 48 |
9 files changed, 160 insertions, 12 deletions
diff --git a/src/plugins/android/android.pro b/src/plugins/android/android.pro index 68dcc23245..49bec3a6b2 100644 --- a/src/plugins/android/android.pro +++ b/src/plugins/android/android.pro @@ -40,7 +40,8 @@ HEADERS += \ androidmanifesteditorfactory.h \ androidmanifesteditor.h \ androidmanifesteditorwidget.h \ - androidmanifestdocument.h + androidmanifestdocument.h \ + androidqbspropertyprovider.h SOURCES += \ androidconfigurations.cpp \ @@ -75,7 +76,8 @@ SOURCES += \ androidmanifesteditorfactory.cpp \ androidmanifesteditor.cpp \ androidmanifesteditorwidget.cpp \ - androidmanifestdocument.cpp + androidmanifestdocument.cpp \ + androidqbspropertyprovider.cpp FORMS += \ androidsettingswidget.ui \ diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs index aa6f64237d..231f3eef32 100644 --- a/src/plugins/android/android.qbs +++ b/src/plugins/android/android.qbs @@ -8,6 +8,7 @@ QtcPlugin { Depends { name: "Core" } Depends { name: "ProjectExplorer" } Depends { name: "Qt4ProjectManager" } + Depends { name: "QbsProjectManager" } Depends { name: "Debugger" } Depends { name: "QmlDebug" } Depends { name: "QtSupport" } @@ -72,6 +73,8 @@ QtcPlugin { "androidpackageinstallationstep.h", "androidplugin.cpp", "androidplugin.h", + "androidqbspropertyprovider.cpp", + "androidqbspropertyprovider.h", "androidqtversion.cpp", "androidqtversion.h", "androidqtversionfactory.cpp", diff --git a/src/plugins/android/android_dependencies.pri b/src/plugins/android/android_dependencies.pri index 5fe7ef6bee..f9459fe991 100644 --- a/src/plugins/android/android_dependencies.pri +++ b/src/plugins/android/android_dependencies.pri @@ -6,4 +6,5 @@ QTC_PLUGIN_DEPENDS += \ qt4projectmanager \ qtsupport \ texteditor \ - analyzerbase + analyzerbase \ + qbsprojectmanager diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index a1a51912bd..639cdad1b3 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -721,7 +721,7 @@ QStringList AndroidConfigurations::makeExtraSearchDirectories() const return m_config.makeExtraSearchDirectories; } -bool equalKits(Kit *a, Kit *b) +static bool equalKits(Kit *a, Kit *b) { return ToolChainKitInformation::toolChain(a) == ToolChainKitInformation::toolChain(b) && QtSupport::QtKitInformation::qtVersion(a) == QtSupport::QtKitInformation::qtVersion(b); diff --git a/src/plugins/android/androidgdbserverkitinformation.cpp b/src/plugins/android/androidgdbserverkitinformation.cpp index a7fef845e6..214a2fc183 100644 --- a/src/plugins/android/androidgdbserverkitinformation.cpp +++ b/src/plugins/android/androidgdbserverkitinformation.cpp @@ -42,12 +42,13 @@ #include <QVBoxLayout> #include <QFormLayout> +#include <qtsupport/baseqtversion.h> +#include <qtsupport/qtkitinformation.h> + using namespace Android; using namespace Android::Internal; -namespace { -static const char ANDROIDGDBSERVER_INFORMATION[] = "Android.GdbServer.Information"; -} +static const char ANDROID_GDBSERVER_INFORMATION[] = "Android.GdbServer.Information"; AndroidGdbServerKitInformation::AndroidGdbServerKitInformation() { @@ -55,7 +56,7 @@ AndroidGdbServerKitInformation::AndroidGdbServerKitInformation() Core::Id AndroidGdbServerKitInformation::dataId() const { - return Core::Id(ANDROIDGDBSERVER_INFORMATION); + return Core::Id(ANDROID_GDBSERVER_INFORMATION); } unsigned int AndroidGdbServerKitInformation::priority() const @@ -84,14 +85,25 @@ ProjectExplorer::KitConfigWidget *AndroidGdbServerKitInformation::createConfigWi return new AndroidGdbServerKitInformationWidget(kit, isSticky(kit)); } +bool AndroidGdbServerKitInformation::isAndroidKit(const ProjectExplorer::Kit *kit) +{ + QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(kit); + ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(kit); + if (qt && tc) + return qt->type() == QLatin1String(Android::Constants::ANDROIDQT) + && tc->type() == QLatin1String(Android::Constants::ANDROID_TOOLCHAIN_TYPE); + return false; + +} + Utils::FileName AndroidGdbServerKitInformation::gdbServer(const ProjectExplorer::Kit *kit) { - return Utils::FileName::fromString(kit->value(Core::Id(ANDROIDGDBSERVER_INFORMATION)).toString()); + return Utils::FileName::fromString(kit->value(Core::Id(ANDROID_GDBSERVER_INFORMATION)).toString()); } void AndroidGdbServerKitInformation::setGdbSever(ProjectExplorer::Kit *kit, const Utils::FileName &gdbServerCommand) { - kit->setValue(Core::Id(ANDROIDGDBSERVER_INFORMATION), + kit->setValue(Core::Id(ANDROID_GDBSERVER_INFORMATION), gdbServerCommand.toString()); } @@ -106,7 +118,7 @@ Utils::FileName AndroidGdbServerKitInformation::autoDetect(ProjectExplorer::Kit void AndroidGdbServerKitInformation::makeSticky(ProjectExplorer::Kit *k) { - k->makeSticky(ANDROIDGDBSERVER_INFORMATION); + k->makeSticky(ANDROID_GDBSERVER_INFORMATION); } /////////////// diff --git a/src/plugins/android/androidgdbserverkitinformation.h b/src/plugins/android/androidgdbserverkitinformation.h index 54a6234920..f81ce85f90 100644 --- a/src/plugins/android/androidgdbserverkitinformation.h +++ b/src/plugins/android/androidgdbserverkitinformation.h @@ -82,6 +82,7 @@ public: ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *) const; + static bool isAndroidKit(const ProjectExplorer::Kit *kit); static Utils::FileName gdbServer(const ProjectExplorer::Kit *kit); static void setGdbSever(ProjectExplorer::Kit *kit, const Utils::FileName &gdbServerCommand); static Utils::FileName autoDetect(ProjectExplorer::Kit *kit); diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp index d71dbc5272..6608d25435 100644 --- a/src/plugins/android/androidplugin.cpp +++ b/src/plugins/android/androidplugin.cpp @@ -44,6 +44,7 @@ #include "androiddeployconfiguration.h" #include "androidgdbserverkitinformation.h" #include "androidmanifesteditorfactory.h" +#include "androidqbspropertyprovider.h" #include <coreplugin/mimedatabase.h> #include <coreplugin/icore.h> @@ -97,7 +98,7 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa connect(ProjectExplorer::DeviceManager::instance(), SIGNAL(devicesLoaded()), this, SLOT(updateDevice())); - + addAutoReleasedObject(new Internal::AndroidQBSPropertyProvider); return true; } diff --git a/src/plugins/android/androidqbspropertyprovider.cpp b/src/plugins/android/androidqbspropertyprovider.cpp new file mode 100644 index 0000000000..3976eaf3c2 --- /dev/null +++ b/src/plugins/android/androidqbspropertyprovider.cpp @@ -0,0 +1,80 @@ +/************************************************************************** +** +** Copyright (c) 2013 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 "androidqbspropertyprovider.h" + +#include "androidconfigurations.h" +#include "androidconstants.h" +#include "androidgdbserverkitinformation.h" +#include "androidtoolchain.h" + +#include <qbsprojectmanager/qbsconstants.h> + +namespace Android { +namespace Internal { + +// QBS Android specific settings: +const QLatin1String CPP_ANDROID_SDK_PATH("cpp.androidSdkPath"); +const QLatin1String CPP_ANDROID_NDK_PATH("cpp.androidNdkPath"); +const QLatin1String CPP_ANDROID_TOOLCHAIN_VERSION("cpp.androidToolchainVersion"); +const QLatin1String CPP_ANDROID_TOOLCHAIN_HOST("cpp.androidToolchainHost"); +const QLatin1String CPP_ANDROID_TOOLCHAIN_PREFIX("cpp.androidToolchainPrefix"); +const QLatin1String CPP_ANDROID_GDBSERVER("cpp.androidGdbServer"); + +bool AndroidQBSPropertyProvider::canHandle(const ProjectExplorer::Kit *kit) const +{ + return AndroidGdbServerKitInformation::isAndroidKit(kit); +} + +QVariantMap AndroidQBSPropertyProvider::properties(const ProjectExplorer::Kit *kit, const QVariantMap &defaultData) const +{ + Q_ASSERT(AndroidGdbServerKitInformation::isAndroidKit(kit)); + + QVariantMap qbsProperties = defaultData; + QStringList targetOSs(defaultData[QLatin1String(QbsProjectManager::Constants::QBS_TARGETOS)].toStringList()); + if (!targetOSs.contains(QLatin1String("android"))) + qbsProperties[QLatin1String(QbsProjectManager::Constants::QBS_TARGETOS)] = QStringList() << QLatin1String("android") + << targetOSs; + + const AndroidConfig &config = AndroidConfigurations::instance().config(); + AndroidToolChain *tc = static_cast<AndroidToolChain*>(ProjectExplorer::ToolChainKitInformation::toolChain(kit)); + qbsProperties[CPP_ANDROID_SDK_PATH] = config.sdkLocation.toString(); + qbsProperties[CPP_ANDROID_NDK_PATH] = config.ndkLocation.toString(); + qbsProperties[CPP_ANDROID_TOOLCHAIN_VERSION] = tc->ndkToolChainVersion(); + qbsProperties[CPP_ANDROID_TOOLCHAIN_HOST] = config.toolchainHost; + qbsProperties[CPP_ANDROID_TOOLCHAIN_PREFIX] = AndroidConfigurations::toolchainPrefix(tc->targetAbi().architecture()); + qbsProperties[CPP_ANDROID_GDBSERVER] = tc->suggestedGdbServer().toString(); +#warning TODO: Find a way to extract ANDROID_ARCHITECTURE from Qt mkspec +// qbsProperties[QbsProjectManager::Constants::QBS_ARCHITECTURE] = ... + + return qbsProperties; +} + +} // namespace Internal +} // namespace Android diff --git a/src/plugins/android/androidqbspropertyprovider.h b/src/plugins/android/androidqbspropertyprovider.h new file mode 100644 index 0000000000..cebd638665 --- /dev/null +++ b/src/plugins/android/androidqbspropertyprovider.h @@ -0,0 +1,48 @@ +/************************************************************************** +** +** Copyright (c) 2013 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 ANDROIDQBSPROPERTYPROVIDER_H +#define ANDROIDQBSPROPERTYPROVIDER_H + +#include <qbsprojectmanager/propertyprovider.h> + +namespace Android { +namespace Internal { + +class AndroidQBSPropertyProvider : public QbsProjectManager::PropertyProvider +{ +public: + virtual bool canHandle(const ProjectExplorer::Kit *kit) const; + virtual QVariantMap properties(const ProjectExplorer::Kit *kit, const QVariantMap &defaultData) const; +}; + +} // namespace Internal +} // namespace Android + +#endif // ANDROIDQBSPROPERTYPROVIDER_H |