forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.7'
Conflicts: qtcreator.pri qtcreator.qbs Change-Id: I84145b02bf4f80848c0c1d762de34738f08bb78f
This commit is contained in:
@@ -37,7 +37,8 @@ HEADERS += \
|
||||
javaparser.h \
|
||||
androidplugin.h \
|
||||
androiddevicefactory.h \
|
||||
androiddevice.h
|
||||
androiddevice.h \
|
||||
androidgdbserverkitinformation.h
|
||||
|
||||
SOURCES += \
|
||||
androidconfigurations.cpp \
|
||||
@@ -65,8 +66,8 @@ SOURCES += \
|
||||
javaparser.cpp \
|
||||
androidplugin.cpp \
|
||||
androiddevicefactory.cpp \
|
||||
androiddevice.cpp
|
||||
|
||||
androiddevice.cpp \
|
||||
androidgdbserverkitinformation.cpp
|
||||
|
||||
FORMS += \
|
||||
androidsettingswidget.ui \
|
||||
|
||||
@@ -41,6 +41,8 @@ QtcPlugin {
|
||||
"androiddevice.h",
|
||||
"androiddevicefactory.cpp",
|
||||
"androiddevicefactory.h",
|
||||
"androidgdbserverkitinformation.cpp",
|
||||
"androidgdbserverkitinformation.h",
|
||||
"androidglobal.h",
|
||||
"androidmanager.cpp",
|
||||
"androidmanager.h",
|
||||
|
||||
@@ -73,7 +73,6 @@ namespace {
|
||||
const QLatin1String OpenJDKLocationKey("OpenJDKLocation");
|
||||
const QLatin1String KeystoreLocationKey("KeystoreLocation");
|
||||
const QLatin1String PartitionSizeKey("PartitionSize");
|
||||
const QLatin1String NDKGccVersionRegExp("-\\d[\\.\\d]+");
|
||||
const QLatin1String ArmToolchainPrefix("arm-linux-androideabi");
|
||||
const QLatin1String X86ToolchainPrefix("x86");
|
||||
const QLatin1String ArmToolsPrefix("arm-linux-androideabi");
|
||||
@@ -95,6 +94,15 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
Abi::Architecture AndroidConfigurations::architectureForToolChainPrefix(const QString& toolchainprefix)
|
||||
{
|
||||
if (toolchainprefix == ArmToolchainPrefix)
|
||||
return Abi::ArmArchitecture;
|
||||
if (toolchainprefix == X86ToolchainPrefix)
|
||||
return Abi::X86Architecture;
|
||||
return Abi::UnknownArchitecture;
|
||||
}
|
||||
|
||||
QLatin1String AndroidConfigurations::toolchainPrefix(Abi::Architecture architecture)
|
||||
{
|
||||
switch (architecture) {
|
||||
@@ -122,10 +130,6 @@ QLatin1String AndroidConfigurations::toolsPrefix(Abi::Architecture architecture)
|
||||
AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
{
|
||||
// user settings
|
||||
armGdbLocation = FileName::fromString(settings.value(ArmGdbLocationKey).toString());
|
||||
armGdbserverLocation = FileName::fromString(settings.value(ArmGdbserverLocationKey).toString());
|
||||
x86GdbLocation = FileName::fromString(settings.value(X86GdbLocationKey).toString());
|
||||
x86GdbserverLocation = FileName::fromString(settings.value(X86GdbserverLocationKey).toString());
|
||||
partitionSize = settings.value(PartitionSizeKey, 1024).toInt();
|
||||
sdkLocation = FileName::fromString(settings.value(SDKLocationKey).toString());
|
||||
ndkLocation = FileName::fromString(settings.value(NDKLocationKey).toString());
|
||||
@@ -133,14 +137,6 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
openJDKLocation = FileName::fromString(settings.value(OpenJDKLocationKey).toString());
|
||||
keystoreLocation = FileName::fromString(settings.value(KeystoreLocationKey).toString());
|
||||
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
const QString &value = settings.value(NDKToolchainVersionKey).toString();
|
||||
if (versionRegExp.exactMatch(value))
|
||||
ndkToolchainVersion = value;
|
||||
else
|
||||
ndkToolchainVersion = value.mid(versionRegExp.indexIn(value)+1);
|
||||
// user settings
|
||||
|
||||
PersistentSettingsReader reader;
|
||||
if (reader.load(FileName::fromString(sdkSettingsFileName()))
|
||||
&& settings.value(changeTimeStamp).toInt() != QFileInfo(sdkSettingsFileName()).lastModified().toMSecsSinceEpoch() / 1000) {
|
||||
@@ -150,25 +146,6 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
antLocation = FileName::fromString(reader.restoreValue(AntLocationKey).toString());
|
||||
openJDKLocation = FileName::fromString(reader.restoreValue(OpenJDKLocationKey).toString());
|
||||
keystoreLocation = FileName::fromString(reader.restoreValue(KeystoreLocationKey).toString());
|
||||
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
const QString &value = reader.restoreValue(NDKToolchainVersionKey).toString();
|
||||
if (versionRegExp.exactMatch(value))
|
||||
ndkToolchainVersion = value;
|
||||
else
|
||||
ndkToolchainVersion = value.mid(versionRegExp.indexIn(value)+1);
|
||||
|
||||
if (armGdbLocation.isEmpty())
|
||||
armGdbLocation = FileName::fromString(reader.restoreValue(ArmGdbLocationKey).toString());
|
||||
|
||||
if (armGdbserverLocation.isEmpty())
|
||||
armGdbserverLocation = FileName::fromString(reader.restoreValue(ArmGdbserverLocationKey).toString());
|
||||
|
||||
if (x86GdbLocation.isEmpty())
|
||||
x86GdbLocation = FileName::fromString(reader.restoreValue(X86GdbLocationKey).toString());
|
||||
|
||||
if (x86GdbserverLocation.isEmpty())
|
||||
x86GdbserverLocation = FileName::fromString(reader.restoreValue(X86GdbserverLocationKey).toString());
|
||||
// persistent settings
|
||||
}
|
||||
|
||||
@@ -188,14 +165,9 @@ void AndroidConfig::save(QSettings &settings) const
|
||||
// user settings
|
||||
settings.setValue(SDKLocationKey, sdkLocation.toString());
|
||||
settings.setValue(NDKLocationKey, ndkLocation.toString());
|
||||
settings.setValue(NDKToolchainVersionKey, ndkToolchainVersion);
|
||||
settings.setValue(AntLocationKey, antLocation.toString());
|
||||
settings.setValue(OpenJDKLocationKey, openJDKLocation.toString());
|
||||
settings.setValue(KeystoreLocationKey, keystoreLocation.toString());
|
||||
settings.setValue(ArmGdbLocationKey, armGdbLocation.toString());
|
||||
settings.setValue(ArmGdbserverLocationKey, armGdbserverLocation.toString());
|
||||
settings.setValue(X86GdbLocationKey, x86GdbLocation.toString());
|
||||
settings.setValue(X86GdbserverLocationKey, x86GdbserverLocation.toString());
|
||||
settings.setValue(PartitionSizeKey, partitionSize);
|
||||
}
|
||||
|
||||
@@ -240,25 +212,6 @@ QStringList AndroidConfigurations::sdkTargets(int minApiLevel) const
|
||||
return targets;
|
||||
}
|
||||
|
||||
QStringList AndroidConfigurations::ndkToolchainVersions() const
|
||||
{
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
QStringList result;
|
||||
FileName path = m_config.ndkLocation;
|
||||
QDirIterator it(path.appendPath(QLatin1String("toolchains")).toString(),
|
||||
QStringList() << QLatin1String("*"), QDir::Dirs);
|
||||
while (it.hasNext()) {
|
||||
const QString &fileName = it.next();
|
||||
int idx = versionRegExp.indexIn(fileName);
|
||||
if (idx == -1)
|
||||
continue;
|
||||
QString version = fileName.mid(idx+1);
|
||||
if (!result.contains(version))
|
||||
result.append(version);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::adbToolPath() const
|
||||
{
|
||||
FileName path = m_config.sdkLocation;
|
||||
@@ -296,71 +249,29 @@ FileName AndroidConfigurations::emulatorToolPath() const
|
||||
return path.appendPath(QLatin1String("tools/emulator" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::toolPath(Abi::Architecture architecture) const
|
||||
FileName AndroidConfigurations::toolPath(Abi::Architecture architecture, const QString &ndkToolChainVersion) const
|
||||
{
|
||||
FileName path = m_config.ndkLocation;
|
||||
return path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/%3/bin/%4")
|
||||
.arg(toolchainPrefix(architecture))
|
||||
.arg(m_config.ndkToolchainVersion)
|
||||
.arg(ndkToolChainVersion)
|
||||
.arg(ToolchainHost)
|
||||
.arg(toolsPrefix(architecture)));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::stripPath(Abi::Architecture architecture) const
|
||||
FileName AndroidConfigurations::stripPath(Abi::Architecture architecture, const QString &ndkToolChainVersion) const
|
||||
{
|
||||
return toolPath(architecture).append(QLatin1String("-strip" QTC_HOST_EXE_SUFFIX));
|
||||
return toolPath(architecture, ndkToolChainVersion).append(QLatin1String("-strip" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::readelfPath(Abi::Architecture architecture) const
|
||||
FileName AndroidConfigurations::readelfPath(Abi::Architecture architecture, const QString &ndkToolChainVersion) const
|
||||
{
|
||||
return toolPath(architecture).append(QLatin1String("-readelf" QTC_HOST_EXE_SUFFIX));
|
||||
return toolPath(architecture, ndkToolChainVersion).append(QLatin1String("-readelf" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::gccPath(Abi::Architecture architecture) const
|
||||
FileName AndroidConfigurations::gdbPath(Abi::Architecture architecture, const QString &ndkToolChainVersion) const
|
||||
{
|
||||
return toolPath(architecture).append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::gdbServerPath(Abi::Architecture architecture) const
|
||||
{
|
||||
FileName gdbServerPath;
|
||||
switch (architecture) {
|
||||
case Abi::ArmArchitecture:
|
||||
gdbServerPath = m_config.armGdbserverLocation;
|
||||
break;
|
||||
case Abi::X86Architecture:
|
||||
gdbServerPath = m_config.x86GdbserverLocation;
|
||||
break;
|
||||
default:
|
||||
gdbServerPath = FileName::fromString(Unknown);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!gdbServerPath.isEmpty())
|
||||
return gdbServerPath;
|
||||
FileName path = m_config.ndkLocation;
|
||||
return path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/gdbserver")
|
||||
.arg(toolchainPrefix(architecture))
|
||||
.arg(m_config.ndkToolchainVersion));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::gdbPath(Abi::Architecture architecture) const
|
||||
{
|
||||
FileName gdbPath;
|
||||
switch (architecture) {
|
||||
case Abi::ArmArchitecture:
|
||||
gdbPath = m_config.armGdbLocation;
|
||||
break;
|
||||
case Abi::X86Architecture:
|
||||
gdbPath = m_config.x86GdbLocation;
|
||||
break;
|
||||
default:
|
||||
gdbPath = FileName::fromString(Unknown);
|
||||
break;
|
||||
}
|
||||
if (!gdbPath.isEmpty())
|
||||
return gdbPath;
|
||||
return toolPath(architecture).append(QLatin1String("-gdb" QTC_HOST_EXE_SUFFIX));
|
||||
return toolPath(architecture, ndkToolChainVersion).append(QLatin1String("-gdb" QTC_HOST_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
FileName AndroidConfigurations::openJDKPath() const
|
||||
|
||||
@@ -66,12 +66,7 @@ public:
|
||||
|
||||
Utils::FileName sdkLocation;
|
||||
Utils::FileName ndkLocation;
|
||||
QString ndkToolchainVersion;
|
||||
Utils::FileName antLocation;
|
||||
Utils::FileName armGdbLocation;
|
||||
Utils::FileName armGdbserverLocation;
|
||||
Utils::FileName x86GdbLocation;
|
||||
Utils::FileName x86GdbserverLocation;
|
||||
Utils::FileName openJDKLocation;
|
||||
Utils::FileName keystoreLocation;
|
||||
unsigned partitionSize;
|
||||
@@ -93,20 +88,17 @@ public:
|
||||
AndroidConfig config() const { return m_config; }
|
||||
void setConfig(const AndroidConfig &config);
|
||||
QStringList sdkTargets(int minApiLevel = 0) const;
|
||||
QStringList ndkToolchainVersions() const;
|
||||
Utils::FileName adbToolPath() const;
|
||||
Utils::FileName androidToolPath() const;
|
||||
Utils::FileName antToolPath() const;
|
||||
Utils::FileName emulatorToolPath() const;
|
||||
Utils::FileName gccPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName gdbServerPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName gdbPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName gdbPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
|
||||
Utils::FileName openJDKPath() const;
|
||||
Utils::FileName keytoolPath() const;
|
||||
Utils::FileName jarsignerPath() const;
|
||||
Utils::FileName zipalignPath() const;
|
||||
Utils::FileName stripPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName readelfPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName stripPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
|
||||
Utils::FileName readelfPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
|
||||
QString getDeployDeviceSerialNumber(int *apiLevel) const;
|
||||
bool createAVD(const QString &target, const QString &name, int sdcardSize) const;
|
||||
bool removeAVD(const QString &name) const;
|
||||
@@ -115,6 +107,7 @@ public:
|
||||
QString startAVD(int *apiLevel, const QString &name = QString()) const;
|
||||
QString bestMatch(const QString &targetAPI) const;
|
||||
|
||||
static ProjectExplorer::Abi::Architecture architectureForToolChainPrefix(const QString &toolchainprefix);
|
||||
static QLatin1String toolchainPrefix(ProjectExplorer::Abi::Architecture architecture);
|
||||
static QLatin1String toolsPrefix(ProjectExplorer::Abi::Architecture architecture);
|
||||
|
||||
@@ -125,7 +118,7 @@ public slots:
|
||||
bool createAVD(int minApiLevel = 0) const;
|
||||
|
||||
private:
|
||||
Utils::FileName toolPath(ProjectExplorer::Abi::Architecture architecture) const;
|
||||
Utils::FileName toolPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
|
||||
Utils::FileName openJDKBinPath() const;
|
||||
|
||||
AndroidConfigurations(QObject *parent);
|
||||
|
||||
@@ -57,6 +57,7 @@ const char ANDROID_SETTINGS_CATEGORY[] = "XA.Android";
|
||||
const char ANDROID_SETTINGS_TR_CATEGORY[] = QT_TRANSLATE_NOOP("Android", "Android");
|
||||
const char ANDROID_SETTINGS_CATEGORY_ICON[] = ":/android/images/QtAndroid.png";
|
||||
const char ANDROID_TOOLCHAIN_ID[] = "Qt4ProjectManager.ToolChain.Android";
|
||||
const char ANDROID_TOOLCHAIN_TYPE[] = "androidgcc";
|
||||
const char ANDROIDQT[] = "Qt4ProjectManager.QtVersion.Android";
|
||||
|
||||
const char ANDROID_DEVICE_TYPE[] = "Android.Device.Type";
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "androidpackagecreationstep.h"
|
||||
#include "androidrunconfiguration.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidtoolchain.h"
|
||||
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
@@ -114,6 +115,12 @@ bool AndroidDeployStep::init()
|
||||
m_buildDirectory = static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode()->buildDir();
|
||||
m_runQASIPackagePath = m_QASIPackagePath;
|
||||
m_runDeployAction = m_deployAction;
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
|
||||
if (!tc || tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE)) {
|
||||
raiseError(tr("No Android toolchain selected."));
|
||||
return false;
|
||||
}
|
||||
m_ndkToolChainVersion = static_cast<AndroidToolChain *>(tc)->ndkToolChainVersion();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -352,11 +359,11 @@ void AndroidDeployStep::copyFilesToTemp(QList<DeployItem> *deployList, const QSt
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidDeployStep::stripFiles(const QList<DeployItem> &deployList, Abi::Architecture architecture)
|
||||
void AndroidDeployStep::stripFiles(const QList<DeployItem> &deployList, Abi::Architecture architecture, const QString &ndkToolchainVersion)
|
||||
{
|
||||
QProcess stripProcess;
|
||||
foreach (const DeployItem &item, deployList) {
|
||||
stripProcess.start(AndroidConfigurations::instance().stripPath(architecture).toString(),
|
||||
stripProcess.start(AndroidConfigurations::instance().stripPath(architecture, ndkToolchainVersion).toString(),
|
||||
QStringList()<<QLatin1String("--strip-unneeded") << item.localFileName);
|
||||
stripProcess.waitForStarted();
|
||||
if (!stripProcess.waitForFinished())
|
||||
@@ -414,7 +421,7 @@ bool AndroidDeployStep::deployPackage()
|
||||
fetchRemoteModificationTimes(&deployList);
|
||||
filterModificationTimes(&deployList);
|
||||
copyFilesToTemp(&deployList, tempPath, m_qtVersionSourcePath);
|
||||
stripFiles(deployList, target()->activeRunConfiguration()->abi().architecture());
|
||||
stripFiles(deployList, target()->activeRunConfiguration()->abi().architecture(), m_ndkToolChainVersion);
|
||||
deployFiles(deployProc, deployList);
|
||||
|
||||
AndroidPackageCreationStep::removeDirectory(tempPath);
|
||||
|
||||
@@ -132,7 +132,7 @@ private:
|
||||
void filterModificationTimes(QList<DeployItem> *deployList);
|
||||
void copyFilesToTemp(QList<DeployItem> *deployList, const QString &tempDirectory, const QString &sourcePrefix);
|
||||
void fetchRemoteModificationTimes(QList<DeployItem> *deployList);
|
||||
void stripFiles(const QList<DeployItem> &deployList, ProjectExplorer::Abi::Architecture architecture);
|
||||
void stripFiles(const QList<DeployItem> &deployList, ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolchainVersion);
|
||||
void deployFiles(QProcess *process, const QList<DeployItem> &deployList);
|
||||
|
||||
private:
|
||||
@@ -153,6 +153,7 @@ private:
|
||||
QString m_buildDirectory;
|
||||
QString m_runQASIPackagePath;
|
||||
AndroidDeployAction m_runDeployAction;
|
||||
QString m_ndkToolChainVersion;
|
||||
|
||||
static const Core::Id Id;
|
||||
};
|
||||
|
||||
@@ -59,7 +59,7 @@ You must have Qt libraries compiled for that platform</string>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cleanLibsPushButton">
|
||||
<property name="text">
|
||||
<string>Clean libs on device</string>
|
||||
<string>Clean Libs on Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
192
src/plugins/android/androidgdbserverkitinformation.cpp
Normal file
192
src/plugins/android/androidgdbserverkitinformation.cpp
Normal file
@@ -0,0 +1,192 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** 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 "androidgdbserverkitinformation.h"
|
||||
#include "androidconstants.h"
|
||||
#include "androidtoolchain.h"
|
||||
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/elidinglabel.h>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QMenu>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFormLayout>
|
||||
|
||||
using namespace Android;
|
||||
using namespace Android::Internal;
|
||||
|
||||
namespace {
|
||||
static const char ANDROIDGDBSERVER_INFORMATION[] = "Android.GdbServer.Information";
|
||||
}
|
||||
|
||||
AndroidGdbServerKitInformation::AndroidGdbServerKitInformation()
|
||||
{
|
||||
}
|
||||
|
||||
Core::Id AndroidGdbServerKitInformation::dataId() const
|
||||
{
|
||||
return Core::Id(ANDROIDGDBSERVER_INFORMATION);
|
||||
}
|
||||
|
||||
unsigned int AndroidGdbServerKitInformation::priority() const
|
||||
{
|
||||
return 27999; // Just one less than Debugger!
|
||||
}
|
||||
|
||||
QVariant AndroidGdbServerKitInformation::defaultValue(ProjectExplorer::Kit *kit) const
|
||||
{
|
||||
return autoDetect(kit).toString();
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::Task> AndroidGdbServerKitInformation::validate(const ProjectExplorer::Kit *) const
|
||||
{
|
||||
return QList<ProjectExplorer::Task>();
|
||||
}
|
||||
|
||||
ProjectExplorer::KitInformation::ItemList AndroidGdbServerKitInformation::toUserOutput(const ProjectExplorer::Kit *kit) const
|
||||
{
|
||||
return ProjectExplorer::KitInformation::ItemList()
|
||||
<< qMakePair(tr("GDB server"), AndroidGdbServerKitInformation::gdbServer(kit).toUserOutput());
|
||||
}
|
||||
|
||||
ProjectExplorer::KitConfigWidget *AndroidGdbServerKitInformation::createConfigWidget(ProjectExplorer::Kit *kit) const
|
||||
{
|
||||
return new AndroidGdbServerKitInformationWidget(kit);
|
||||
}
|
||||
|
||||
Utils::FileName AndroidGdbServerKitInformation::gdbServer(const ProjectExplorer::Kit *kit)
|
||||
{
|
||||
return Utils::FileName::fromString(kit->value(Core::Id(ANDROIDGDBSERVER_INFORMATION)).toString());
|
||||
}
|
||||
|
||||
void AndroidGdbServerKitInformation::setGdbSever(ProjectExplorer::Kit *kit, const Utils::FileName &gdbServerCommand)
|
||||
{
|
||||
kit->setValue(Core::Id(ANDROIDGDBSERVER_INFORMATION),
|
||||
gdbServerCommand.toString());
|
||||
}
|
||||
|
||||
Utils::FileName AndroidGdbServerKitInformation::autoDetect(ProjectExplorer::Kit *kit)
|
||||
{
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(kit);
|
||||
if (!tc || tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
|
||||
return Utils::FileName();
|
||||
AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
|
||||
return atc->suggestedGdbServer();
|
||||
}
|
||||
|
||||
///////////////
|
||||
// AndroidGdbServerKitInformationWidget
|
||||
///////////////
|
||||
|
||||
|
||||
AndroidGdbServerKitInformationWidget::AndroidGdbServerKitInformationWidget(ProjectExplorer::Kit *kit)
|
||||
: ProjectExplorer::KitConfigWidget(kit),
|
||||
m_label(new Utils::ElidingLabel),
|
||||
m_button(new QPushButton(tr("Manage...")))
|
||||
{
|
||||
// ToolButton with Menu, defaulting to 'Autodetect'.
|
||||
QMenu *buttonMenu = new QMenu(m_button);
|
||||
QAction *autoDetectAction = buttonMenu->addAction(tr("Auto-detect"));
|
||||
connect(autoDetectAction, SIGNAL(triggered()), this, SLOT(autoDetectDebugger()));
|
||||
QAction *changeAction = buttonMenu->addAction(tr("Edit..."));
|
||||
connect(changeAction, SIGNAL(triggered()), this, SLOT(showDialog()));
|
||||
m_button->setMenu(buttonMenu);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
QString AndroidGdbServerKitInformationWidget::displayName() const
|
||||
{
|
||||
return tr("Android GDB server");
|
||||
}
|
||||
|
||||
QString AndroidGdbServerKitInformationWidget::toolTip() const
|
||||
{
|
||||
return tr("The GDB server to use for this kit.");
|
||||
}
|
||||
|
||||
void AndroidGdbServerKitInformationWidget::makeReadOnly()
|
||||
{
|
||||
m_button->setEnabled(false);
|
||||
}
|
||||
|
||||
void AndroidGdbServerKitInformationWidget::refresh()
|
||||
{
|
||||
m_label->setText(AndroidGdbServerKitInformation::gdbServer(m_kit).toString());
|
||||
}
|
||||
|
||||
bool AndroidGdbServerKitInformationWidget::visibleInKit()
|
||||
{
|
||||
return ProjectExplorer::DeviceKitInformation::deviceId(m_kit) == Core::Id(Constants::ANDROID_DEVICE_ID);
|
||||
}
|
||||
|
||||
QWidget *AndroidGdbServerKitInformationWidget::mainWidget() const
|
||||
{
|
||||
return m_label;
|
||||
}
|
||||
|
||||
QWidget *AndroidGdbServerKitInformationWidget::buttonWidget() const
|
||||
{
|
||||
return m_button;
|
||||
}
|
||||
|
||||
void AndroidGdbServerKitInformationWidget::autoDetectDebugger()
|
||||
{
|
||||
AndroidGdbServerKitInformation::setGdbSever(m_kit, AndroidGdbServerKitInformation::autoDetect(m_kit));
|
||||
}
|
||||
|
||||
void AndroidGdbServerKitInformationWidget::showDialog()
|
||||
{
|
||||
QDialog dialog;
|
||||
QVBoxLayout *layout = new QVBoxLayout(&dialog);
|
||||
QFormLayout *formLayout = new QFormLayout;
|
||||
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
||||
|
||||
QLabel *binaryLabel = new QLabel(tr("&Binary:"));
|
||||
Utils::PathChooser *chooser = new Utils::PathChooser;
|
||||
chooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
chooser->setPath(AndroidGdbServerKitInformation::gdbServer(m_kit).toString());
|
||||
binaryLabel->setBuddy(chooser);
|
||||
formLayout->addRow(binaryLabel, chooser);
|
||||
layout->addLayout(formLayout);
|
||||
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog);
|
||||
connect(buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
|
||||
layout->addWidget(buttonBox);
|
||||
|
||||
dialog.setWindowTitle(tr("GDB Server for \"%1\"").arg(m_kit->displayName()));
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
AndroidGdbServerKitInformation::setGdbSever(m_kit, chooser->fileName());
|
||||
}
|
||||
93
src/plugins/android/androidgdbserverkitinformation.h
Normal file
93
src/plugins/android/androidgdbserverkitinformation.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** 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 ANDROIDGDBSERVERKITINFORMATION_H
|
||||
#define ANDROIDGDBSERVERKITINFORMATION_H
|
||||
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/kitconfigwidget.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QLabel);
|
||||
QT_FORWARD_DECLARE_CLASS(QPushButton);
|
||||
|
||||
namespace ProjectExplorer {
|
||||
}
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
class AndroidGdbServerKitInformationWidget : public ProjectExplorer::KitConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AndroidGdbServerKitInformationWidget(ProjectExplorer::Kit *kit);
|
||||
|
||||
QString displayName() const;
|
||||
QString toolTip() const;
|
||||
void makeReadOnly();
|
||||
void refresh();
|
||||
bool visibleInKit();
|
||||
|
||||
QWidget *mainWidget() const;
|
||||
QWidget *buttonWidget() const;
|
||||
|
||||
private slots:
|
||||
void autoDetectDebugger();
|
||||
void showDialog();
|
||||
private:
|
||||
QLabel *m_label;
|
||||
QPushButton *m_button;
|
||||
};
|
||||
|
||||
class AndroidGdbServerKitInformation : public ProjectExplorer::KitInformation
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AndroidGdbServerKitInformation();
|
||||
Core::Id dataId() const;
|
||||
|
||||
unsigned int priority() const; // the higher the closer to the top.
|
||||
|
||||
QVariant defaultValue(ProjectExplorer::Kit *) const;
|
||||
|
||||
QList<ProjectExplorer::Task> validate(const ProjectExplorer::Kit *) const;
|
||||
|
||||
ItemList toUserOutput(const ProjectExplorer::Kit *) const;
|
||||
|
||||
ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *) const;
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
|
||||
#endif // ANDROIDGDBSERVERKITINFORMATION_H
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "androiddeploystep.h"
|
||||
#include "androidglobal.h"
|
||||
#include "androidpackagecreationstep.h"
|
||||
#include "androidtoolchain.h"
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/session.h>
|
||||
@@ -581,7 +582,13 @@ QStringList AndroidManager::availableQtLibs(ProjectExplorer::Target *target)
|
||||
if (!target->activeRunConfiguration())
|
||||
return QStringList();
|
||||
|
||||
Utils::FileName readelfPath = AndroidConfigurations::instance().readelfPath(target->activeRunConfiguration()->abi().architecture());
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target->kit());
|
||||
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
|
||||
return QStringList();
|
||||
AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
|
||||
|
||||
Utils::FileName readelfPath = AndroidConfigurations::instance().readelfPath(target->activeRunConfiguration()->abi().architecture(),
|
||||
atc->ndkToolChainVersion());
|
||||
QStringList libs;
|
||||
const Qt4ProjectManager::Qt4Project *const qt4Project
|
||||
= qobject_cast<const Qt4ProjectManager::Qt4Project *>(target->project());
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "androidglobal.h"
|
||||
#include "androidpackagecreationwidget.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidgdbserverkitinformation.h"
|
||||
#include "androidtoolchain.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -152,7 +154,7 @@ bool AndroidPackageCreationStep::init()
|
||||
else
|
||||
androidLibPath = path.appendPath(QLatin1String("libs/armeabi"));
|
||||
m_gdbServerDestination = androidLibPath.appendPath(QLatin1String("gdbserver"));
|
||||
m_gdbServerSource = AndroidConfigurations::instance().gdbServerPath(target()->activeRunConfiguration()->abi().architecture());
|
||||
m_gdbServerSource = AndroidGdbServerKitInformation::gdbServer(target()->kit());
|
||||
m_debugBuild = bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild;
|
||||
|
||||
if (!AndroidManager::createAndroidTemplatesIfNecessary(target()))
|
||||
@@ -166,6 +168,11 @@ bool AndroidPackageCreationStep::init()
|
||||
m_certificatePasswdForRun = m_certificatePasswd;
|
||||
m_jarSigner = AndroidConfigurations::instance().jarsignerPath();
|
||||
m_zipAligner = AndroidConfigurations::instance().zipalignPath();
|
||||
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
|
||||
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
|
||||
return false;
|
||||
|
||||
initCheckRequiredLibrariesForRun();
|
||||
return true;
|
||||
}
|
||||
@@ -215,7 +222,13 @@ void AndroidPackageCreationStep::checkRequiredLibraries()
|
||||
raiseError(msgCannotFindElfInformation(), msgCannotFindExecutable(appPath));
|
||||
return;
|
||||
}
|
||||
readelfProc.start(AndroidConfigurations::instance().readelfPath(target()->activeRunConfiguration()->abi().architecture()).toString(),
|
||||
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
|
||||
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
|
||||
return;
|
||||
AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
|
||||
|
||||
readelfProc.start(AndroidConfigurations::instance().readelfPath(target()->activeRunConfiguration()->abi().architecture(), atc->ndkToolChainVersion()).toString(),
|
||||
QStringList() << QLatin1String("-d") << QLatin1String("-W") << appPath);
|
||||
if (!readelfProc.waitForFinished(-1)) {
|
||||
readelfProc.kill();
|
||||
@@ -243,8 +256,14 @@ void AndroidPackageCreationStep::checkRequiredLibraries()
|
||||
|
||||
void AndroidPackageCreationStep::initCheckRequiredLibrariesForRun()
|
||||
{
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
|
||||
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
|
||||
return;
|
||||
AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
|
||||
|
||||
m_appPath = Utils::FileName::fromString(AndroidManager::targetApplicationPath(target()));
|
||||
m_readElf = AndroidConfigurations::instance().readelfPath(target()->activeRunConfiguration()->abi().architecture());
|
||||
m_readElf = AndroidConfigurations::instance().readelfPath(target()->activeRunConfiguration()->abi().architecture(),
|
||||
atc->ndkToolChainVersion());
|
||||
m_qtLibs = AndroidManager::qtLibs(target());
|
||||
m_availableQtLibs = AndroidManager::availableQtLibs(target());
|
||||
m_prebundledLibs = AndroidManager::prebundledLibs(target());
|
||||
@@ -461,11 +480,11 @@ bool AndroidPackageCreationStep::createPackage()
|
||||
return true;
|
||||
}
|
||||
|
||||
void AndroidPackageCreationStep::stripAndroidLibs(const QStringList & files, Abi::Architecture architecture)
|
||||
void AndroidPackageCreationStep::stripAndroidLibs(const QStringList & files, Abi::Architecture architecture, const QString &ndkToolchainVersion)
|
||||
{
|
||||
QProcess stripProcess;
|
||||
foreach (const QString &file, files) {
|
||||
stripProcess.start(AndroidConfigurations::instance().stripPath(architecture).toString(),
|
||||
stripProcess.start(AndroidConfigurations::instance().stripPath(architecture, ndkToolchainVersion).toString(),
|
||||
QStringList()<<QLatin1String("--strip-unneeded") << file);
|
||||
stripProcess.waitForStarted();
|
||||
if (!stripProcess.waitForFinished())
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
AndroidPackageCreationStep(ProjectExplorer::BuildStepList *bsl);
|
||||
|
||||
static bool removeDirectory(const QString &dirPath);
|
||||
static void stripAndroidLibs(const QStringList &files, ProjectExplorer::Abi::Architecture architecture);
|
||||
static void stripAndroidLibs(const QStringList &files, ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolchainVersion);
|
||||
|
||||
static const QLatin1String DefaultVersionNumber;
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "androidtoolchain.h"
|
||||
#include "androidqtversionfactory.h"
|
||||
#include "androiddeployconfiguration.h"
|
||||
#include "androidgdbserverkitinformation.h"
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
@@ -70,6 +71,7 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
|
||||
addAutoReleasedObject(new Internal::AndroidToolChainFactory);
|
||||
addAutoReleasedObject(new Internal::AndroidDeployConfigurationFactory);
|
||||
addAutoReleasedObject(new Internal::AndroidDeviceFactory);
|
||||
ProjectExplorer::KitManager::instance()->registerKitInformation(new Internal::AndroidGdbServerKitInformation);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,14 +84,6 @@ AndroidConfig AndroidRunConfiguration::config() const
|
||||
return AndroidConfigurations::instance().config();
|
||||
}
|
||||
|
||||
const Utils::FileName AndroidRunConfiguration::gdbCmd() const
|
||||
{
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
|
||||
if (!tc)
|
||||
return Utils::FileName();
|
||||
return AndroidConfigurations::instance().gdbPath(tc->targetAbi().architecture());
|
||||
}
|
||||
|
||||
AndroidDeployStep *AndroidRunConfiguration::deployStep() const
|
||||
{
|
||||
AndroidDeployStep * const step
|
||||
|
||||
@@ -58,7 +58,6 @@ public:
|
||||
AndroidConfig config() const;
|
||||
QString proFilePath() const;
|
||||
|
||||
const Utils::FileName gdbCmd() const;
|
||||
const QString remoteChannel() const;
|
||||
const QString dumperLib() const;
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
#include "androidsettingswidget.h"
|
||||
#include "androidconstants.h"
|
||||
#include "androidtoolchain.h"
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
@@ -64,6 +66,22 @@ QWidget *AndroidSettingsPage::createPage(QWidget *parent)
|
||||
void AndroidSettingsPage::apply()
|
||||
{
|
||||
m_widget->saveSettings();
|
||||
|
||||
QList<ProjectExplorer::ToolChain *> existingToolChains = ProjectExplorer::ToolChainManager::instance()->toolChains();
|
||||
QList<ProjectExplorer::ToolChain *> toolchains = AndroidToolChainFactory::createToolChainsForNdk(AndroidConfigurations::instance().config().ndkLocation);
|
||||
foreach (ProjectExplorer::ToolChain *tc, toolchains) {
|
||||
bool found = false;
|
||||
for (int i = 0; i < existingToolChains.count(); ++i) {
|
||||
if (*(existingToolChains.at(i)) == *tc) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
delete tc;
|
||||
else
|
||||
ProjectExplorer::ToolChainManager::instance()->registerToolChain(tc);
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidSettingsPage::finish()
|
||||
|
||||
@@ -125,17 +125,8 @@ QString AndroidSettingsWidget::searchKeywords() const
|
||||
<< ' ' << m_ui->SDKLocationLineEdit->text()
|
||||
<< ' ' << m_ui->NDKLocationLabel->text()
|
||||
<< ' ' << m_ui->NDKLocationLineEdit->text()
|
||||
<< ' ' << m_ui->NDKToolchainVersionLabel->text()
|
||||
<< ' ' << m_ui->AntLocationLabel->text()
|
||||
<< ' ' << m_ui->AntLocationLineEdit->text()
|
||||
<< ' ' << m_ui->GdbLocationLabel->text()
|
||||
<< ' ' << m_ui->GdbLocationLineEdit->text()
|
||||
<< ' ' << m_ui->GdbserverLocationLabel->text()
|
||||
<< ' ' << m_ui->GdbserverLocationLineEdit->text()
|
||||
<< ' ' << m_ui->GdbLocationLabelx86->text()
|
||||
<< ' ' << m_ui->GdbLocationLineEditx86->text()
|
||||
<< ' ' << m_ui->GdbserverLocationLabelx86->text()
|
||||
<< ' ' << m_ui->GdbserverLocationLineEditx86->text()
|
||||
<< ' ' << m_ui->OpenJDKLocationLabel->text()
|
||||
<< ' ' << m_ui->OpenJDKLocationLineEdit->text()
|
||||
<< ' ' << m_ui->AVDManagerLabel->text()
|
||||
@@ -157,17 +148,12 @@ void AndroidSettingsWidget::initGui()
|
||||
else
|
||||
m_androidConfig.ndkLocation.clear();
|
||||
m_ui->AntLocationLineEdit->setText(m_androidConfig.antLocation.toUserOutput());
|
||||
m_ui->GdbLocationLineEdit->setText(m_androidConfig.armGdbLocation.toUserOutput());
|
||||
m_ui->GdbserverLocationLineEdit->setText(m_androidConfig.armGdbserverLocation.toUserOutput());
|
||||
m_ui->GdbLocationLineEditx86->setText(m_androidConfig.x86GdbLocation.toUserOutput());
|
||||
m_ui->GdbserverLocationLineEditx86->setText(m_androidConfig.x86GdbserverLocation.toUserOutput());
|
||||
m_ui->OpenJDKLocationLineEdit->setText(m_androidConfig.openJDKLocation.toUserOutput());
|
||||
m_ui->DataPartitionSizeSpinBox->setValue(m_androidConfig.partitionSize);
|
||||
m_ui->AVDTableView->setModel(&m_AVDModel);
|
||||
m_AVDModel.setAvdList(AndroidConfigurations::instance().androidVirtualDevices());
|
||||
m_ui->AVDTableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
||||
m_ui->AVDTableView->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
|
||||
fillToolchainVersions();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::saveSettings(bool saveNow)
|
||||
@@ -202,11 +188,6 @@ bool AndroidSettingsWidget::checkSDK(const Utils::FileName &location)
|
||||
|
||||
bool AndroidSettingsWidget::checkNDK(const Utils::FileName &location)
|
||||
{
|
||||
m_ui->toolchainVersionComboBox->setEnabled(false);
|
||||
m_ui->GdbLocationLineEdit->setEnabled(false);
|
||||
m_ui->GdbLocationPushButton->setEnabled(false);
|
||||
m_ui->GdbserverLocationLineEdit->setEnabled(false);
|
||||
m_ui->GdbserverLocationPushButton->setEnabled(false);
|
||||
if (location.isEmpty())
|
||||
return false;
|
||||
Utils::FileName platformPath = location;
|
||||
@@ -219,11 +200,6 @@ bool AndroidSettingsWidget::checkNDK(const Utils::FileName &location)
|
||||
return false;
|
||||
}
|
||||
m_androidConfig.ndkLocation = location;
|
||||
m_ui->toolchainVersionComboBox->setEnabled(true);
|
||||
m_ui->GdbLocationLineEdit->setEnabled(true);
|
||||
m_ui->GdbLocationPushButton->setEnabled(true);
|
||||
m_ui->GdbserverLocationLineEdit->setEnabled(true);
|
||||
m_ui->GdbserverLocationPushButton->setEnabled(true);
|
||||
return true;
|
||||
|
||||
}
|
||||
@@ -247,29 +223,8 @@ void AndroidSettingsWidget::ndkLocationEditingFinished()
|
||||
if (!checkNDK(location))
|
||||
return;
|
||||
saveSettings(true);
|
||||
fillToolchainVersions();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::fillToolchainVersions()
|
||||
{
|
||||
QStringList toolchainVersions = AndroidConfigurations::instance().ndkToolchainVersions();
|
||||
QString toolchain = m_androidConfig.ndkToolchainVersion;
|
||||
m_ui->toolchainVersionComboBox->clear();
|
||||
foreach (const QString &item, toolchainVersions)
|
||||
m_ui->toolchainVersionComboBox->addItem(item);
|
||||
if (!toolchain.isEmpty())
|
||||
m_ui->toolchainVersionComboBox->setCurrentIndex(toolchainVersions.indexOf(toolchain));
|
||||
else
|
||||
m_ui->toolchainVersionComboBox->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::toolchainVersionIndexChanged(QString version)
|
||||
{
|
||||
m_androidConfig.ndkToolchainVersion = version;
|
||||
saveSettings(true);
|
||||
}
|
||||
|
||||
|
||||
void AndroidSettingsWidget::antLocationEditingFinished()
|
||||
{
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->AntLocationLineEdit->text());
|
||||
@@ -278,38 +233,6 @@ void AndroidSettingsWidget::antLocationEditingFinished()
|
||||
m_androidConfig.antLocation = location;
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::gdbLocationEditingFinished()
|
||||
{
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbLocationLineEdit->text());
|
||||
if (location.isEmpty() || !location.toFileInfo().exists())
|
||||
return;
|
||||
m_androidConfig.armGdbLocation = location;
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::gdbserverLocationEditingFinished()
|
||||
{
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbserverLocationLineEdit->text());
|
||||
if (location.isEmpty() || !location.toFileInfo().exists())
|
||||
return;
|
||||
m_androidConfig.armGdbserverLocation = location;
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::gdbLocationX86EditingFinished()
|
||||
{
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbLocationLineEditx86->text());
|
||||
if (location.isEmpty() || !location.toFileInfo().exists())
|
||||
return;
|
||||
m_androidConfig.x86GdbLocation = location;
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::gdbserverLocationX86EditingFinished()
|
||||
{
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbserverLocationLineEditx86->text());
|
||||
if (location.isEmpty() || !location.toFileInfo().exists())
|
||||
return;
|
||||
m_androidConfig.x86GdbserverLocation = location;
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::openJDKLocationEditingFinished()
|
||||
{
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->OpenJDKLocationLineEdit->text());
|
||||
@@ -355,46 +278,6 @@ void AndroidSettingsWidget::browseAntLocation()
|
||||
antLocationEditingFinished();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::browseGdbLocation()
|
||||
{
|
||||
Utils::FileName gdbPath = AndroidConfigurations::instance().gdbPath(ProjectExplorer::Abi::ArmArchitecture);
|
||||
Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select GDB Executable"), gdbPath.toString()));
|
||||
if (file.isEmpty())
|
||||
return;
|
||||
m_ui->GdbLocationLineEdit->setText(file.toUserOutput());
|
||||
gdbLocationEditingFinished();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::browseGdbserverLocation()
|
||||
{
|
||||
Utils::FileName gdbserverPath = AndroidConfigurations::instance().gdbServerPath(ProjectExplorer::Abi::ArmArchitecture);
|
||||
Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select GDB Server Android Executable"), gdbserverPath.toString()));
|
||||
if (file.isEmpty())
|
||||
return;
|
||||
m_ui->GdbserverLocationLineEdit->setText(file.toUserOutput());
|
||||
gdbserverLocationEditingFinished();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::browseGdbLocationX86()
|
||||
{
|
||||
Utils::FileName gdbPath = AndroidConfigurations::instance().gdbPath(ProjectExplorer::Abi::X86Architecture);
|
||||
Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select GDB Executable"), gdbPath.toString()));
|
||||
if (file.isEmpty())
|
||||
return;
|
||||
m_ui->GdbLocationLineEditx86->setText(file.toUserOutput());
|
||||
gdbLocationX86EditingFinished();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::browseGdbserverLocationX86()
|
||||
{
|
||||
Utils::FileName gdbserverPath = AndroidConfigurations::instance().gdbServerPath(ProjectExplorer::Abi::X86Architecture);
|
||||
Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select GDB Server Android Executable"), gdbserverPath.toString()));
|
||||
if (file.isEmpty())
|
||||
return;
|
||||
m_ui->GdbserverLocationLineEditx86->setText(file.toUserOutput());
|
||||
gdbserverLocationX86EditingFinished();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::browseOpenJDKLocation()
|
||||
{
|
||||
Utils::FileName openJDKPath = AndroidConfigurations::instance().openJDKPath();
|
||||
|
||||
@@ -76,20 +76,11 @@ private slots:
|
||||
void sdkLocationEditingFinished();
|
||||
void ndkLocationEditingFinished();
|
||||
void antLocationEditingFinished();
|
||||
void gdbLocationEditingFinished();
|
||||
void gdbserverLocationEditingFinished();
|
||||
void gdbLocationX86EditingFinished();
|
||||
void gdbserverLocationX86EditingFinished();
|
||||
void openJDKLocationEditingFinished();
|
||||
void browseSDKLocation();
|
||||
void browseNDKLocation();
|
||||
void browseAntLocation();
|
||||
void browseGdbLocation();
|
||||
void browseGdbserverLocation();
|
||||
void browseGdbLocationX86();
|
||||
void browseGdbserverLocationX86();
|
||||
void browseOpenJDKLocation();
|
||||
void toolchainVersionIndexChanged(QString);
|
||||
void addAVD();
|
||||
void removeAVD();
|
||||
void startAVD();
|
||||
@@ -101,7 +92,6 @@ private:
|
||||
void initGui();
|
||||
bool checkSDK(const Utils::FileName &location);
|
||||
bool checkNDK(const Utils::FileName &location);
|
||||
void fillToolchainVersions();
|
||||
|
||||
Ui_AndroidSettingsWidget *m_ui;
|
||||
AndroidConfig m_androidConfig;
|
||||
|
||||
@@ -16,26 +16,6 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="SDKLocationLabel">
|
||||
<property name="text">
|
||||
<string>Android SDK location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="SDKLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="SDKLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="NDKLocationLabel">
|
||||
<property name="text">
|
||||
@@ -56,20 +36,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="NDKToolchainVersionLabel">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="AntLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="AntLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Android NDK tool chain version:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="toolchainVersionComboBox"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="AntLocationLabel">
|
||||
<property name="text">
|
||||
<string>Ant location:</string>
|
||||
@@ -79,97 +56,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="AntLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="AntLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="GdbLocationLabel">
|
||||
<property name="text">
|
||||
<string>ARM GDB location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="GdbLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QPushButton" name="GdbLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="GdbserverLocationLabel">
|
||||
<property name="text">
|
||||
<string>ARM GDB server location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="GdbserverLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="GdbserverLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="GdbLocationLabelx86">
|
||||
<property name="text">
|
||||
<string>x86 GDB location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="GdbLocationLineEditx86"/>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="GdbLocationPushButtonx86">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="GdbserverLocationLabelx86">
|
||||
<property name="text">
|
||||
<string>x86 GDB server location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="GdbserverLocationLineEditx86"/>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QPushButton" name="GdbserverLocationPushButtonx86">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="OpenJDKLocationLabel">
|
||||
<property name="text">
|
||||
<string>OpenJDK location:</string>
|
||||
@@ -179,16 +66,36 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="OpenJDKLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="OpenJDKLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="SDKLocationLabel">
|
||||
<property name="text">
|
||||
<string>Android SDK location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="SDKLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="SDKLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -346,22 +253,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>toolchainVersionComboBox</sender>
|
||||
<signal>currentIndexChanged(QString)</signal>
|
||||
<receiver>AndroidSettingsWidget</receiver>
|
||||
<slot>toolchainVersionIndexChanged(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>420</x>
|
||||
<y>81</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>352</x>
|
||||
<y>210</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>SDKLocationLineEdit</sender>
|
||||
<signal>editingFinished()</signal>
|
||||
@@ -554,134 +445,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>GdbLocationLineEdit</sender>
|
||||
<signal>editingFinished()</signal>
|
||||
<receiver>AndroidSettingsWidget</receiver>
|
||||
<slot>gdbLocationEditingFinished()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>409</x>
|
||||
<y>132</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>352</x>
|
||||
<y>186</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>GdbLocationPushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>AndroidSettingsWidget</receiver>
|
||||
<slot>browseGdbLocation()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>662</x>
|
||||
<y>131</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>352</x>
|
||||
<y>186</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>GdbserverLocationLineEdit</sender>
|
||||
<signal>editingFinished()</signal>
|
||||
<receiver>AndroidSettingsWidget</receiver>
|
||||
<slot>gdbserverLocationEditingFinished()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>423</x>
|
||||
<y>171</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>352</x>
|
||||
<y>222</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>GdbserverLocationPushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>AndroidSettingsWidget</receiver>
|
||||
<slot>browseGdbserverLocation()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>660</x>
|
||||
<y>172</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>352</x>
|
||||
<y>222</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>GdbLocationLineEditx86</sender>
|
||||
<signal>editingFinished()</signal>
|
||||
<receiver>AndroidSettingsWidget</receiver>
|
||||
<slot>gdbLocationX86EditingFinished()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>399</x>
|
||||
<y>184</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>338</x>
|
||||
<y>248</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>GdbLocationPushButtonx86</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>AndroidSettingsWidget</receiver>
|
||||
<slot>browseGdbLocationX86()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>637</x>
|
||||
<y>184</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>338</x>
|
||||
<y>248</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>GdbserverLocationLineEditx86</sender>
|
||||
<signal>editingFinished()</signal>
|
||||
<receiver>AndroidSettingsWidget</receiver>
|
||||
<slot>gdbserverLocationX86EditingFinished()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>399</x>
|
||||
<y>212</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>338</x>
|
||||
<y>248</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>GdbserverLocationPushButtonx86</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>AndroidSettingsWidget</receiver>
|
||||
<slot>browseGdbserverLocationX86()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>637</x>
|
||||
<y>212</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>338</x>
|
||||
<y>248</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>manageAVDPushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
@@ -706,25 +469,13 @@
|
||||
<slot>browseNDKLocation()</slot>
|
||||
<slot>antLocationEditingFinished()</slot>
|
||||
<slot>browseAntLocation()</slot>
|
||||
<slot>toolchainVersionIndexChanged(QString)</slot>
|
||||
<slot>addAVD()</slot>
|
||||
<slot>removeAVD()</slot>
|
||||
<slot>startAVD()</slot>
|
||||
<slot>avdActivated(QModelIndex)</slot>
|
||||
<slot>dataPartitionSizeEditingFinished()</slot>
|
||||
<slot>gdbLocationEditingFinished()</slot>
|
||||
<slot>browseGdbLocation()</slot>
|
||||
<slot>gdbserverLocationEditingFinished()</slot>
|
||||
<slot>browseGdbserverLocation()</slot>
|
||||
<slot>openJDKLocationEditingFinished()</slot>
|
||||
<slot>browseOpenJDKLocation()</slot>
|
||||
<slot>gdbLocationX86EditingFinished()</slot>
|
||||
<slot>browseGdbLocationX86()</slot>
|
||||
<slot>gdbserverLocationX86EditingFinished()</slot>
|
||||
<slot>browseGdbserverLocationX86()</slot>
|
||||
<slot>KeystoreLocationEditingFinished()</slot>
|
||||
<slot>browseKeystoreLocation()</slot>
|
||||
<slot>createKeystore()</slot>
|
||||
<slot>manageAVD()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "androidconstants.h"
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidqtversion.h"
|
||||
|
||||
#include "androidconfigurations.h"
|
||||
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
@@ -45,10 +45,15 @@
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace {
|
||||
const QLatin1String NDKGccVersionRegExp("-\\d[\\.\\d]+");
|
||||
}
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
@@ -56,16 +61,29 @@ using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
static const char ANDROID_QT_VERSION_KEY[] = "Qt4ProjectManager.Android.QtVersion";
|
||||
static const char ANDROID_NDK_TC_VERION[] = "Qt4ProjectManager.Android.NDK_TC_VERION";
|
||||
|
||||
AndroidToolChain::AndroidToolChain(Abi::Architecture arch, const QString &ndkToolChainVersion, bool autodetected)
|
||||
: GccToolChain(QLatin1String(Constants::ANDROID_TOOLCHAIN_ID), autodetected),
|
||||
m_ndkToolChainVersion(ndkToolChainVersion)
|
||||
{
|
||||
ProjectExplorer::Abi abi = ProjectExplorer::Abi(arch, ProjectExplorer::Abi::LinuxOS,
|
||||
ProjectExplorer::Abi::AndroidLinuxFlavor, ProjectExplorer::Abi::ElfFormat,
|
||||
32);
|
||||
setTargetAbi(abi);
|
||||
setDisplayName(QString::fromLatin1("Android GCC (%1-%2)")
|
||||
.arg(Abi::toString(targetAbi().architecture()))
|
||||
.arg(ndkToolChainVersion));
|
||||
}
|
||||
|
||||
AndroidToolChain::AndroidToolChain(bool autodetected) :
|
||||
GccToolChain(QLatin1String(Constants::ANDROID_TOOLCHAIN_ID), autodetected),
|
||||
m_qtVersionId(-1)
|
||||
{}
|
||||
// for fromMap
|
||||
AndroidToolChain::AndroidToolChain()
|
||||
: GccToolChain(QLatin1String(Constants::ANDROID_TOOLCHAIN_ID), false)
|
||||
{
|
||||
}
|
||||
|
||||
AndroidToolChain::AndroidToolChain(const AndroidToolChain &tc) :
|
||||
GccToolChain(tc),
|
||||
m_qtVersionId(tc.m_qtVersionId)
|
||||
GccToolChain(tc), m_ndkToolChainVersion(tc.m_ndkToolChainVersion)
|
||||
{ }
|
||||
|
||||
AndroidToolChain::~AndroidToolChain()
|
||||
@@ -73,7 +91,7 @@ AndroidToolChain::~AndroidToolChain()
|
||||
|
||||
QString AndroidToolChain::type() const
|
||||
{
|
||||
return QLatin1String("androidgcc");
|
||||
return QLatin1String(Android::Constants::ANDROID_TOOLCHAIN_TYPE);
|
||||
}
|
||||
|
||||
QString AndroidToolChain::typeDisplayName() const
|
||||
@@ -83,7 +101,7 @@ QString AndroidToolChain::typeDisplayName() const
|
||||
|
||||
bool AndroidToolChain::isValid() const
|
||||
{
|
||||
return GccToolChain::isValid() && m_qtVersionId >= 0 && targetAbi().isValid();
|
||||
return GccToolChain::isValid() && targetAbi().isValid() && !m_ndkToolChainVersion.isEmpty();
|
||||
}
|
||||
|
||||
void AndroidToolChain::addToEnvironment(Environment &env) const
|
||||
@@ -109,16 +127,15 @@ void AndroidToolChain::addToEnvironment(Environment &env) const
|
||||
env.set(QLatin1String("ANDROID_NDK_HOST"), ndkHost);
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_PREFIX"), AndroidConfigurations::toolchainPrefix(targetAbi().architecture()));
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfigurations::toolsPrefix(targetAbi().architecture()));
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_VERSION"), AndroidConfigurations::instance().config().ndkToolchainVersion);
|
||||
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_VERSION"), m_ndkToolChainVersion);
|
||||
}
|
||||
|
||||
bool AndroidToolChain::operator ==(const ToolChain &tc) const
|
||||
{
|
||||
if (!ToolChain::operator ==(tc))
|
||||
if (!GccToolChain::operator ==(tc))
|
||||
return false;
|
||||
|
||||
const AndroidToolChain *tcPtr = static_cast<const AndroidToolChain *>(&tc);
|
||||
return m_qtVersionId == tcPtr->m_qtVersionId;
|
||||
return m_ndkToolChainVersion == static_cast<const AndroidToolChain &>(tc).m_ndkToolChainVersion;
|
||||
}
|
||||
|
||||
ToolChainConfigWidget *AndroidToolChain::configurationWidget()
|
||||
@@ -126,10 +143,32 @@ ToolChainConfigWidget *AndroidToolChain::configurationWidget()
|
||||
return new AndroidToolChainConfigWidget(this);
|
||||
}
|
||||
|
||||
FileName AndroidToolChain::suggestedDebugger() const
|
||||
{
|
||||
return AndroidConfigurations::instance().gdbPath(targetAbi().architecture(), m_ndkToolChainVersion);
|
||||
}
|
||||
|
||||
FileName AndroidToolChain::suggestedGdbServer() const
|
||||
{
|
||||
Utils::FileName path = AndroidConfigurations::instance().config().ndkLocation;
|
||||
path.appendPath(QString::fromLatin1("prebuilt/android-%1/gdbserver/gdbserver")
|
||||
.arg(Abi::toString(targetAbi().architecture())));
|
||||
if (path.toFileInfo().exists())
|
||||
return path;
|
||||
path = AndroidConfigurations::instance().config().ndkLocation;
|
||||
path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/gdbserver")
|
||||
.arg(AndroidConfigurations::toolchainPrefix(targetAbi().architecture()))
|
||||
.arg(m_ndkToolChainVersion));
|
||||
if (path.toFileInfo().exists())
|
||||
return path;
|
||||
|
||||
return Utils::FileName();
|
||||
}
|
||||
|
||||
QVariantMap AndroidToolChain::toMap() const
|
||||
{
|
||||
QVariantMap result = GccToolChain::toMap();
|
||||
result.insert(QLatin1String(ANDROID_QT_VERSION_KEY), m_qtVersionId);
|
||||
result.insert(QLatin1String(ANDROID_NDK_TC_VERION), m_ndkToolChainVersion);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -138,7 +177,33 @@ bool AndroidToolChain::fromMap(const QVariantMap &data)
|
||||
if (!GccToolChain::fromMap(data))
|
||||
return false;
|
||||
|
||||
m_qtVersionId = data.value(QLatin1String(ANDROID_QT_VERSION_KEY), -1).toInt();
|
||||
if (data.contains(QLatin1String(ANDROID_QT_VERSION_KEY))) {
|
||||
QString command = compilerCommand().toString();
|
||||
QString ndkPath = AndroidConfigurations::instance().config().ndkLocation.toString();
|
||||
if (!command.startsWith(ndkPath))
|
||||
return false;
|
||||
command = command.mid(ndkPath.length());
|
||||
if (!command.startsWith(QLatin1String("/toolchains/")))
|
||||
return false;
|
||||
command = command.mid(12);
|
||||
int index = command.indexOf(QLatin1Char('/'));
|
||||
if (index == -1)
|
||||
return false;
|
||||
command = command.left(index);
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
index = versionRegExp.indexIn(command);
|
||||
if (index == -1)
|
||||
return false;
|
||||
m_ndkToolChainVersion = command.mid(index + 1);
|
||||
QString platform = command.left(index);
|
||||
Abi::Architecture arch = AndroidConfigurations::architectureForToolChainPrefix(platform);
|
||||
ProjectExplorer::Abi abi = ProjectExplorer::Abi(arch, ProjectExplorer::Abi::LinuxOS,
|
||||
ProjectExplorer::Abi::AndroidLinuxFlavor, ProjectExplorer::Abi::ElfFormat,
|
||||
32);
|
||||
setTargetAbi(abi);
|
||||
} else {
|
||||
m_ndkToolChainVersion = data.value(QLatin1String(ANDROID_NDK_TC_VERION)).toString();
|
||||
}
|
||||
|
||||
return isValid();
|
||||
}
|
||||
@@ -156,41 +221,14 @@ QString AndroidToolChain::makeCommand(const Utils::Environment &env) const
|
||||
return tmp.isEmpty() ? make : tmp;
|
||||
}
|
||||
|
||||
void AndroidToolChain::setQtVersionId(int id)
|
||||
QString AndroidToolChain::ndkToolChainVersion()
|
||||
{
|
||||
if (id < 0) {
|
||||
setTargetAbi(Abi());
|
||||
m_qtVersionId = -1;
|
||||
toolChainUpdated();
|
||||
return;
|
||||
}
|
||||
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->version(id);
|
||||
Q_ASSERT(version);
|
||||
m_qtVersionId = id;
|
||||
|
||||
Q_ASSERT(version->qtAbis().count() == 1);
|
||||
setTargetAbi(version->qtAbis().at(0));
|
||||
|
||||
toolChainUpdated();
|
||||
setDisplayName(AndroidToolChainFactory::tr("Android GCC for %1").arg(version->displayName()));
|
||||
}
|
||||
|
||||
int AndroidToolChain::qtVersionId() const
|
||||
{
|
||||
return m_qtVersionId;
|
||||
return m_ndkToolChainVersion;
|
||||
}
|
||||
|
||||
QList<Abi> AndroidToolChain::detectSupportedAbis() const
|
||||
{
|
||||
if (m_qtVersionId < 0)
|
||||
return QList<Abi>();
|
||||
|
||||
AndroidQtVersion *aqv = dynamic_cast<AndroidQtVersion *>(QtSupport::QtVersionManager::instance()->version(m_qtVersionId));
|
||||
if (!aqv)
|
||||
return QList<Abi>();
|
||||
|
||||
return aqv->qtAbis();
|
||||
return QList<Abi>() << targetAbi();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -224,17 +262,7 @@ QString AndroidToolChainFactory::id() const
|
||||
|
||||
QList<ToolChain *> AndroidToolChainFactory::autoDetect()
|
||||
{
|
||||
QList<ToolChain *> result;
|
||||
|
||||
QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
|
||||
connect(vm, SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
|
||||
this, SLOT(handleQtVersionChanges(QList<int>,QList<int>,QList<int>)));
|
||||
|
||||
QList<int> versionList;
|
||||
foreach (QtSupport::BaseQtVersion *v, vm->versions())
|
||||
versionList.append(v->uniqueId());
|
||||
|
||||
return createToolChainList(versionList);
|
||||
return createToolChainsForNdk(AndroidConfigurations::instance().config().ndkLocation);
|
||||
}
|
||||
|
||||
bool AndroidToolChainFactory::canRestore(const QVariantMap &data)
|
||||
@@ -244,7 +272,7 @@ bool AndroidToolChainFactory::canRestore(const QVariantMap &data)
|
||||
|
||||
ToolChain *AndroidToolChainFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
AndroidToolChain *tc = new AndroidToolChain(false);
|
||||
AndroidToolChain *tc = new AndroidToolChain();
|
||||
if (tc->fromMap(data))
|
||||
return tc;
|
||||
|
||||
@@ -252,46 +280,34 @@ ToolChain *AndroidToolChainFactory::restore(const QVariantMap &data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AndroidToolChainFactory::handleQtVersionChanges(const QList<int> &added, const QList<int> &removed, const QList<int> &changed)
|
||||
QList<ToolChain *> AndroidToolChainFactory::createToolChainsForNdk(const Utils::FileName &ndkPath)
|
||||
{
|
||||
QList<int> changes;
|
||||
changes << added << removed << changed;
|
||||
ToolChainManager *tcm = ToolChainManager::instance();
|
||||
QList<ToolChain *> tcList = createToolChainList(changes);
|
||||
foreach (ToolChain *tc, tcList)
|
||||
tcm->registerToolChain(tc);
|
||||
}
|
||||
|
||||
QList<ToolChain *> AndroidToolChainFactory::createToolChainList(const QList<int> &changes)
|
||||
{
|
||||
ToolChainManager *tcm = ToolChainManager::instance();
|
||||
QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance();
|
||||
QList<ToolChain *> result;
|
||||
|
||||
foreach (int i, changes) {
|
||||
QtSupport::BaseQtVersion *v = vm->version(i);
|
||||
QList<ToolChain *> toRemove;
|
||||
foreach (ToolChain *tc, tcm->toolChains()) {
|
||||
if (tc->id() != QLatin1String(Constants::ANDROID_TOOLCHAIN_ID))
|
||||
continue;
|
||||
AndroidToolChain *aTc = static_cast<AndroidToolChain *>(tc);
|
||||
if (aTc->qtVersionId() == i)
|
||||
toRemove.append(aTc);
|
||||
}
|
||||
foreach (ToolChain *tc, toRemove)
|
||||
tcm->deregisterToolChain(tc);
|
||||
|
||||
const AndroidQtVersion * const aqv = dynamic_cast<AndroidQtVersion *>(v);
|
||||
if (!aqv || !aqv->isValid())
|
||||
if (ndkPath.isEmpty())
|
||||
return result;
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
FileName path = ndkPath;
|
||||
QDirIterator it(path.appendPath(QLatin1String("toolchains")).toString(),
|
||||
QStringList() << QLatin1String("*"), QDir::Dirs);
|
||||
while (it.hasNext()) {
|
||||
const QString &fileName = QFileInfo(it.next()).fileName();
|
||||
int idx = versionRegExp.indexIn(fileName);
|
||||
if (idx == -1)
|
||||
continue;
|
||||
|
||||
AndroidToolChain *aTc = new AndroidToolChain(true);
|
||||
aTc->setQtVersionId(i);
|
||||
aTc->setDisplayName(tr("Android GCC (%1-%2)")
|
||||
.arg(Abi::toString(aTc->targetAbi().architecture()))
|
||||
.arg(AndroidConfigurations::instance().config().ndkToolchainVersion));
|
||||
aTc->setCompilerCommand(AndroidConfigurations::instance().gccPath(aTc->targetAbi().architecture()));
|
||||
result.append(aTc);
|
||||
QString version = fileName.mid(idx + 1);
|
||||
QString platform = fileName.left(idx);
|
||||
Abi::Architecture arch = AndroidConfigurations::architectureForToolChainPrefix(platform);
|
||||
if (arch == Abi::UnknownArchitecture) // e.g. mipsel which is not yet supported
|
||||
continue;
|
||||
AndroidToolChain *tc = new AndroidToolChain(arch, version, true);
|
||||
FileName compilerPath = ndkPath;
|
||||
compilerPath.appendPath(QString::fromLatin1("toolchains/%1/prebuilt/%3/bin/%4")
|
||||
.arg(fileName)
|
||||
.arg(ToolchainHost)
|
||||
.arg(AndroidConfigurations::toolsPrefix(arch)));
|
||||
compilerPath.append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX));
|
||||
tc->setCompilerCommand(compilerPath);
|
||||
result.append(tc);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -51,23 +51,25 @@ public:
|
||||
bool operator ==(const ProjectExplorer::ToolChain &) const;
|
||||
|
||||
ProjectExplorer::ToolChainConfigWidget *configurationWidget();
|
||||
virtual Utils::FileName suggestedDebugger() const;
|
||||
Utils::FileName suggestedGdbServer() const;
|
||||
|
||||
QVariantMap toMap() const;
|
||||
bool fromMap(const QVariantMap &data);
|
||||
QList<Utils::FileName> suggestedMkspecList() const;
|
||||
QString makeCommand(const Utils::Environment &environment) const;
|
||||
|
||||
void setQtVersionId(int);
|
||||
int qtVersionId() const;
|
||||
QString ndkToolChainVersion();
|
||||
|
||||
protected:
|
||||
QList<ProjectExplorer::Abi> detectSupportedAbis() const;
|
||||
|
||||
private:
|
||||
explicit AndroidToolChain(bool);
|
||||
AndroidToolChain(ProjectExplorer::Abi::Architecture arch, const QString &ndkToolChainVersion, bool autodetected);
|
||||
AndroidToolChain();
|
||||
AndroidToolChain(const AndroidToolChain &);
|
||||
|
||||
int m_qtVersionId;
|
||||
QString m_ndkToolChainVersion;
|
||||
friend class AndroidToolChainFactory;
|
||||
};
|
||||
|
||||
@@ -101,9 +103,7 @@ public:
|
||||
bool canRestore(const QVariantMap &data);
|
||||
ProjectExplorer::ToolChain *restore(const QVariantMap &data);
|
||||
|
||||
private slots:
|
||||
void handleQtVersionChanges(const QList<int> &added, const QList<int> &removed, const QList<int> &changed);
|
||||
QList<ProjectExplorer::ToolChain *> createToolChainList(const QList<int> &);
|
||||
static QList<ProjectExplorer::ToolChain *> createToolChainsForNdk(const Utils::FileName &ndkPath);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user