forked from qt-creator/qt-creator
Android: avoid scanning mkspecs to detect android abi
Use the abi information from the modules/*.json files instead. Those json files are part of a Qt installation since Qt 6.0. Fallback to the old mkspec parsing for older Qt Versions. Fixes: QTCREATORBUG-31068 Change-Id: I18fcea17233eaf2bdc562b9b36718c29eddd1dbe Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -82,8 +82,12 @@ bool AndroidQtVersion::supportsMultipleQtAbis() const
|
|||||||
|
|
||||||
Abis AndroidQtVersion::detectQtAbis() const
|
Abis AndroidQtVersion::detectQtAbis() const
|
||||||
{
|
{
|
||||||
const bool conf = AndroidConfig::sdkFullyConfigured();
|
Abis result = qtAbisFromJson();
|
||||||
return conf ? Utils::transform<Abis>(androidAbis(), &androidAbi2Abi) : Abis();
|
if (result.isEmpty() && AndroidConfig::sdkFullyConfigured()) {
|
||||||
|
ensureMkSpecParsed();
|
||||||
|
result = Utils::transform<Abis>(m_androidAbis, &androidAbi2Abi);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidQtVersion::addToBuildEnvironment(const Kit *k, Utils::Environment &env) const
|
void AndroidQtVersion::addToBuildEnvironment(const Kit *k, Utils::Environment &env) const
|
||||||
@@ -109,10 +113,9 @@ QString AndroidQtVersion::description() const
|
|||||||
return Tr::tr("Android");
|
return Tr::tr("Android");
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList &AndroidQtVersion::androidAbis() const
|
const QStringList AndroidQtVersion::androidAbis() const
|
||||||
{
|
{
|
||||||
ensureMkSpecParsed();
|
return Utils::transform(detectQtAbis(), &Abi::toAndroidAbi);
|
||||||
return m_androidAbis;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int AndroidQtVersion::minimumNDK() const
|
int AndroidQtVersion::minimumNDK() const
|
||||||
|
@@ -25,7 +25,7 @@ public:
|
|||||||
QSet<Utils::Id> targetDeviceTypes() const override;
|
QSet<Utils::Id> targetDeviceTypes() const override;
|
||||||
|
|
||||||
QString description() const override;
|
QString description() const override;
|
||||||
const QStringList &androidAbis() const;
|
const QStringList androidAbis() const;
|
||||||
int minimumNDK() const;
|
int minimumNDK() const;
|
||||||
|
|
||||||
static QString androidDeploymentSettingsFileName(const ProjectExplorer::Target *target);
|
static QString androidDeploymentSettingsFileName(const ProjectExplorer::Target *target);
|
||||||
|
@@ -443,18 +443,6 @@ static Abis abiOf(const QByteArray &data)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString androidAbiFromAbi(const Abi &abi)
|
|
||||||
{
|
|
||||||
QString androidAbi;
|
|
||||||
if (abi.architecture() == Abi::Architecture::ArmArchitecture)
|
|
||||||
androidAbi = QLatin1String(abi.wordWidth() == 64 ? Constants::ANDROID_ABI_ARM64_V8A
|
|
||||||
: Constants::ANDROID_ABI_ARMEABI_V7A);
|
|
||||||
else
|
|
||||||
androidAbi = QLatin1String(abi.wordWidth() == 64 ? Constants::ANDROID_ABI_X86_64
|
|
||||||
: Constants::ANDROID_ABI_X86);
|
|
||||||
return androidAbi;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Abi
|
// Abi
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@@ -689,6 +677,22 @@ QString Abi::param() const
|
|||||||
return m_param;
|
return m_param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Abi::toAndroidAbi() const
|
||||||
|
{
|
||||||
|
if (architecture() == Abi::Architecture::ArmArchitecture) {
|
||||||
|
if (wordWidth() == 32)
|
||||||
|
return Constants::ANDROID_ABI_ARMEABI_V7A;
|
||||||
|
if (wordWidth() == 64)
|
||||||
|
return Constants::ANDROID_ABI_ARM64_V8A;
|
||||||
|
} else if (architecture() == Abi::Architecture::X86Architecture) {
|
||||||
|
if (wordWidth() == 32)
|
||||||
|
return Constants::ANDROID_ABI_X86;
|
||||||
|
if (wordWidth() == 64)
|
||||||
|
return Constants::ANDROID_ABI_X86_64;
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
bool Abi::operator != (const Abi &other) const
|
bool Abi::operator != (const Abi &other) const
|
||||||
{
|
{
|
||||||
return !operator ==(other);
|
return !operator ==(other);
|
||||||
@@ -936,7 +940,7 @@ Abi Abi::fromString(const QString &abiString)
|
|||||||
|
|
||||||
Abi abi(architecture, os, flavor, format, wordWidth);
|
Abi abi(architecture, os, flavor, format, wordWidth);
|
||||||
if (abi.os() == LinuxOS && abi.osFlavor() == AndroidLinuxFlavor)
|
if (abi.os() == LinuxOS && abi.osFlavor() == AndroidLinuxFlavor)
|
||||||
abi.m_param = androidAbiFromAbi(abi);
|
abi.m_param = abi.toAndroidAbi();
|
||||||
|
|
||||||
return abi;
|
return abi;
|
||||||
}
|
}
|
||||||
|
@@ -144,6 +144,8 @@ public:
|
|||||||
QString toString() const;
|
QString toString() const;
|
||||||
QString param() const;
|
QString param() const;
|
||||||
|
|
||||||
|
QString toAndroidAbi() const;
|
||||||
|
|
||||||
static QString toString(const Architecture &a);
|
static QString toString(const Architecture &a);
|
||||||
static QString toString(const OS &o);
|
static QString toString(const OS &o);
|
||||||
static QString toString(const OSFlavor &of);
|
static QString toString(const OSFlavor &of);
|
||||||
|
@@ -751,14 +751,17 @@ void QtVersion::setQtAbis(const Abis &abis)
|
|||||||
Abis QtVersion::detectQtAbis() const
|
Abis QtVersion::detectQtAbis() const
|
||||||
{
|
{
|
||||||
qCDebug(abiDetect) << "Detecting ABIs for" << qmakeFilePath();
|
qCDebug(abiDetect) << "Detecting ABIs for" << qmakeFilePath();
|
||||||
if (const Abis abis = qtAbisFromJson(*this, {d->data().archDataPath, d->data().dataPath});
|
if (const Abis abis = qtAbisFromJson(); !abis.isEmpty())
|
||||||
!abis.isEmpty()) {
|
|
||||||
return abis;
|
return abis;
|
||||||
}
|
|
||||||
qCDebug(abiDetect) << "Got no ABI from JSON file, falling back to inspecting binaries";
|
qCDebug(abiDetect) << "Got no ABI from JSON file, falling back to inspecting binaries";
|
||||||
return d->qtAbisFromLibrary();
|
return d->qtAbisFromLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Abis QtVersion::qtAbisFromJson() const
|
||||||
|
{
|
||||||
|
return QtSupport::Internal::qtAbisFromJson(*this, {d->data().archDataPath, d->data().dataPath});
|
||||||
|
}
|
||||||
|
|
||||||
bool QtVersion::hasAbi(ProjectExplorer::Abi::OS os, ProjectExplorer::Abi::OSFlavor flavor) const
|
bool QtVersion::hasAbi(ProjectExplorer::Abi::OS os, ProjectExplorer::Abi::OSFlavor flavor) const
|
||||||
{
|
{
|
||||||
const Abis abis = qtAbis();
|
const Abis abis = qtAbis();
|
||||||
|
@@ -203,6 +203,7 @@ protected:
|
|||||||
const Utils::FilePath &buildDir) const;
|
const Utils::FilePath &buildDir) const;
|
||||||
|
|
||||||
virtual ProjectExplorer::Abis detectQtAbis() const;
|
virtual ProjectExplorer::Abis detectQtAbis() const;
|
||||||
|
ProjectExplorer::Abis qtAbisFromJson() const;
|
||||||
|
|
||||||
void resetCache() const;
|
void resetCache() const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user