Commit 723d4a97 authored by Daniel Teske's avatar Daniel Teske

Android: Distinguish between platforms in the ndk and the sdk

The available platforms in the ndk might not be the same as in the sdk.
This patch is renames everything using the ndk platform list to
ndkPlatforms, except the highestAvailablePlatform which wrongly uses
the ndk platform list.

Change-Id: I02d9b68bbc27b0c748281678fe654d5f4244578d
Reviewed-by: default avatarBogDan Vatra <bogdan@kde.org>
parent 5e10114e
......@@ -223,22 +223,22 @@ void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
detectToolchainHost();
save();
updateAvailablePlatforms();
updateAvailableNdkPlatforms();
updateAutomaticKitList();
updateAndroidDevice();
emit updated();
}
void AndroidConfigurations::updateAvailablePlatforms()
void AndroidConfigurations::updateAvailableNdkPlatforms()
{
m_availablePlatforms.clear();
m_availableNdkPlatforms.clear();
FileName path = m_config.ndkLocation;
QDirIterator it(path.appendPath(QLatin1String("platforms")).toString(), QStringList() << QLatin1String("android-*"), QDir::Dirs);
while (it.hasNext()) {
const QString &fileName = it.next();
m_availablePlatforms.push_back(fileName.mid(fileName.lastIndexOf(QLatin1Char('-')) + 1).toInt());
m_availableNdkPlatforms.push_back(fileName.mid(fileName.lastIndexOf(QLatin1Char('-')) + 1).toInt());
}
qSort(m_availablePlatforms.begin(), m_availablePlatforms.end(), qGreater<int>());
qSort(m_availableNdkPlatforms.begin(), m_availableNdkPlatforms.end(), qGreater<int>());
}
QStringList AndroidConfigurations::sdkTargets(int minApiLevel) const
......@@ -737,15 +737,15 @@ QStringList AndroidConfigurations::getAbis(const QString &device) const
QString AndroidConfigurations::highestAvailableAndroidPlatform() const
{
if (m_availablePlatforms.isEmpty())
if (m_availableNdkPlatforms.isEmpty())
return QString();
return QLatin1String("android-") + QString::number(m_availablePlatforms.first());
return QLatin1String("android-") + QString::number(m_availableNdkPlatforms.first());
}
QString AndroidConfigurations::bestMatch(const QString &targetAPI) const
QString AndroidConfigurations::bestNdkPlatformMatch(const QString &targetAPI) const
{
int target = targetAPI.mid(targetAPI.lastIndexOf(QLatin1Char('-')) + 1).toInt();
foreach (int apiLevel, m_availablePlatforms) {
foreach (int apiLevel, m_availableNdkPlatforms) {
if (apiLevel <= target)
return QString::fromLatin1("android-%1").arg(apiLevel);
}
......@@ -901,7 +901,7 @@ AndroidConfigurations::AndroidConfigurations(QObject *parent)
: QObject(parent)
{
load();
updateAvailablePlatforms();
updateAvailableNdkPlatforms();
connect(ProjectExplorer::SessionManager::instance(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(clearDefaultDevices(ProjectExplorer::Project*)));
......
......@@ -107,7 +107,7 @@ public:
QString startAVD(const QString &name, int apiLevel, QString cpuAbi) const;
bool startAVDAsync(const QString &avdName) const;
QString waitForAvd(int apiLevel, const QString &cpuAbi) const;
QString bestMatch(const QString &targetAPI) const;
QString bestNdkPlatformMatch(const QString &targetAPI) const;
QStringList makeExtraSearchDirectories() const;
......@@ -145,12 +145,12 @@ private:
int getSDKVersion(const QString &device) const;
QStringList getAbis(const QString &device) const;
void updateAvailablePlatforms();
void updateAvailableNdkPlatforms();
static AndroidConfigurations *m_instance;
AndroidConfig m_config;
QVector<int> m_availablePlatforms;
QVector<int> m_availableNdkPlatforms;
mutable QHash<QString, QString> m_serialNumberToDeviceName;
QMap<ProjectExplorer::Project *, QMap<QString, QString> > m_defaultDeviceForAbi;
......
......@@ -122,8 +122,7 @@ void AndroidQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::En
return;
env.set(QLatin1String("ANDROID_NDK_PLATFORM"),
AndroidConfigurations::instance().bestMatch(AndroidManager::buildTargetSDK(target)));
AndroidConfigurations::instance().bestNdkPlatformMatch(AndroidManager::buildTargetSDK(target)));
}
QString AndroidQtVersion::description() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment