Android: replace ndk.dir with android.ndkVersion in build.gradle
The use of ndk.dir in local.properties is deprecated in favor of android.ndkVersion in build.gradle, and will be totatlly removed in the future, so we need to adapt to that. Fixes: QTBUG-91391 Change-Id: I54c57113a759d43c3685c9cdf2b9dcc5c948c0fd Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> (cherry picked from commit 7235eeab19e7e50ba102938993acc04d14b58164) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
22d7433373
commit
8dbe0fa919
@ -35,8 +35,8 @@ android {
|
||||
*******************************************************/
|
||||
|
||||
compileSdkVersion androidCompileSdkVersion.toInteger()
|
||||
|
||||
buildToolsVersion androidBuildToolsVersion
|
||||
ndkVersion androidNdkVersion
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <QUuid>
|
||||
#include <QDirIterator>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
|
||||
#include <depfile_shared.h>
|
||||
|
||||
@ -161,6 +162,7 @@ struct Options
|
||||
QString sdkPath;
|
||||
QString sdkBuildToolsVersion;
|
||||
QString ndkPath;
|
||||
QString ndkVersion;
|
||||
QString jdkPath;
|
||||
|
||||
// Build paths
|
||||
@ -987,6 +989,15 @@ bool readInputFile(Options *options)
|
||||
return false;
|
||||
}
|
||||
options->ndkPath = ndk.toString();
|
||||
const QString ndkPropertiesPath = options->ndkPath + QStringLiteral("/source.properties");
|
||||
const QSettings settings(ndkPropertiesPath, QSettings::IniFormat);
|
||||
const QString ndkVersion = settings.value(QStringLiteral("Pkg.Revision")).toString();
|
||||
if (ndkVersion.isEmpty()) {
|
||||
fprintf(stderr, "Couldn't retrieve the NDK version from \"%s\".\n",
|
||||
qPrintable(ndkPropertiesPath));
|
||||
return false;
|
||||
}
|
||||
options->ndkVersion = ndkVersion;
|
||||
}
|
||||
|
||||
{
|
||||
@ -2520,9 +2531,8 @@ bool buildAndroidProject(const Options &options)
|
||||
{
|
||||
GradleProperties localProperties;
|
||||
localProperties["sdk.dir"] = QDir::fromNativeSeparators(options.sdkPath).toUtf8();
|
||||
localProperties["ndk.dir"] = QDir::fromNativeSeparators(options.ndkPath).toUtf8();
|
||||
|
||||
if (!mergeGradleProperties(options.outputDirectory + QLatin1String("local.properties"), localProperties))
|
||||
const QString localPropertiesPath = options.outputDirectory + QLatin1String("local.properties");
|
||||
if (!mergeGradleProperties(localPropertiesPath, localProperties))
|
||||
return false;
|
||||
|
||||
QString gradlePropertiesPath = options.outputDirectory + QLatin1String("gradle.properties");
|
||||
@ -2537,6 +2547,7 @@ bool buildAndroidProject(const Options &options)
|
||||
gradleProperties["androidCompileSdkVersion"] = options.androidPlatform.split(QLatin1Char('-')).last().toLocal8Bit();
|
||||
gradleProperties["qtMinSdkVersion"] = options.minSdkVersion;
|
||||
gradleProperties["qtTargetSdkVersion"] = options.targetSdkVersion;
|
||||
gradleProperties["androidNdkVersion"] = options.ndkVersion.toUtf8();
|
||||
if (gradleProperties["androidBuildToolsVersion"].isEmpty())
|
||||
gradleProperties["androidBuildToolsVersion"] = options.sdkBuildToolsVersion.toLocal8Bit();
|
||||
QString abiList;
|
||||
|
Loading…
x
Reference in New Issue
Block a user