forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.7'
Conflicts: src/plugins/qnx/blackberrydeployconfiguration.cpp Change-Id: I16d1c7717f4bc25ba7e8dbdd5be6580fafe3f33d
This commit is contained in:
@@ -29,11 +29,22 @@
|
||||
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidconstants.h"
|
||||
#include "androidtoolchain.h"
|
||||
#include "androiddevice.h"
|
||||
#include "androidgdbserverkitinformation.h"
|
||||
#include "ui_addnewavddialog.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/persistentsettings.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <debugger/debuggerkitinformation.h>
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QSettings>
|
||||
@@ -66,17 +77,16 @@ namespace {
|
||||
const QLatin1String NDKLocationKey("NDKLocation");
|
||||
const QLatin1String NDKToolchainVersionKey("NDKToolchainVersion");
|
||||
const QLatin1String AntLocationKey("AntLocation");
|
||||
const QLatin1String ArmGdbLocationKey("GdbLocation");
|
||||
const QLatin1String ArmGdbserverLocationKey("GdbserverLocation");
|
||||
const QLatin1String X86GdbLocationKey("X86GdbLocation");
|
||||
const QLatin1String X86GdbserverLocationKey("X86GdbserverLocation");
|
||||
const QLatin1String OpenJDKLocationKey("OpenJDKLocation");
|
||||
const QLatin1String KeystoreLocationKey("KeystoreLocation");
|
||||
const QLatin1String AutomaticKitCreationKey("AutomatiKitCreation");
|
||||
const QLatin1String PartitionSizeKey("PartitionSize");
|
||||
const QLatin1String ArmToolchainPrefix("arm-linux-androideabi");
|
||||
const QLatin1String X86ToolchainPrefix("x86");
|
||||
const QLatin1String MipsToolchainPrefix("mipsel-linux-android");
|
||||
const QLatin1String ArmToolsPrefix("arm-linux-androideabi");
|
||||
const QLatin1String X86ToolsPrefix("i686-android-linux");
|
||||
const QLatin1String X86ToolsPrefix("i686-linux-android");
|
||||
const QLatin1String MipsToolsPrefix("mipsel-linux-android");
|
||||
const QLatin1String Unknown("unknown");
|
||||
const QLatin1String keytoolName("keytool");
|
||||
const QLatin1String jarsignerName("jarsigner");
|
||||
@@ -84,8 +94,8 @@ namespace {
|
||||
|
||||
static QString sdkSettingsFileName()
|
||||
{
|
||||
return QString::fromLatin1("%1/android.xml")
|
||||
.arg(QFileInfo(Core::ICore::settings(QSettings::SystemScope)->fileName()).absolutePath());
|
||||
return QFileInfo(Core::ICore::settings(QSettings::SystemScope)->fileName()).absolutePath()
|
||||
+ QLatin1String("/qtcreator/android.xml");
|
||||
}
|
||||
|
||||
bool androidDevicesLessThan(const AndroidDeviceInfo &dev1, const AndroidDeviceInfo &dev2)
|
||||
@@ -100,6 +110,8 @@ Abi::Architecture AndroidConfigurations::architectureForToolChainPrefix(const QS
|
||||
return Abi::ArmArchitecture;
|
||||
if (toolchainprefix == X86ToolchainPrefix)
|
||||
return Abi::X86Architecture;
|
||||
if (toolchainprefix == MipsToolchainPrefix)
|
||||
return Abi::MipsArchitecture;
|
||||
return Abi::UnknownArchitecture;
|
||||
}
|
||||
|
||||
@@ -110,6 +122,8 @@ QLatin1String AndroidConfigurations::toolchainPrefix(Abi::Architecture architect
|
||||
return ArmToolchainPrefix;
|
||||
case Abi::X86Architecture:
|
||||
return X86ToolchainPrefix;
|
||||
case Abi::MipsArchitecture:
|
||||
return MipsToolchainPrefix;
|
||||
default:
|
||||
return Unknown;
|
||||
}
|
||||
@@ -122,6 +136,8 @@ QLatin1String AndroidConfigurations::toolsPrefix(Abi::Architecture architecture)
|
||||
return ArmToolsPrefix;
|
||||
case Abi::X86Architecture:
|
||||
return X86ToolsPrefix;
|
||||
case Abi::MipsArchitecture:
|
||||
return MipsToolsPrefix;
|
||||
default:
|
||||
return Unknown;
|
||||
}
|
||||
@@ -136,6 +152,7 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
antLocation = FileName::fromString(settings.value(AntLocationKey).toString());
|
||||
openJDKLocation = FileName::fromString(settings.value(OpenJDKLocationKey).toString());
|
||||
keystoreLocation = FileName::fromString(settings.value(KeystoreLocationKey).toString());
|
||||
automaticKitCreation = settings.value(AutomaticKitCreationKey, true).toBool();
|
||||
|
||||
PersistentSettingsReader reader;
|
||||
if (reader.load(FileName::fromString(sdkSettingsFileName()))
|
||||
@@ -146,6 +163,9 @@ 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());
|
||||
QVariant v = reader.restoreValue(AutomaticKitCreationKey);
|
||||
if (v.isValid())
|
||||
automaticKitCreation = v.toBool();
|
||||
// persistent settings
|
||||
}
|
||||
|
||||
@@ -169,6 +189,7 @@ void AndroidConfig::save(QSettings &settings) const
|
||||
settings.setValue(OpenJDKLocationKey, openJDKLocation.toString());
|
||||
settings.setValue(KeystoreLocationKey, keystoreLocation.toString());
|
||||
settings.setValue(PartitionSizeKey, partitionSize);
|
||||
settings.setValue(AutomaticKitCreationKey, automaticKitCreation);
|
||||
}
|
||||
|
||||
void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
|
||||
@@ -176,6 +197,7 @@ void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
|
||||
m_config = devConfigs;
|
||||
save();
|
||||
updateAvailablePlatforms();
|
||||
updateAutomaticKitList();
|
||||
emit updated();
|
||||
}
|
||||
|
||||
@@ -328,8 +350,23 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::connectedDevices(int apiLevel)
|
||||
QList<QByteArray> adbDevs = adbProc.readAll().trimmed().split('\n');
|
||||
adbDevs.removeFirst();
|
||||
AndroidDeviceInfo dev;
|
||||
|
||||
// workaround for '????????????' serial numbers:
|
||||
// can use "adb -d" when only one usb device attached
|
||||
int usbDevicesNum = 0;
|
||||
QStringList serialNumbers;
|
||||
foreach (const QByteArray &device, adbDevs) {
|
||||
dev.serialNumber = QString::fromLatin1(device.left(device.indexOf('\t')).trimmed());
|
||||
const QString serialNo = QString::fromLatin1(device.left(device.indexOf('\t')).trimmed());;
|
||||
if (!serialNo.startsWith(QLatin1String("emulator")))
|
||||
++usbDevicesNum;
|
||||
serialNumbers << serialNo;
|
||||
}
|
||||
|
||||
foreach (const QString &serialNo, serialNumbers) {
|
||||
if (serialNo.contains(QLatin1String("????")) && usbDevicesNum > 1)
|
||||
continue;
|
||||
|
||||
dev.serialNumber = serialNo;
|
||||
dev.sdk = getSDKVersion(dev.serialNumber);
|
||||
if (apiLevel != -1 && dev.sdk != apiLevel)
|
||||
continue;
|
||||
@@ -500,12 +537,13 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
|
||||
|
||||
int AndroidConfigurations::getSDKVersion(const QString &device) const
|
||||
{
|
||||
// workaround for '????????????' serial numbers
|
||||
QStringList arguments = AndroidDeviceInfo::adbSelector(device);
|
||||
arguments << QLatin1String("shell") << QLatin1String("getprop")
|
||||
<< QLatin1String("ro.build.version.sdk");
|
||||
|
||||
QProcess adbProc;
|
||||
adbProc.start(adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << device
|
||||
<< QLatin1String("shell") << QLatin1String("getprop")
|
||||
<< QLatin1String("ro.build.version.sdk"));
|
||||
adbProc.start(adbToolPath().toString(), arguments);
|
||||
if (!adbProc.waitForFinished(-1)) {
|
||||
adbProc.kill();
|
||||
return -1;
|
||||
@@ -523,6 +561,119 @@ QString AndroidConfigurations::bestMatch(const QString &targetAPI) const
|
||||
return QLatin1String("android-8");
|
||||
}
|
||||
|
||||
bool equalKits(Kit *a, Kit *b)
|
||||
{
|
||||
return ToolChainKitInformation::toolChain(a) == ToolChainKitInformation::toolChain(b)
|
||||
&& QtSupport::QtKitInformation::qtVersion(a) == QtSupport::QtKitInformation::qtVersion(b);
|
||||
}
|
||||
|
||||
void AndroidConfigurations::updateAutomaticKitList()
|
||||
{
|
||||
QList<AndroidToolChain *> toolchains;
|
||||
if (AndroidConfigurations::instance().config().automaticKitCreation) {
|
||||
// having a empty toolchains list will remove all autodetected kits for android
|
||||
// exactly what we want in that case
|
||||
foreach (ProjectExplorer::ToolChain *tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) {
|
||||
if (!tc->isAutoDetected())
|
||||
continue;
|
||||
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
|
||||
continue;
|
||||
toolchains << static_cast<AndroidToolChain *>(tc);
|
||||
}
|
||||
}
|
||||
|
||||
QList<Kit *> existingKits;
|
||||
|
||||
foreach (ProjectExplorer::Kit *k, ProjectExplorer::KitManager::instance()->kits()) {
|
||||
if (ProjectExplorer::DeviceKitInformation::deviceId(k) != Core::Id(Constants::ANDROID_DEVICE_ID))
|
||||
continue;
|
||||
if (!k->isAutoDetected())
|
||||
continue;
|
||||
if (k->isSdkProvided())
|
||||
continue;
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain((k));
|
||||
if (!tc)
|
||||
continue;
|
||||
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
|
||||
continue;
|
||||
|
||||
existingKits << k;
|
||||
}
|
||||
|
||||
QMap<ProjectExplorer::Abi::Architecture, QList<QtSupport::BaseQtVersion *> > qtVersionsForArch;
|
||||
foreach (QtSupport::BaseQtVersion *qtVersion, QtSupport::QtVersionManager::instance()->versions()) {
|
||||
if (qtVersion->type() != QLatin1String(Constants::ANDROIDQT))
|
||||
continue;
|
||||
QList<ProjectExplorer::Abi> qtAbis = qtVersion->qtAbis();
|
||||
if (qtAbis.empty())
|
||||
continue;
|
||||
qtVersionsForArch[qtAbis.first().architecture()].append(qtVersion);
|
||||
}
|
||||
|
||||
ProjectExplorer::DeviceManager *dm = ProjectExplorer::DeviceManager::instance();
|
||||
IDevice::ConstPtr device = dm->find(Core::Id(Constants::ANDROID_DEVICE_ID)); // should always exist
|
||||
|
||||
// register new kits
|
||||
QList<Kit *> newKits;
|
||||
foreach (AndroidToolChain *tc, toolchains) {
|
||||
QList<QtSupport::BaseQtVersion *> qtVersions = qtVersionsForArch.value(tc->targetAbi().architecture());
|
||||
foreach (QtSupport::BaseQtVersion *qt, qtVersions) {
|
||||
Kit *newKit = new Kit;
|
||||
newKit->setAutoDetected(true);
|
||||
newKit->setIconPath(QLatin1String(Constants::ANDROID_SETTINGS_CATEGORY_ICON));
|
||||
DeviceTypeKitInformation::setDeviceTypeId(newKit, Core::Id(Constants::ANDROID_DEVICE_TYPE));
|
||||
ToolChainKitInformation::setToolChain(newKit, tc);
|
||||
QtSupport::QtKitInformation::setQtVersion(newKit, qt);
|
||||
DeviceKitInformation::setDevice(newKit, device);
|
||||
Debugger::DebuggerKitInformation::DebuggerItem item;
|
||||
item.engineType = Debugger::GdbEngineType;
|
||||
item.binary = tc->suggestedDebugger();
|
||||
Debugger::DebuggerKitInformation::setDebuggerItem(newKit, item);
|
||||
AndroidGdbServerKitInformation::setGdbSever(newKit, tc->suggestedGdbServer());
|
||||
newKits << newKit;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = existingKits.count() - 1; i >= 0; --i) {
|
||||
Kit *existingKit = existingKits.at(i);
|
||||
for (int j = 0; j < newKits.count(); ++j) {
|
||||
Kit *newKit = newKits.at(j);
|
||||
if (equalKits(existingKit, newKit)) {
|
||||
// Kit is already registered, nothing to do
|
||||
newKits.removeAt(j);
|
||||
existingKits.removeAt(i);
|
||||
KitManager::deleteKit(newKit);
|
||||
j = newKits.count();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Kit *k, existingKits)
|
||||
KitManager::instance()->deregisterKit(k);
|
||||
|
||||
foreach (Kit *kit, newKits) {
|
||||
AndroidToolChain *tc = static_cast<AndroidToolChain *>(ToolChainKitInformation::toolChain(kit));
|
||||
QString arch = ProjectExplorer::Abi::toString(tc->targetAbi().architecture());
|
||||
QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(kit);
|
||||
kit->setDisplayName(tr("Android for %1 (GCC %2, Qt %3)")
|
||||
.arg(arch)
|
||||
.arg(tc->ndkToolChainVersion())
|
||||
.arg(qt->qtVersionString()));
|
||||
KitManager::instance()->registerKit(kit);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Workaround for '????????????' serial numbers
|
||||
* @return ("-d") for buggy devices, ("-s", <serial no>) for normal
|
||||
*/
|
||||
QStringList AndroidDeviceInfo::adbSelector(const QString &serialNumber)
|
||||
{
|
||||
if (serialNumber.startsWith(QLatin1String("????")))
|
||||
return QStringList() << QLatin1String("-d");
|
||||
return QStringList() << QLatin1String("-s") << serialNumber;
|
||||
}
|
||||
|
||||
AndroidConfigurations &AndroidConfigurations::instance(QObject *parent)
|
||||
{
|
||||
if (m_instance == 0)
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
Utils::FileName openJDKLocation;
|
||||
Utils::FileName keystoreLocation;
|
||||
unsigned partitionSize;
|
||||
bool automaticKitCreation;
|
||||
};
|
||||
|
||||
struct AndroidDeviceInfo
|
||||
@@ -77,6 +78,8 @@ struct AndroidDeviceInfo
|
||||
QString serialNumber;
|
||||
QString cpuABI;
|
||||
int sdk;
|
||||
|
||||
static QStringList adbSelector(const QString &serialNumber);
|
||||
};
|
||||
|
||||
class AndroidConfigurations : public QObject
|
||||
@@ -116,6 +119,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
bool createAVD(int minApiLevel = 0) const;
|
||||
void updateAutomaticKitList();
|
||||
|
||||
private:
|
||||
Utils::FileName toolPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const;
|
||||
|
||||
@@ -172,9 +172,8 @@ void AndroidDeployStep::cleanLibsOnDevice()
|
||||
return;
|
||||
}
|
||||
QProcess *process = new QProcess(this);
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("-s") << deviceSerialNumber
|
||||
<< QLatin1String("shell") << QLatin1String("rm") << QLatin1String("-r") << QLatin1String("/data/local/tmp/qt");
|
||||
QStringList arguments = AndroidDeviceInfo::adbSelector(deviceSerialNumber);
|
||||
arguments << QLatin1String("shell") << QLatin1String("rm") << QLatin1String("-r") << QLatin1String("/data/local/tmp/qt");
|
||||
connect(process, SIGNAL(finished(int)), this, SLOT(cleanLibsFinished()));
|
||||
const QString adb = AndroidConfigurations::instance().adbToolPath().toString();
|
||||
Core::MessageManager::instance()->printToOutputPanePopup(adb + QLatin1String(" ")
|
||||
@@ -262,7 +261,10 @@ int AndroidDeployStep::deviceAPILevel()
|
||||
|
||||
Utils::FileName AndroidDeployStep::localLibsRulesFilePath()
|
||||
{
|
||||
return AndroidManager::localLibsRulesFilePath(target());
|
||||
Utils::FileName fileName = AndroidManager::localLibsRulesFilePath(target());
|
||||
fileName.append(QLatin1String("/rules.xml"));
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
unsigned int AndroidDeployStep::remoteModificationTime(const QString &fullDestination, QHash<QString, unsigned int> *cache)
|
||||
@@ -272,9 +274,8 @@ unsigned int AndroidDeployStep::remoteModificationTime(const QString &fullDestin
|
||||
QHash<QString, unsigned int>::const_iterator it = cache->find(fullDestination);
|
||||
if (it != cache->constEnd())
|
||||
return *it;
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("-s") << m_deviceSerialNumber
|
||||
<< QLatin1String("ls") << destination;
|
||||
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
|
||||
arguments << QLatin1String("ls") << destination;
|
||||
process.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
|
||||
process.waitForFinished(-1);
|
||||
if (process.error() != QProcess::UnknownError
|
||||
@@ -375,7 +376,7 @@ void AndroidDeployStep::deployFiles(QProcess *process, const QList<DeployItem> &
|
||||
{
|
||||
foreach (const DeployItem &item, deployList) {
|
||||
runCommand(process, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
|
||||
<< QLatin1String("push") << item.localFileName
|
||||
<< item.remoteFileName);
|
||||
}
|
||||
@@ -429,7 +430,7 @@ bool AndroidDeployStep::deployPackage()
|
||||
|
||||
if (m_runDeployAction == InstallQASI) {
|
||||
if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
|
||||
<< QLatin1String("install") << QLatin1String("-r ") << m_runQASIPackagePath)) {
|
||||
raiseError(tr("Qt Android smart installer installation failed"));
|
||||
disconnect(deployProc, 0, this, 0);
|
||||
@@ -442,7 +443,7 @@ bool AndroidDeployStep::deployPackage()
|
||||
|
||||
writeOutput(tr("Installing package onto %1.").arg(m_deviceSerialNumber));
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber << QLatin1String("uninstall") << m_packageName);
|
||||
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber) << QLatin1String("uninstall") << m_packageName);
|
||||
QString package = m_apkPathDebug;
|
||||
|
||||
if (!(m_qtVersionQMakeBuildConfig & QtSupport::BaseQtVersion::DebugBuild)
|
||||
@@ -450,7 +451,7 @@ bool AndroidDeployStep::deployPackage()
|
||||
package = m_apkPathRelease;
|
||||
|
||||
if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber << QLatin1String("install") << package)) {
|
||||
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber) << QLatin1String("install") << package)) {
|
||||
raiseError(tr("Package installation failed."));
|
||||
disconnect(deployProc, 0, this, 0);
|
||||
deployProc->deleteLater();
|
||||
@@ -459,11 +460,11 @@ bool AndroidDeployStep::deployPackage()
|
||||
|
||||
writeOutput(tr("Pulling files necessary for debugging."));
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
|
||||
<< QLatin1String("pull") << QLatin1String("/system/bin/app_process")
|
||||
<< QString::fromLatin1("%1/app_process").arg(m_buildDirectory));
|
||||
runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber << QLatin1String("pull")
|
||||
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber) << QLatin1String("pull")
|
||||
<< QLatin1String("/system/lib/libc.so")
|
||||
<< QString::fromLatin1("%1/libc.so").arg(m_buildDirectory));
|
||||
disconnect(deployProc, 0, this, 0);
|
||||
|
||||
@@ -558,7 +558,7 @@ Utils::FileName AndroidManager::localLibsRulesFilePath(ProjectExplorer::Target *
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
|
||||
if (!version)
|
||||
return Utils::FileName();
|
||||
return Utils::FileName::fromString(version->qmakeProperty("QT_INSTALL_LIBS") + QLatin1String("/rules.xml"));
|
||||
return Utils::FileName::fromString(version->qmakeProperty("QT_INSTALL_LIBS"));
|
||||
}
|
||||
|
||||
QString AndroidManager::loadLocalLibs(ProjectExplorer::Target *target, int apiLevel)
|
||||
@@ -708,41 +708,79 @@ QString AndroidManager::loadLocal(ProjectExplorer::Target *target, int apiLevel,
|
||||
|
||||
QString localLibs;
|
||||
|
||||
QDomDocument doc;
|
||||
if (!openXmlFile(doc, localLibsRulesFilePath(target)))
|
||||
QDir rulesFilesDir(localLibsRulesFilePath(target).toString());
|
||||
if (!rulesFilesDir.exists())
|
||||
return localLibs;
|
||||
|
||||
QStringList libs;
|
||||
libs << qtLibs(target) << prebundledLibs(target);
|
||||
QDomElement element = doc.documentElement().firstChildElement(QLatin1String("platforms")).firstChildElement(itemType + QLatin1Char('s')).firstChildElement(QLatin1String("version"));
|
||||
while (!element.isNull()) {
|
||||
if (element.attribute(QLatin1String("value")).toInt() == apiLevel) {
|
||||
if (element.hasAttribute(QLatin1String("symlink")))
|
||||
apiLevel = element.attribute(QLatin1String("symlink")).toInt();
|
||||
break;
|
||||
|
||||
QFileInfoList rulesFiles = rulesFilesDir.entryInfoList(QStringList() << QLatin1String("*.xml"),
|
||||
QDir::Files | QDir::Readable);
|
||||
|
||||
QStringList dependencyLibs;
|
||||
QStringList replacedLibs;
|
||||
foreach (QFileInfo rulesFile, rulesFiles) {
|
||||
if (rulesFile.baseName() != QLatin1String("rules")
|
||||
&& !rulesFile.baseName().endsWith(QLatin1String("-android-dependencies"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QDomDocument doc;
|
||||
if (!openXmlFile(doc, Utils::FileName::fromString(rulesFile.absoluteFilePath())))
|
||||
return localLibs;
|
||||
|
||||
QDomElement element = doc.documentElement().firstChildElement(QLatin1String("platforms")).firstChildElement(itemType + QLatin1Char('s')).firstChildElement(QLatin1String("version"));
|
||||
while (!element.isNull()) {
|
||||
if (element.attribute(QLatin1String("value")).toInt() == apiLevel) {
|
||||
if (element.hasAttribute(QLatin1String("symlink")))
|
||||
apiLevel = element.attribute(QLatin1String("symlink")).toInt();
|
||||
break;
|
||||
}
|
||||
element = element.nextSiblingElement(QLatin1String("version"));
|
||||
}
|
||||
|
||||
element = doc.documentElement().firstChildElement(QLatin1String("dependencies")).firstChildElement(QLatin1String("lib"));
|
||||
while (!element.isNull()) {
|
||||
if (libs.contains(element.attribute(QLatin1String("name")))) {
|
||||
QDomElement libElement = element.firstChildElement(QLatin1String("depends")).firstChildElement(itemType);
|
||||
while (!libElement.isNull()) {
|
||||
if (libElement.hasAttribute(attribute)) {
|
||||
QString dependencyLib = libElement.attribute(attribute).arg(apiLevel);
|
||||
if (!dependencyLibs.contains(dependencyLib))
|
||||
dependencyLibs << dependencyLib;
|
||||
}
|
||||
|
||||
if (libElement.hasAttribute(QLatin1String("replaces"))) {
|
||||
QString replacedLib = libElement.attribute(QLatin1String("replaces")).arg(apiLevel);
|
||||
if (!replacedLibs.contains(replacedLib))
|
||||
replacedLibs << replacedLib;
|
||||
}
|
||||
|
||||
libElement = libElement.nextSiblingElement(itemType);
|
||||
}
|
||||
|
||||
libElement = element.firstChildElement(QLatin1String("replaces")).firstChildElement(itemType);
|
||||
while (!libElement.isNull()) {
|
||||
if (libElement.hasAttribute(attribute)) {
|
||||
QString replacedLib = libElement.attribute(attribute).arg(apiLevel);
|
||||
if (!replacedLibs.contains(replacedLib))
|
||||
replacedLibs << replacedLib;
|
||||
}
|
||||
|
||||
libElement = libElement.nextSiblingElement(itemType);
|
||||
}
|
||||
}
|
||||
element = element.nextSiblingElement(QLatin1String("lib"));
|
||||
}
|
||||
element = element.nextSiblingElement(QLatin1String("version"));
|
||||
}
|
||||
|
||||
element = doc.documentElement().firstChildElement(QLatin1String("dependencies")).firstChildElement(QLatin1String("lib"));
|
||||
while (!element.isNull()) {
|
||||
if (libs.contains(element.attribute(QLatin1String("name")))) {
|
||||
QDomElement libElement = element.firstChildElement(QLatin1String("depends")).firstChildElement(itemType);
|
||||
while (!libElement.isNull()) {
|
||||
if (libElement.hasAttribute(attribute))
|
||||
localLibs += libElement.attribute(attribute).arg(apiLevel) + QLatin1Char(':');
|
||||
libElement = libElement.nextSiblingElement(itemType);
|
||||
}
|
||||
// The next loop requires all library names to end with a ":" so we append one
|
||||
// to the end after joining.
|
||||
localLibs = dependencyLibs.join(QLatin1String(":")) + QLatin1Char(':');
|
||||
foreach (QString replacedLib, replacedLibs)
|
||||
localLibs.remove(replacedLib + QLatin1Char(':'));
|
||||
|
||||
libElement = element.firstChildElement(QLatin1String("replaces")).firstChildElement(itemType);
|
||||
while (!libElement.isNull()) {
|
||||
if (libElement.hasAttribute(attribute))
|
||||
localLibs.replace(libElement.attribute(attribute).arg(apiLevel) + QLatin1Char(':'), QString());
|
||||
libElement = libElement.nextSiblingElement(itemType);
|
||||
}
|
||||
}
|
||||
element = element.nextSiblingElement(QLatin1String("lib"));
|
||||
}
|
||||
return localLibs;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,14 +145,13 @@ bool AndroidPackageCreationStep::init()
|
||||
// Copying
|
||||
m_androidDir = AndroidManager::dirPath(target());
|
||||
Utils::FileName path = m_androidDir;
|
||||
Utils::FileName androidLibPath;
|
||||
if (project->rootQt4ProjectNode()->variableValue(Qt4ProjectManager::ConfigVar).contains(QLatin1String("x86")))
|
||||
androidLibPath = path.appendPath(QLatin1String("libs/x86"));
|
||||
else if (project->rootQt4ProjectNode()
|
||||
->variableValue(Qt4ProjectManager::ConfigVar).contains(QLatin1String("armeabi-v7a")))
|
||||
androidLibPath = path.appendPath(QLatin1String("libs/armeabi-v7a"));
|
||||
else
|
||||
androidLibPath = path.appendPath(QLatin1String("libs/armeabi"));
|
||||
QString androidTargetArch = project->rootQt4ProjectNode()->singleVariableValue(Qt4ProjectManager::AndroidArchVar);
|
||||
if (androidTargetArch.isEmpty()) {
|
||||
raiseError(tr("Cannot create Android package: No ANDROID_TARGET_ARCH set in make spec."));
|
||||
return false;
|
||||
}
|
||||
|
||||
Utils::FileName androidLibPath = path.appendPath(QLatin1String("libs/") + androidTargetArch);
|
||||
m_gdbServerDestination = androidLibPath.appendPath(QLatin1String("gdbserver"));
|
||||
m_gdbServerSource = AndroidGdbServerKitInformation::gdbServer(target()->kit());
|
||||
m_debugBuild = bc->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild;
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
#include "androidqtversionfactory.h"
|
||||
#include "androiddeployconfiguration.h"
|
||||
#include "androidgdbserverkitinformation.h"
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
@@ -80,6 +82,17 @@ void AndroidPlugin::extensionsInitialized()
|
||||
ProjectExplorer::DeviceManager *dm = ProjectExplorer::DeviceManager::instance();
|
||||
if (dm->find(Core::Id(Constants::ANDROID_DEVICE_ID)).isNull())
|
||||
dm->addDevice(ProjectExplorer::IDevice::Ptr(new Internal::AndroidDevice));
|
||||
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsChanged()),
|
||||
this, SLOT(kitsRestored()));
|
||||
}
|
||||
|
||||
void AndroidPlugin::kitsRestored()
|
||||
{
|
||||
Internal::AndroidConfigurations::instance().updateAutomaticKitList();
|
||||
connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
|
||||
&Internal::AndroidConfigurations::instance(), SLOT(updateAutomaticKitList()));
|
||||
disconnect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsChanged()),
|
||||
this, SLOT(kitsRestored()));
|
||||
}
|
||||
|
||||
} // namespace Android
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage);
|
||||
void extensionsInitialized();
|
||||
private slots:
|
||||
void kitsRestored();
|
||||
};
|
||||
|
||||
} // namespace Android
|
||||
|
||||
@@ -89,9 +89,15 @@ QString AndroidQtVersion::invalidReason() const
|
||||
|
||||
QList<ProjectExplorer::Abi> AndroidQtVersion::detectQtAbis() const
|
||||
{
|
||||
return QList<ProjectExplorer::Abi>() << ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
|
||||
ProjectExplorer::Abi::AndroidLinuxFlavor, ProjectExplorer::Abi::ElfFormat,
|
||||
32);
|
||||
QList<ProjectExplorer::Abi> abis = qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString()));
|
||||
for (int i = 0; i < abis.count(); ++i) {
|
||||
abis[i] = Abi(abis.at(i).architecture(),
|
||||
abis.at(i).os(),
|
||||
ProjectExplorer::Abi::AndroidLinuxFlavor,
|
||||
abis.at(i).binaryFormat(),
|
||||
abis.at(i).wordWidth());
|
||||
}
|
||||
return abis;
|
||||
}
|
||||
|
||||
void AndroidQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const
|
||||
|
||||
@@ -80,7 +80,7 @@ void AndroidRunner::checkPID()
|
||||
|
||||
// Detect busybox, as we need to pass -w to it to get wide output.
|
||||
psProc.start(AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
|
||||
<< QLatin1String("shell") << QLatin1String("readlink") << QLatin1String("$(which ps)"));
|
||||
if (!psProc.waitForFinished(-1)) {
|
||||
psProc.kill();
|
||||
@@ -93,7 +93,7 @@ void AndroidRunner::checkPID()
|
||||
}
|
||||
|
||||
psProc.start(AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
|
||||
<< QLatin1String("shell") << psCmd);
|
||||
if (!psProc.waitForFinished(-1)) {
|
||||
psProc.kill();
|
||||
@@ -161,9 +161,8 @@ void AndroidRunner::asyncStart()
|
||||
QString extraParams;
|
||||
QProcess adbStarProc;
|
||||
if (m_useCppDebugger) {
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("-s") << m_deviceSerialNumber
|
||||
<< QLatin1String("forward") << QString::fromLatin1("tcp%1").arg(m_remoteGdbChannel)
|
||||
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
|
||||
arguments << QLatin1String("forward") << QString::fromLatin1("tcp%1").arg(m_remoteGdbChannel)
|
||||
<< QString::fromLatin1("localfilesystem:/data/data/%1/debug-socket").arg(m_packageName);
|
||||
adbStarProc.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
|
||||
if (!adbStarProc.waitForStarted()) {
|
||||
@@ -177,10 +176,9 @@ void AndroidRunner::asyncStart()
|
||||
extraParams = QLatin1String("-e native_debug true -e gdbserver_socket +debug-socket");
|
||||
}
|
||||
if (m_useQmlDebugger) {
|
||||
QStringList arguments;
|
||||
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
|
||||
QString port = QString::fromLatin1("tcp:%1").arg(m_qmlPort);
|
||||
arguments << QLatin1String("-s") << m_deviceSerialNumber
|
||||
<< QLatin1String("forward") << port << port; // currently forward to same port on device and host
|
||||
arguments << QLatin1String("forward") << port << port; // currently forward to same port on device and host
|
||||
adbStarProc.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
|
||||
if (!adbStarProc.waitForStarted()) {
|
||||
emit remoteProcessFinished(tr("Failed to forward QML debugging ports. Reason: %1.").arg(adbStarProc.errorString()));
|
||||
@@ -204,9 +202,8 @@ void AndroidRunner::asyncStart()
|
||||
}
|
||||
|
||||
extraParams = extraParams.trimmed();
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("-s") << m_deviceSerialNumber
|
||||
<< QLatin1String("shell") << QLatin1String("am")
|
||||
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
|
||||
arguments << QLatin1String("shell") << QLatin1String("am")
|
||||
<< QLatin1String("start") << QLatin1String("-n") << m_intentName;
|
||||
|
||||
if (extraParams.length())
|
||||
@@ -246,7 +243,7 @@ void AndroidRunner::startLogcat()
|
||||
{
|
||||
m_checkPIDTimer.start(1000); // check if the application is alive every 1 seconds
|
||||
m_adbLogcatProcess.start(AndroidConfigurations::instance().adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << m_deviceSerialNumber
|
||||
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
|
||||
<< QLatin1String("logcat"));
|
||||
emit remoteProcessStarted(5039);
|
||||
}
|
||||
@@ -294,9 +291,8 @@ void AndroidRunner::logcatReadStandardOutput()
|
||||
void AndroidRunner::adbKill(qint64 pid, const QString &device, int timeout, const QString &runAsPackageName)
|
||||
{
|
||||
QProcess process;
|
||||
QStringList arguments;
|
||||
QStringList arguments = AndroidDeviceInfo::adbSelector(device);
|
||||
|
||||
arguments << QLatin1String("-s") << device;
|
||||
arguments << QLatin1String("shell");
|
||||
if (runAsPackageName.size())
|
||||
arguments << QLatin1String("run-as") << runAsPackageName;
|
||||
|
||||
@@ -82,6 +82,17 @@ void AndroidSettingsPage::apply()
|
||||
else
|
||||
ProjectExplorer::ToolChainManager::instance()->registerToolChain(tc);
|
||||
}
|
||||
|
||||
for (int i = 0; i < existingToolChains.count(); ++i) {
|
||||
ProjectExplorer::ToolChain *tc = existingToolChains.at(i);
|
||||
if (tc->type() == QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE)) {
|
||||
if (!tc->isValid()) {
|
||||
ProjectExplorer::ToolChainManager::instance()->deregisterToolChain(tc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AndroidConfigurations::instance().updateAutomaticKitList();
|
||||
}
|
||||
|
||||
void AndroidSettingsPage::finish()
|
||||
|
||||
@@ -32,10 +32,15 @@
|
||||
#include "ui_androidsettingswidget.h"
|
||||
|
||||
#include "androidconfigurations.h"
|
||||
|
||||
#include "androidconstants.h"
|
||||
#include "androidtoolchain.h"
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
@@ -150,6 +155,7 @@ void AndroidSettingsWidget::initGui()
|
||||
m_ui->AntLocationLineEdit->setText(m_androidConfig.antLocation.toUserOutput());
|
||||
m_ui->OpenJDKLocationLineEdit->setText(m_androidConfig.openJDKLocation.toUserOutput());
|
||||
m_ui->DataPartitionSizeSpinBox->setValue(m_androidConfig.partitionSize);
|
||||
m_ui->CreateKitCheckBox->setChecked(m_androidConfig.automaticKitCreation);
|
||||
m_ui->AVDTableView->setModel(&m_AVDModel);
|
||||
m_AVDModel.setAvdList(AndroidConfigurations::instance().androidVirtualDevices());
|
||||
m_ui->AVDTableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
||||
@@ -186,19 +192,79 @@ bool AndroidSettingsWidget::checkSDK(const Utils::FileName &location)
|
||||
return true;
|
||||
}
|
||||
|
||||
int indexOf(const QList<AndroidToolChainFactory::AndroidToolChainInformation> &list, const Utils::FileName &f)
|
||||
{
|
||||
int end = list.count();
|
||||
for (int i = 0; i < end; ++i) {
|
||||
if (list.at(i).compilerCommand == f)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool AndroidSettingsWidget::checkNDK(const Utils::FileName &location)
|
||||
{
|
||||
if (location.isEmpty())
|
||||
if (location.isEmpty()) {
|
||||
m_ui->ndkWarningIconLabel->setVisible(false);
|
||||
m_ui->toolchainFoundLabel->setVisible(false);
|
||||
m_ui->kitWarningIconLabel->setVisible(false);
|
||||
m_ui->kitWarningLabel->setVisible(false);
|
||||
return false;
|
||||
}
|
||||
Utils::FileName platformPath = location;
|
||||
Utils::FileName toolChainPath = location;
|
||||
Utils::FileName sourcesPath = location;
|
||||
if (!platformPath.appendPath(QLatin1String("platforms")).toFileInfo().exists()
|
||||
|| !toolChainPath.appendPath(QLatin1String("toolchains")).toFileInfo().exists()
|
||||
|| !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).toFileInfo().exists()) {
|
||||
QMessageBox::critical(this, tr("Android NDK Folder"), tr("\"%1\" does not seem to be an Android NDK top folder.").arg(location.toUserOutput()));
|
||||
m_ui->toolchainFoundLabel->setText(tr("\"%1\" does not seem to be an Android NDK top folder.").arg(location.toUserOutput()));
|
||||
m_ui->toolchainFoundLabel->setVisible(true);
|
||||
m_ui->ndkWarningIconLabel->setVisible(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check how many toolchains we could add...
|
||||
QList<AndroidToolChainFactory::AndroidToolChainInformation> compilerPaths = AndroidToolChainFactory::toolchainPathsForNdk(location);
|
||||
if (compilerPaths.isEmpty()) {
|
||||
m_ui->ndkWarningIconLabel->setVisible(false);
|
||||
m_ui->toolchainFoundLabel->setVisible(false);
|
||||
} else {
|
||||
m_ui->ndkWarningIconLabel->setVisible(false);
|
||||
m_ui->toolchainFoundLabel->setText(tr("Found %n toolchains for this NDK.", 0, compilerPaths.count()));
|
||||
m_ui->toolchainFoundLabel->setVisible(true);
|
||||
}
|
||||
|
||||
// See if we have qt versions for those toolchains
|
||||
QSet<ProjectExplorer::Abi::Architecture> toolchainsForArch;
|
||||
foreach (const AndroidToolChainFactory::AndroidToolChainInformation &ati, compilerPaths)
|
||||
toolchainsForArch.insert(ati.architecture);
|
||||
|
||||
QSet<ProjectExplorer::Abi::Architecture> qtVersionsForArch;
|
||||
foreach (QtSupport::BaseQtVersion *qtVersion, QtSupport::QtVersionManager::instance()->versions()) {
|
||||
if (qtVersion->type() != QLatin1String(Constants::ANDROIDQT))
|
||||
continue;
|
||||
qtVersionsForArch.insert(qtVersion->qtAbis().first().architecture());
|
||||
}
|
||||
|
||||
QSet<ProjectExplorer::Abi::Architecture> missingQtArchs = toolchainsForArch.subtract(qtVersionsForArch);
|
||||
if (missingQtArchs.isEmpty()) {
|
||||
m_ui->kitWarningIconLabel->setVisible(false);
|
||||
m_ui->kitWarningLabel->setVisible(false);
|
||||
} else {
|
||||
m_ui->kitWarningIconLabel->setVisible(true);
|
||||
m_ui->kitWarningLabel->setVisible(true);
|
||||
if (missingQtArchs.count() == 1) {
|
||||
m_ui->kitWarningLabel->setText(tr("Qt version for architecture %1 is missing.\n To add the Qt version, select Options > Build & Run > Qt Versions.")
|
||||
.arg(ProjectExplorer::Abi::toString((*missingQtArchs.constBegin()))));
|
||||
} else {
|
||||
QStringList missingArchs;
|
||||
foreach (ProjectExplorer::Abi::Architecture arch, missingQtArchs)
|
||||
missingArchs.append(ProjectExplorer::Abi::toString(arch));
|
||||
m_ui->kitWarningLabel->setText(tr("Qt versions for architectures %1 are missing.\n To add the Qt versions, select Options > Build & Run > Qt Versions.")
|
||||
.arg(missingArchs.join(QLatin1String(", "))));
|
||||
}
|
||||
}
|
||||
|
||||
m_androidConfig.ndkLocation = location;
|
||||
return true;
|
||||
|
||||
@@ -243,7 +309,9 @@ void AndroidSettingsWidget::openJDKLocationEditingFinished()
|
||||
|
||||
void AndroidSettingsWidget::browseSDKLocation()
|
||||
{
|
||||
Utils::FileName dir = Utils::FileName::fromString(QFileDialog::getExistingDirectory(this, tr("Select Android SDK folder")));
|
||||
Utils::FileName dir = Utils::FileName::fromString(
|
||||
QFileDialog::getExistingDirectory(this, tr("Select Android SDK folder"),
|
||||
m_ui->SDKLocationLineEdit->text()));
|
||||
if (!checkSDK(dir))
|
||||
return;
|
||||
m_ui->SDKLocationLineEdit->setText(dir.toUserOutput());
|
||||
@@ -252,7 +320,9 @@ void AndroidSettingsWidget::browseSDKLocation()
|
||||
|
||||
void AndroidSettingsWidget::browseNDKLocation()
|
||||
{
|
||||
Utils::FileName dir = Utils::FileName::fromString(QFileDialog::getExistingDirectory(this, tr("Select Android NDK folder")));
|
||||
Utils::FileName dir = Utils::FileName::fromString(
|
||||
QFileDialog::getExistingDirectory(this, tr("Select Android NDK folder"),
|
||||
m_ui->NDKLocationLineEdit->text()));
|
||||
if (!checkNDK(dir))
|
||||
return;
|
||||
m_ui->NDKLocationLineEdit->setText(dir.toUserOutput());
|
||||
@@ -317,6 +387,11 @@ void AndroidSettingsWidget::dataPartitionSizeEditingFinished()
|
||||
m_androidConfig.partitionSize = m_ui->DataPartitionSizeSpinBox->value();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::createKitToggled()
|
||||
{
|
||||
m_androidConfig.automaticKitCreation = m_ui->CreateKitCheckBox->isChecked();
|
||||
}
|
||||
|
||||
void AndroidSettingsWidget::manageAVD()
|
||||
{
|
||||
QProcess *avdProcess = new QProcess();
|
||||
|
||||
@@ -87,6 +87,7 @@ private slots:
|
||||
void avdActivated(QModelIndex);
|
||||
void dataPartitionSizeEditingFinished();
|
||||
void manageAVD();
|
||||
void createKitToggled();
|
||||
|
||||
private:
|
||||
void initGui();
|
||||
|
||||
@@ -16,8 +16,46 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="SDKLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<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="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="NDKLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Android NDK location:</string>
|
||||
</property>
|
||||
@@ -37,17 +75,65 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="AntLocationLineEdit"/>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="ndkWarningIconLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_error.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="toolchainFoundLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="AntLocationPushButton">
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="CreateKitCheckBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
<string>Automatically create kits for Android tool chains</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="AntLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ant location:</string>
|
||||
</property>
|
||||
@@ -56,8 +142,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="AntLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="AntLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="OpenJDKLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OpenJDK location:</string>
|
||||
</property>
|
||||
@@ -66,35 +168,54 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="OpenJDKLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<item row="6" 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>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</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>
|
||||
<widget class="QLabel" name="kitWarningIconLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="kitWarningLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@@ -107,22 +228,6 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0" rowspan="4">
|
||||
<widget class="QTableView" name="AVDTableView">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="textElideMode">
|
||||
<enum>Qt::ElideMiddle</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="AVDStartPushButton">
|
||||
<property name="enabled">
|
||||
@@ -133,19 +238,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>129</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@@ -197,13 +289,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="AVDAddPushButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="AVDRemovePushButton">
|
||||
<property name="enabled">
|
||||
@@ -214,12 +299,50 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="AVDAddPushButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" rowspan="4">
|
||||
<widget class="QTableView" name="AVDTableView">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="textElideMode">
|
||||
<enum>Qt::ElideMiddle</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>129</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../projectexplorer/projectexplorer.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>NDKLocationLineEdit</sender>
|
||||
@@ -461,6 +584,22 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>CreateKitCheckBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>AndroidSettingsWidget</receiver>
|
||||
<slot>createKitToggled()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>358</x>
|
||||
<y>99</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>339</x>
|
||||
<y>220</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>sdkLocationEditingFinished()</slot>
|
||||
@@ -477,5 +616,6 @@
|
||||
<slot>openJDKLocationEditingFinished()</slot>
|
||||
<slot>browseOpenJDKLocation()</slot>
|
||||
<slot>manageAVD()</slot>
|
||||
<slot>createKitToggled()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
@@ -101,7 +101,8 @@ QString AndroidToolChain::typeDisplayName() const
|
||||
|
||||
bool AndroidToolChain::isValid() const
|
||||
{
|
||||
return GccToolChain::isValid() && targetAbi().isValid() && !m_ndkToolChainVersion.isEmpty();
|
||||
return GccToolChain::isValid() && targetAbi().isValid() && !m_ndkToolChainVersion.isEmpty()
|
||||
&& compilerCommand().isChildOf(AndroidConfigurations::instance().config().ndkLocation);
|
||||
}
|
||||
|
||||
void AndroidToolChain::addToEnvironment(Environment &env) const
|
||||
@@ -280,6 +281,39 @@ ToolChain *AndroidToolChainFactory::restore(const QVariantMap &data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
QList<AndroidToolChainFactory::AndroidToolChainInformation> AndroidToolChainFactory::toolchainPathsForNdk(const Utils::FileName &ndkPath)
|
||||
{
|
||||
QList<AndroidToolChainInformation> result;
|
||||
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;
|
||||
AndroidToolChainInformation ati;
|
||||
ati.version = fileName.mid(idx + 1);
|
||||
QString platform = fileName.left(idx);
|
||||
ati.architecture = AndroidConfigurations::architectureForToolChainPrefix(platform);
|
||||
if (ati.architecture == Abi::UnknownArchitecture) // e.g. mipsel which is not yet supported
|
||||
continue;
|
||||
// AndroidToolChain *tc = new AndroidToolChain(arch, version, true);
|
||||
ati.compilerCommand = ndkPath;
|
||||
ati.compilerCommand.appendPath(QString::fromLatin1("toolchains/%1/prebuilt/%3/bin/%4")
|
||||
.arg(fileName)
|
||||
.arg(ToolchainHost)
|
||||
.arg(AndroidConfigurations::toolsPrefix(ati.architecture)));
|
||||
ati.compilerCommand.append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX));
|
||||
// tc->setCompilerCommand(compilerPath);
|
||||
result.append(ati);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<ToolChain *> AndroidToolChainFactory::createToolChainsForNdk(const Utils::FileName &ndkPath)
|
||||
{
|
||||
QList<ToolChain *> result;
|
||||
|
||||
@@ -103,7 +103,16 @@ public:
|
||||
bool canRestore(const QVariantMap &data);
|
||||
ProjectExplorer::ToolChain *restore(const QVariantMap &data);
|
||||
|
||||
class AndroidToolChainInformation
|
||||
{
|
||||
public:
|
||||
Utils::FileName compilerCommand;
|
||||
ProjectExplorer::Abi::Architecture architecture;
|
||||
QString version;
|
||||
};
|
||||
|
||||
static QList<ProjectExplorer::ToolChain *> createToolChainsForNdk(const Utils::FileName &ndkPath);
|
||||
static QList<AndroidToolChainInformation> toolchainPathsForNdk(const Utils::FileName &ndkPath);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user