forked from qt-creator/qt-creator
QtSupport: Add supportsMultipleQtAbis getter
Introduce bool QtSupport::supportsMultipleQtAbis(). Let AndroidQtVersion respond according to the QVersionNumber. This allows to replace the version arithmetics in several places with straight forward (and better findable) function calls. Task-number: QTCREATORBUG-24471 Change-Id: Ib6e39fd6485a54e08ad66f84d4e2582989043419 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -390,7 +390,7 @@ void AndroidBuildApkStep::doRun()
|
|||||||
|
|
||||||
QJsonObject deploySettings = Android::AndroidManager::deploymentSettings(target());
|
QJsonObject deploySettings = Android::AndroidManager::deploymentSettings(target());
|
||||||
QString applicationBinary;
|
QString applicationBinary;
|
||||||
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 14, 0)) {
|
if (!version->supportsMultipleQtAbis()) {
|
||||||
QTC_ASSERT(androidAbis.size() == 1, return false);
|
QTC_ASSERT(androidAbis.size() == 1, return false);
|
||||||
applicationBinary = buildSystem()->buildTarget(buildKey).targetFilePath.toString();
|
applicationBinary = buildSystem()->buildTarget(buildKey).targetFilePath.toString();
|
||||||
FilePath androidLibsDir = buildDirectory() / "android-build/libs" / androidAbis.first();
|
FilePath androidLibsDir = buildDirectory() / "android-build/libs" / androidAbis.first();
|
||||||
|
@@ -235,7 +235,7 @@ QWidget *AndroidBuildApkWidget::createAdvancedGroup()
|
|||||||
|
|
||||||
auto vbox = new QVBoxLayout(group);
|
auto vbox = new QVBoxLayout(group);
|
||||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(step()->target()->kit());
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(step()->target()->kit());
|
||||||
if (version && version->qtVersion() >= QtSupport::QtVersionNumber{5,14}) {
|
if (version && version->supportsMultipleQtAbis()) {
|
||||||
auto buildAAB = new QCheckBox(tr("Build .aab (Android App Bundle)"), group);
|
auto buildAAB = new QCheckBox(tr("Build .aab (Android App Bundle)"), group);
|
||||||
buildAAB->setChecked(m_step->buildAAB());
|
buildAAB->setChecked(m_step->buildAAB());
|
||||||
connect(buildAAB, &QAbstractButton::toggled, m_step, &AndroidBuildApkStep::setBuildAAB);
|
connect(buildAAB, &QAbstractButton::toggled, m_step, &AndroidBuildApkStep::setBuildAAB);
|
||||||
|
@@ -287,7 +287,7 @@ QJsonObject AndroidManager::deploymentSettings(const Target *target)
|
|||||||
settings["qt"] = qt->prefix().toString();
|
settings["qt"] = qt->prefix().toString();
|
||||||
settings["ndk"] = AndroidConfigurations::currentConfig().ndkLocation(qt).toString();
|
settings["ndk"] = AndroidConfigurations::currentConfig().ndkLocation(qt).toString();
|
||||||
settings["sdk"] = AndroidConfigurations::currentConfig().sdkLocation().toString();
|
settings["sdk"] = AndroidConfigurations::currentConfig().sdkLocation().toString();
|
||||||
if (qt->qtVersion() < QtSupport::QtVersionNumber(5, 14, 0)) {
|
if (!qt->supportsMultipleQtAbis()) {
|
||||||
const QStringList abis = applicationAbis(target);
|
const QStringList abis = applicationAbis(target);
|
||||||
QTC_ASSERT(abis.size() == 1, return {});
|
QTC_ASSERT(abis.size() == 1, return {});
|
||||||
settings["stdcpp-path"] = (AndroidConfigurations::currentConfig().toolchainPath(qt)
|
settings["stdcpp-path"] = (AndroidConfigurations::currentConfig().toolchainPath(qt)
|
||||||
|
@@ -84,6 +84,11 @@ QString AndroidQtVersion::invalidReason() const
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AndroidQtVersion::supportsMultipleQtAbis() const
|
||||||
|
{
|
||||||
|
return qtVersion() >= QtSupport::QtVersionNumber{5, 14};
|
||||||
|
}
|
||||||
|
|
||||||
Abis AndroidQtVersion::detectQtAbis() const
|
Abis AndroidQtVersion::detectQtAbis() const
|
||||||
{
|
{
|
||||||
auto androidAbi2Abi = [](const QString &androidAbi) {
|
auto androidAbi2Abi = [](const QString &androidAbi) {
|
||||||
@@ -165,7 +170,7 @@ int AndroidQtVersion::minimumNDK() const
|
|||||||
|
|
||||||
void AndroidQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
void AndroidQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
||||||
{
|
{
|
||||||
if (qtVersion() >= QtSupport::QtVersionNumber{5, 14})
|
if (supportsMultipleQtAbis())
|
||||||
m_androidAbis = evaluator->values("ALL_ANDROID_ABIS");
|
m_androidAbis = evaluator->values("ALL_ANDROID_ABIS");
|
||||||
else
|
else
|
||||||
m_androidAbis = QStringList{evaluator->value("ANDROID_TARGET_ARCH")};
|
m_androidAbis = QStringList{evaluator->value("ANDROID_TARGET_ARCH")};
|
||||||
|
@@ -43,6 +43,7 @@ public:
|
|||||||
bool isValid() const override;
|
bool isValid() const override;
|
||||||
QString invalidReason() const override;
|
QString invalidReason() const override;
|
||||||
|
|
||||||
|
bool supportsMultipleQtAbis() const override;
|
||||||
ProjectExplorer::Abis detectQtAbis() const override;
|
ProjectExplorer::Abis detectQtAbis() const override;
|
||||||
|
|
||||||
void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const override;
|
void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const override;
|
||||||
|
@@ -166,7 +166,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Utils::Id id)
|
|||||||
initialArgs.append(QString::fromLatin1("-DANDROID_ABI:STRING=%1").arg(preferredAbi));
|
initialArgs.append(QString::fromLatin1("-DANDROID_ABI:STRING=%1").arg(preferredAbi));
|
||||||
|
|
||||||
QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k);
|
QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k);
|
||||||
if (qt && qt->qtVersion() >= QtSupport::QtVersionNumber{5, 14, 0}) {
|
if (qt && qt->supportsMultipleQtAbis()) {
|
||||||
auto sdkLocation = bs->data(Android::Constants::SdkLocation).value<FilePath>();
|
auto sdkLocation = bs->data(Android::Constants::SdkLocation).value<FilePath>();
|
||||||
initialArgs.append(
|
initialArgs.append(
|
||||||
QString::fromLatin1("-DANDROID_SDK:PATH=%1").arg(sdkLocation.toString()));
|
QString::fromLatin1("-DANDROID_SDK:PATH=%1").arg(sdkLocation.toString()));
|
||||||
|
@@ -423,7 +423,7 @@ bool QmakeProFileNode::setData(Utils::Id role, const QVariant &value) const
|
|||||||
int flags = QmakeProjectManager::Internal::ProWriter::ReplaceValues;
|
int flags = QmakeProjectManager::Internal::ProWriter::ReplaceValues;
|
||||||
if (Target *target = m_buildSystem->target()) {
|
if (Target *target = m_buildSystem->target()) {
|
||||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target->kit());
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(target->kit());
|
||||||
if (version && version->qtVersion() < QtSupport::QtVersionNumber(5, 14, 0)) {
|
if (version && !version->supportsMultipleQtAbis()) {
|
||||||
const QString arch = pro->singleVariableValue(Variable::AndroidArch);
|
const QString arch = pro->singleVariableValue(Variable::AndroidArch);
|
||||||
scope = "contains(ANDROID_TARGET_ARCH," + arch + ')';
|
scope = "contains(ANDROID_TARGET_ARCH," + arch + ')';
|
||||||
flags |= QmakeProjectManager::Internal::ProWriter::MultiLine;
|
flags |= QmakeProjectManager::Internal::ProWriter::MultiLine;
|
||||||
|
@@ -1692,6 +1692,11 @@ Tasks BaseQtVersion::reportIssuesImpl(const QString &proFile, const QString &bui
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BaseQtVersion::supportsMultipleQtAbis() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Tasks BaseQtVersion::reportIssues(const QString &proFile, const QString &buildDir) const
|
Tasks BaseQtVersion::reportIssues(const QString &proFile, const QString &buildDir) const
|
||||||
{
|
{
|
||||||
Tasks results = reportIssuesImpl(proFile, buildDir);
|
Tasks results = reportIssuesImpl(proFile, buildDir);
|
||||||
|
@@ -235,6 +235,8 @@ public:
|
|||||||
|
|
||||||
QSet<Utils::Id> features() const;
|
QSet<Utils::Id> features() const;
|
||||||
|
|
||||||
|
virtual bool supportsMultipleQtAbis() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BaseQtVersion();
|
BaseQtVersion();
|
||||||
BaseQtVersion(const BaseQtVersion &other) = delete;
|
BaseQtVersion(const BaseQtVersion &other) = delete;
|
||||||
|
Reference in New Issue
Block a user