[android] Fix gradle deprecations

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk
2025-07-04 23:36:34 +02:00
committed by Konstantin Pastbin
parent 21020429cb
commit 3e2e6cb487
4 changed files with 31 additions and 32 deletions

View File

@@ -37,10 +37,10 @@ project.ext.appName = 'CoMaps'
//}
android {
namespace 'app.organicmaps'
namespace = 'app.organicmaps'
// TODO: it should not be here, but in sdk/build.gradle. But for some reason it should be specified here as well.
ndkVersion '28.2.13676358'
ndkVersion = '28.2.13676358'
dependenciesInfo {
// Disables dependency metadata when building APKs (for IzzyOnDroid/F-Droid)
@@ -62,21 +62,21 @@ android {
}
// All properties are read from gradle.properties file
compileSdk propCompileSdkVersion.toInteger()
compileSdk = propCompileSdkVersion.toInteger()
defaultConfig {
versionCode = rootProject.ext.versionCode
versionName = rootProject.ext.versionName
println('Version: ' + versionName)
println('VersionCode: ' + versionCode)
minSdk propMinSdkVersion.toInteger()
targetSdk propTargetSdkVersion.toInteger()
minSdk = propMinSdkVersion.toInteger()
targetSdk = propTargetSdkVersion.toInteger()
applicationId project.ext.appId
buildConfigField 'String', 'SUPPORT_MAIL', '"android@comaps.app"'
// Should be customized in flavors.
buildConfigField 'String', 'REVIEW_URL', '""'
setProperty('archivesBaseName', appName.replaceAll('\\s','') + '-' + defaultConfig.versionCode)
base.archivesName = appName.replaceAll('\\s','') + '-' + defaultConfig.versionCode
ndk.debugSymbolLevel = 'full'
}
@@ -128,10 +128,10 @@ android {
splits.abi {
boolean enabled = project.hasProperty('splitApk')
println ('Create separate apks: ' + enabled)
enable enabled
enable = enabled
reset()
include 'x86', 'armeabi-v7a', 'arm64-v8a', 'x86_64'
universalApk true
universalApk = true
}
lint {
@@ -144,7 +144,7 @@ android {
disable 'CustomSplashScreen'
// https://github.com/organicmaps/organicmaps/issues/3610
disable 'InsecureBaseConfiguration'
abortOnError true
abortOnError = true
}
gradle.projectsEvaluated {
@@ -204,7 +204,7 @@ android {
applicationIdSuffix '.debug' // Allows to install debug and release builds together
versionNameSuffix '-debug'
zipAlignEnabled true
signingConfig signingConfigs.debug
signingConfig = signingConfigs.debug
resValue 'string', 'app_name', 'CoMaps Debug'
}
@@ -212,15 +212,16 @@ android {
if (taskName.contains('release')) {
if (secureReleasePropertiesFileExists) {
println('Using RELEASE signing keys from secure.properties.release')
signingConfig signingConfigs.release
signingConfig = signingConfigs.release
} else {
println('NO RELEASE signing keys found')
println('Using DEBUG signing keys')
signingConfig signingConfigs.debug
signingConfig = signingConfigs.debug
}
}
minifyEnabled true
shrinkResources true
shrinkResources = true
// Includes the default ProGuard rules files that are packaged with the Android Gradle plugin.
// To learn more, go to the documentation section about R8 configuration files.
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
@@ -233,15 +234,15 @@ android {
if (taskName.contains('beta')) {
if (secureTestPropertiesFileExists) {
println('Using TEST signing keys from secure.properties.test')
signingConfig signingConfigs.test
signingConfig = signingConfigs.test
} else {
println('NO TEST signing keys found')
println('Using DEBUG signing keys')
signingConfig signingConfigs.debug
signingConfig = signingConfigs.debug
}
}
minifyEnabled true
shrinkResources true
shrinkResources = true
// Includes the default ProGuard rules files that are packaged with the Android Gradle plugin.
// To learn more, go to the documentation section about R8 configuration files.
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
@@ -253,7 +254,7 @@ android {
// We don't compress these extensions in assets/ because our random FileReader can't read zip-compressed files from apk.
// TODO: Load all minor files via separate call to ReadAsString which can correctly handle compressed files in zip containers.
androidResources {
ignoreAssetsPattern '!.svn:!.git:!.DS_Store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~'
ignoreAssetsPattern = '!.svn:!.git:!.DS_Store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~'
noCompress = ['txt', 'bin', 'html', 'png', 'json', 'mwm', 'ttf', 'sdf', 'ui', 'config', 'csv', 'spv', 'obj']
localeFilters += [
"af",
@@ -310,7 +311,7 @@ android {
}
compileOptions {
coreLibraryDesugaringEnabled true
coreLibraryDesugaringEnabled = true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17

View File

@@ -7,19 +7,17 @@ plugins {
}
def run(cmd) {
def stdout = new ByteArrayOutputStream()
exec {
def output = providers.exec {
commandLine = cmd
standardOutput = stdout
}
return stdout.toString()
return output.standardOutput.asText.get().trim()
}
def getVersion() {
def isWindows = DefaultNativePlatform.getCurrentOperatingSystem().isWindows()
def bash = isWindows ? 'C:\\Program Files\\Git\\bin\\bash.exe' : 'bash'
def versionCode = Integer.parseInt(run([bash, '../tools/unix/version.sh', 'android_code']).trim())
def versionName = run([bash, '../tools/unix/version.sh', 'android_name']).trim()
def versionCode = Integer.parseInt(run([bash, '../tools/unix/version.sh', 'android_code']))
def versionName = run([bash, '../tools/unix/version.sh', 'android_name'])
return new Tuple2(versionCode, versionName)
}

View File

@@ -3,15 +3,15 @@ plugins {
}
android {
namespace 'app.organicmaps.sdk'
compileSdk propCompileSdkVersion.toInteger()
namespace = 'app.organicmaps.sdk'
compileSdk = propCompileSdkVersion.toInteger()
ndkVersion '28.2.13676358'
ndkVersion = '28.2.13676358'
defaultConfig {
minSdk propMinSdkVersion.toInteger()
targetSdk propTargetSdkVersion.toInteger()
minSdk = propMinSdkVersion.toInteger()
targetSdk = propTargetSdkVersion.toInteger()
externalNativeBuild {
def pchFlag = 'OFF'
@@ -85,7 +85,7 @@ android {
externalNativeBuild {
cmake {
version '3.22.1+'
version = '3.22.1+'
buildStagingDirectory './nativeOutputs'
path '../../CMakeLists.txt'
}

View File

@@ -10,7 +10,7 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url 'https://www.jitpack.io' } // MPAndroidChart
maven { url = 'https://www.jitpack.io' } // MPAndroidChart
}
}
rootProject.name = 'CoMaps'