[android] Migrate to version catalog

Signed-off-by: jeanbaptisteC <jeanbaptistec@noreply.codeberg.org>
Co-authored by: Harry Bond <me@hbond.xyz>
This commit is contained in:
Jean-Baptiste
2025-05-12 22:09:35 +02:00
committed by Konstantin Pastbin
parent 49beb50f7b
commit e98d506207
3 changed files with 73 additions and 34 deletions

View File

@@ -22,19 +22,19 @@ buildscript {
googleFirebaseServicesDefault googleFirebaseServicesDefault
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:8.7.3' classpath libs.android.tools
if (googleFirebaseServicesEnabled) { if (googleFirebaseServicesEnabled) {
println('Building with Google Firebase Services') println('Building with Google Firebase Services')
classpath 'com.google.gms:google-services:4.4.2' classpath libs.google.services
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2' classpath libs.google.firebase.crashlytics
classpath 'com.google.firebase:firebase-appdistribution-gradle:5.0.0' classpath libs.google.firebase.appdistribution
} else { } else {
println('Building without Google Firebase Services') println('Building without Google Firebase Services')
} }
classpath('com.github.triplet.gradle:play-publisher:3.10.1') classpath(libs.triplet.play.publisher)
classpath('ru.cian:huawei-publish-gradle-plugin:1.4.2') classpath(libs.huawei.publish)
} }
} }
@@ -366,7 +366,7 @@ android {
} }
dependencies { dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4' coreLibraryDesugaring libs.android.tools.desugar
// Google Play Location Services // Google Play Location Services
// //
@@ -377,17 +377,17 @@ dependencies {
// ls -la src/$flavor/java/app/organicmaps/location/GoogleFusedLocationProvider.java // ls -la src/$flavor/java/app/organicmaps/location/GoogleFusedLocationProvider.java
// ``` // ```
// //
webImplementation 'com.google.android.gms:play-services-location:21.3.0' webImplementation libs.google.services.location
googleImplementation 'com.google.android.gms:play-services-location:21.3.0' googleImplementation libs.google.services.location
huaweiImplementation 'com.google.android.gms:play-services-location:21.3.0' huaweiImplementation libs.google.services.location
// This is the microG project's re-implementation which is permissible on // This is the microG project's re-implementation which is permissible on
// F-droid because it's Apache-2.0. // F-droid because it's Apache-2.0.
fdroidImplementation 'org.microg.gms:play-services-location:0.3.6.244735' fdroidImplementation libs.microg.services.location
// Google Firebase Services // Google Firebase Services
if (googleFirebaseServicesEnabled) { if (googleFirebaseServicesEnabled) {
// Import the BoM for the Firebase platform // Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:33.5.1') implementation platform(libs.google.firebase.bom)
// Add the dependencies for the Crashlytics and Analytics libraries // Add the dependencies for the Crashlytics and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies // When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-crashlytics' implementation 'com.google.firebase:firebase-crashlytics'
@@ -398,30 +398,30 @@ dependencies {
// > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable // > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
// We don't use Kotlin, but some dependencies are actively using it. // We don't use Kotlin, but some dependencies are actively using it.
// See https://stackoverflow.com/a/75719642 // See https://stackoverflow.com/a/75719642
implementation 'androidx.core:core:1.15.0' implementation libs.androidx.core
implementation(platform('org.jetbrains.kotlin:kotlin-bom:2.1.10')) implementation(platform(libs.jetbrains.kotlin.bom))
implementation 'androidx.annotation:annotation:1.9.1' implementation libs.androidx.annotation
implementation 'androidx.appcompat:appcompat:1.7.0' implementation libs.androidx.appcompat
implementation 'androidx.car.app:app:1.7.0-rc01' implementation libs.androidx.car.app
implementation 'androidx.car.app:app-projected:1.7.0-rc01' implementation libs.androidx.car.app.projected
implementation 'androidx.constraintlayout:constraintlayout:2.2.0' implementation libs.androidx.constraintlayout
implementation 'androidx.fragment:fragment:1.8.5' implementation libs.androidx.fragment
implementation 'androidx.preference:preference:1.2.1' implementation libs.androidx.preference
implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation libs.androidx.recyclerview
implementation 'androidx.work:work-runtime:2.10.0' implementation libs.androidx.work.runtime
implementation 'androidx.lifecycle:lifecycle-process:2.8.7' implementation libs.androidx.lifecycle.process
implementation 'com.google.android.material:material:1.12.0' implementation libs.android.material
// Fix for app/organicmaps/util/FileUploadWorker.java:14: error: cannot access ListenableFuture // Fix for app/organicmaps/util/FileUploadWorker.java:14: error: cannot access ListenableFuture
// https://github.com/organicmaps/organicmaps/issues/6106 // https://github.com/organicmaps/organicmaps/issues/6106
implementation 'com.google.guava:guava:33.3.0-android' implementation libs.google.guava
implementation 'com.github.devnullorthrow:MPAndroidChart:3.2.0-alpha' implementation libs.devnullorthrow.mpandroidchart
implementation 'net.jcip:jcip-annotations:1.0' implementation libs.jcip.annotations
// Test Dependencies // Test Dependencies
androidTestImplementation 'androidx.test.ext:junit:1.2.1' androidTestImplementation libs.androidx.test.junit
testImplementation 'junit:junit:4.13.2' testImplementation libs.junit
testImplementation 'org.mockito:mockito-core:5.15.2' testImplementation libs.mockito.core
testImplementation 'org.mockito:mockito-inline:5.2.0' testImplementation libs.mockito.inline
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {

View File

@@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id 'com.android.application' version '8.7.3' apply false alias libs.plugins.android.application apply false
id 'com.android.library' version '8.7.3' apply false alias libs.plugins.android.library apply false
} }

View File

@@ -0,0 +1,39 @@
[versions]
androidGradlePlugin = "8.7.3"
androidxCarApp = "1.7.0-rc01"
[libraries]
android-tools = { module = "com.android.tools.build:gradle", version.ref = "androidGradlePlugin" }
google-services = { module = "com.google.gms:google-services", version = "4.4.2" }
google-firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics-gradle", version = "3.0.2" }
google-firebase-appdistribution = { module = "com.google.firebase:firebase-appdistribution-gradle", version = "5.0.0" }
triplet-play-publisher = { module = "com.github.triplet.gradle:play-publisher", version = "3.10.1" }
huawei-publish = { module = "ru.cian:huawei-publish-gradle-plugin", version = "1.4.2" }
android-tools-desugar = { module = "com.android.tools:desugar_jdk_libs", version = "2.1.4" }
google-services-location = { module = "com.google.android.gms:play-services-location", version = "21.3.0" }
microg-services-location = { module = "org.microg.gms:play-services-location", version = "0.3.6.244735" }
google-firebase-bom = { module = "com.google.firebase:firebase-bom", version = "33.5.1" }
androidx-core = { module = "androidx.core:core", version = "1.15.0" }
jetbrains-kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version = "2.1.10" }
androidx-annotation = { module = "androidx.annotation:annotation", version = "1.9.1" }
androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.7.0" }
androidx-car-app = { module = "androidx.car.app:app", version.ref = "androidxCarApp" }
androidx-car-app-projected = { module = "androidx.car.app:app-projected", version.ref = "androidxCarApp" }
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version = "2.2.0" }
androidx-fragment = { module = "androidx.fragment:fragment", version = "1.8.5" }
androidx-preference = { module = "androidx.preference:preference", version = "1.2.1" }
androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.3.2" }
androidx-work-runtime = { module = "androidx.work:work-runtime", version = "2.10.0" }
androidx-lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version = "2.8.7" }
android-material = { module = "com.google.android.material:material", version = "1.12.0" }
google-guava = { module = "com.google.guava:guava", version = "33.3.0-android" }
devnullorthrow-mpandroidchart = { module = "com.github.devnullorthrow:MPAndroidChart", version = "3.2.0-alpha" }
jcip-annotations = { module = "net.jcip:jcip-annotations", version = "1.0" }
androidx-test-junit = { module = "androidx.test.ext:junit", version = "1.2.1" }
junit = { module = "junit:junit", version = "4.13.2" }
mockito-core = { module = "org.mockito:mockito-core", version = "5.15.2" }
mockito-inline = { module = "org.mockito:mockito-inline", version = "5.2.0" }
[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
android-library= { id = "com.android.library", version.ref = "androidGradlePlugin" }