forked from qt-creator/qt-creator
Export android specific settings to QBS
Change-Id: I3640272dc027047a1d27a2b55329c9f5093e8f1f Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -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 \
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -6,4 +6,5 @@ QTC_PLUGIN_DEPENDS += \
|
||||
qt4projectmanager \
|
||||
qtsupport \
|
||||
texteditor \
|
||||
analyzerbase
|
||||
analyzerbase \
|
||||
qbsprojectmanager
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
///////////////
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
80
src/plugins/android/androidqbspropertyprovider.cpp
Normal file
80
src/plugins/android/androidqbspropertyprovider.cpp
Normal file
@@ -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
|
||||
48
src/plugins/android/androidqbspropertyprovider.h
Normal file
48
src/plugins/android/androidqbspropertyprovider.h
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user