From c18941170c46677b86d96ec73e1013dcd22804d7 Mon Sep 17 00:00:00 2001 From: Siarhei Luskanau Date: Sat, 15 Jun 2024 00:48:48 +0200 Subject: [PATCH] Moved dependency declarations to TOML file --- build.gradle.kts | 55 +++++++---------------- firebase-analytics/build.gradle.kts | 8 ++-- firebase-app/build.gradle.kts | 8 ++-- firebase-auth/build.gradle.kts | 8 ++-- firebase-common-internal/build.gradle.kts | 12 ++--- firebase-common/build.gradle.kts | 12 ++--- firebase-config/build.gradle.kts | 8 ++-- firebase-crashlytics/build.gradle.kts | 8 ++-- firebase-database/build.gradle.kts | 8 ++-- firebase-firestore/build.gradle.kts | 8 ++-- firebase-functions/build.gradle.kts | 8 ++-- firebase-installations/build.gradle.kts | 8 ++-- firebase-messaging/build.gradle.kts | 8 ++-- firebase-perf/build.gradle.kts | 8 ++-- firebase-storage/build.gradle.kts | 8 ++-- gradle.properties | 9 ---- gradle/libs.versions.toml | 47 +++++++++++++++++++ settings.gradle.kts | 23 ++++++---- test-utils/build.gradle.kts | 11 ++--- 19 files changed, 125 insertions(+), 140 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle.kts b/build.gradle.kts index 8004f17b4..1e2ac451b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,33 +1,14 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent -import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask - -repositories { - google() - mavenCentral() -} plugins { - kotlin("multiplatform") apply false - kotlin("native.cocoapods") apply false + alias(libs.plugins.android.application) apply false + alias(libs.plugins.kotlinx.serialization) apply false + alias(libs.plugins.multiplatform) apply false + alias(libs.plugins.native.cocoapods) apply false + alias(libs.plugins.test.logger.plugin) apply false + alias(libs.plugins.ben.manes.versions) apply false id("base") - id("com.github.ben-manes.versions") version "0.42.0" -} - -buildscript { - repositories { - google() - mavenCentral() - gradlePluginPortal() - maven { - url = uri("https://plugins.gradle.org/m2/") - } - } - dependencies { - classpath("com.android.tools.build:gradle:${project.extra["gradlePluginVersion"]}") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.extra["kotlinVersion"]}") - classpath("com.adarshr:gradle-test-logger-plugin:3.2.0") - } } val compileSdkVersion by extra(34) @@ -108,31 +89,27 @@ subprojects { } afterEvaluate { - - val coroutinesVersion: String by project - val firebaseBoMVersion: String by project - dependencies { - "commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") - "androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion") - "androidMainImplementation"(platform("com.google.firebase:firebase-bom:$firebaseBoMVersion")) + "commonMainImplementation"(libs.kotlinx.coroutines.core) + "androidMainImplementation"(libs.kotlinx.coroutines.play.services) + "androidMainImplementation"(platform(libs.firebase.bom)) "commonTestImplementation"(kotlin("test-common")) "commonTestImplementation"(kotlin("test-annotations-common")) if (this@afterEvaluate.name != "firebase-crashlytics") { - "jvmMainApi"("dev.gitlive:firebase-java-sdk:0.4.3") - "jvmMainApi"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion") { + "jvmMainApi"(libs.gitlive.firebase.java.sdk) + "jvmMainApi"(libs.kotlinx.coroutines.play.services) { exclude("com.google.android.gms") } "jsTestImplementation"(kotlin("test-js")) "jvmTestImplementation"(kotlin("test-junit")) - "jvmTestImplementation"("junit:junit:4.13.2") + "jvmTestImplementation"(libs.junit) } "androidInstrumentedTestImplementation"(kotlin("test-junit")) "androidUnitTestImplementation"(kotlin("test-junit")) - "androidInstrumentedTestImplementation"("junit:junit:4.13.2") - "androidInstrumentedTestImplementation"("androidx.test:core:1.5.0") - "androidInstrumentedTestImplementation"("androidx.test.ext:junit:1.1.5") - "androidInstrumentedTestImplementation"("androidx.test:runner:1.5.2") + "androidInstrumentedTestImplementation"(libs.junit) + "androidInstrumentedTestImplementation"(libs.androidx.test.core) + "androidInstrumentedTestImplementation"(libs.androidx.test.junit) + "androidInstrumentedTestImplementation"(libs.androidx.test.runner) } } diff --git a/firebase-analytics/build.gradle.kts b/firebase-analytics/build.gradle.kts index 4d68ac2c8..4eac96309 100644 --- a/firebase-analytics/build.gradle.kts +++ b/firebase-analytics/build.gradle.kts @@ -121,10 +121,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true if (name.lowercase().contains("ios")) { optIn("kotlinx.cinterop.ExperimentalForeignApi") @@ -147,7 +145,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-analytics") + api(libs.google.firebase.analytics) } } } diff --git a/firebase-app/build.gradle.kts b/firebase-app/build.gradle.kts index 635e9cd76..0a4a68f8a 100644 --- a/firebase-app/build.gradle.kts +++ b/firebase-app/build.gradle.kts @@ -117,10 +117,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true if (name.lowercase().contains("ios")) { optIn("kotlinx.cinterop.ExperimentalForeignApi") @@ -142,7 +140,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-common-ktx") + api(libs.google.firebase.common.ktx) } } diff --git a/firebase-auth/build.gradle.kts b/firebase-auth/build.gradle.kts index 03cb349a3..83dd8d287 100644 --- a/firebase-auth/build.gradle.kts +++ b/firebase-auth/build.gradle.kts @@ -129,10 +129,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") if (name.lowercase().contains("ios")) { @@ -157,7 +155,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-auth-ktx") + api(libs.google.firebase.auth.ktx) } } } diff --git a/firebase-common-internal/build.gradle.kts b/firebase-common-internal/build.gradle.kts index 8a62d7c47..d92abf29a 100644 --- a/firebase-common-internal/build.gradle.kts +++ b/firebase-common-internal/build.gradle.kts @@ -110,10 +110,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") optIn("kotlinx.serialization.ExperimentalSerializationApi") @@ -122,11 +120,9 @@ kotlin { } getByName("commonMain") { - val serializationVersion: String by project - dependencies { implementation(project(":firebase-common")) - api("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion") + api(libs.kotlinx.serialization.core) } } @@ -138,7 +134,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-common-ktx") + api(libs.google.firebase.common.ktx) } } diff --git a/firebase-common/build.gradle.kts b/firebase-common/build.gradle.kts index 0586bfd3f..329b42905 100644 --- a/firebase-common/build.gradle.kts +++ b/firebase-common/build.gradle.kts @@ -110,10 +110,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") optIn("kotlinx.serialization.ExperimentalSerializationApi") @@ -122,10 +120,8 @@ kotlin { } getByName("commonMain") { - val serializationVersion: String by project - dependencies { - api("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion") + api(libs.kotlinx.serialization.core) } } @@ -137,7 +133,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-common-ktx") + api(libs.google.firebase.common.ktx) } } diff --git a/firebase-config/build.gradle.kts b/firebase-config/build.gradle.kts index a3f0bf36d..5d60db729 100644 --- a/firebase-config/build.gradle.kts +++ b/firebase-config/build.gradle.kts @@ -125,10 +125,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") if (name.lowercase().contains("ios")) { @@ -153,7 +151,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-config-ktx") + api(libs.google.firebase.config.ktx) } } diff --git a/firebase-crashlytics/build.gradle.kts b/firebase-crashlytics/build.gradle.kts index 76e1089f6..b218d27f2 100644 --- a/firebase-crashlytics/build.gradle.kts +++ b/firebase-crashlytics/build.gradle.kts @@ -100,10 +100,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") if (name.lowercase().contains("ios")) { @@ -127,7 +125,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-crashlytics-ktx") + api(libs.google.firebase.crashlytics.ktx) } } diff --git a/firebase-database/build.gradle.kts b/firebase-database/build.gradle.kts index 7631b15be..26e7f4dd1 100644 --- a/firebase-database/build.gradle.kts +++ b/firebase-database/build.gradle.kts @@ -126,10 +126,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") optIn("kotlinx.coroutines.FlowPreview") @@ -160,7 +158,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-database-ktx") + api(libs.google.firebase.database.ktx) } } getByName("jvmMain") { diff --git a/firebase-firestore/build.gradle.kts b/firebase-firestore/build.gradle.kts index 4e861b3d0..c5f769786 100644 --- a/firebase-firestore/build.gradle.kts +++ b/firebase-firestore/build.gradle.kts @@ -138,10 +138,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") optIn("kotlinx.serialization.InternalSerializationApi") @@ -169,7 +167,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-firestore") + api(libs.google.firebase.firestore) } } diff --git a/firebase-functions/build.gradle.kts b/firebase-functions/build.gradle.kts index 4dc7a52e1..a3c8309a9 100644 --- a/firebase-functions/build.gradle.kts +++ b/firebase-functions/build.gradle.kts @@ -116,10 +116,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") optIn("kotlinx.serialization.InternalSerializationApi") @@ -145,7 +143,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-functions") + api(libs.google.firebase.functions) } } diff --git a/firebase-installations/build.gradle.kts b/firebase-installations/build.gradle.kts index 22fde5be0..66ed3e5e6 100644 --- a/firebase-installations/build.gradle.kts +++ b/firebase-installations/build.gradle.kts @@ -120,10 +120,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true if (name.lowercase().contains("ios")) { optIn("kotlinx.cinterop.ExperimentalForeignApi") @@ -146,7 +144,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-installations-ktx") + api(libs.google.firebase.installations.ktx) } } diff --git a/firebase-messaging/build.gradle.kts b/firebase-messaging/build.gradle.kts index e3d7c263d..ce13c9fc0 100644 --- a/firebase-messaging/build.gradle.kts +++ b/firebase-messaging/build.gradle.kts @@ -120,10 +120,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") if (name.lowercase().contains("ios")) { @@ -148,7 +146,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-messaging") + api(libs.google.firebase.messaging) } } } diff --git a/firebase-perf/build.gradle.kts b/firebase-perf/build.gradle.kts index 8025e192c..357208b00 100644 --- a/firebase-perf/build.gradle.kts +++ b/firebase-perf/build.gradle.kts @@ -112,10 +112,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") if (name.lowercase().contains("ios")) { @@ -139,7 +137,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-perf-ktx") + api(libs.google.firebase.perf.ktx) } } diff --git a/firebase-storage/build.gradle.kts b/firebase-storage/build.gradle.kts index 1d4c5d65e..450e15bd3 100644 --- a/firebase-storage/build.gradle.kts +++ b/firebase-storage/build.gradle.kts @@ -121,10 +121,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true if (name.lowercase().contains("ios")) { optIn("kotlinx.cinterop.ExperimentalForeignApi") @@ -147,7 +145,7 @@ kotlin { getByName("androidMain") { dependencies { - api("com.google.firebase:firebase-storage") + api(libs.google.firebase.storage) } } } diff --git a/gradle.properties b/gradle.properties index 3fc365770..c459a85f4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -68,12 +68,3 @@ firebase-installations.version=1.12.0 firebase-perf.version=1.12.0 firebase-crashlytics.version=1.12.0 firebase-storage.version=1.12.0 - -# Dependencies Versions: -gradlePluginVersion=8.2.0 -kotlinVersion=1.9.23 -coroutinesVersion=1.7.3 -serializationVersion=1.6.0 -firebaseBoMVersion=33.0.0 -apiVersion=1.8 -languageVersion=1.9 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..56ea7d370 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,47 @@ +[versions] +agp = "8.2.0" +androidx-test-core = "1.5.0" +androidx-test-junit = "1.1.5" +androidx-test-runner = "1.5.2" +ben-manes-versions = "0.42.0" +firebase-bom = "33.0.0" +gitlive-firebase-java-sdk = "0.4.3" +junit = "4.13.2" +kotlin = "1.9.23" +kotlinx-coroutines = "1.7.3" +kotlinx-serialization = "1.6.0" +settings-api = "1.8" +settings-language = "1.9" +test-logger-plugin = "3.2.0" + +[libraries] +androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test-core" } +androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-junit" } +androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" } +firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase-bom" } +gitlive-firebase-java-sdk = { module = "dev.gitlive:firebase-java-sdk", version.ref = "gitlive-firebase-java-sdk" } +google-firebase-analytics = { module = "com.google.firebase:firebase-analytics"} +google-firebase-auth-ktx = { module = "com.google.firebase:firebase-auth-ktx"} +google-firebase-common-ktx = { module = "com.google.firebase:firebase-common-ktx"} +google-firebase-config-ktx = { module = "com.google.firebase:firebase-config-ktx"} +google-firebase-crashlytics-ktx = { module = "com.google.firebase:firebase-crashlytics-ktx"} +google-firebase-database-ktx = { module = "com.google.firebase:firebase-database-ktx"} +google-firebase-firestore = { module = "com.google.firebase:firebase-firestore"} +google-firebase-functions = { module = "com.google.firebase:firebase-functions"} +google-firebase-installations-ktx = { module = "com.google.firebase:firebase-installations-ktx"} +google-firebase-messaging = { module = "com.google.firebase:firebase-messaging"} +google-firebase-perf-ktx = { module = "com.google.firebase:firebase-perf-ktx"} +google-firebase-storage = { module = "com.google.firebase:firebase-storage"} +junit = { module = "junit:junit", version.ref = "junit" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } +kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +ben-manes-versions = { id = "com.github.ben-manes.versions", version.ref = "ben-manes-versions" } +kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" } +test-logger-plugin = { id = "com.adarshr.test-logger", version.ref = "test-logger-plugin" } diff --git a/settings.gradle.kts b/settings.gradle.kts index c0f89e23b..129bba09e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,25 +5,30 @@ include( "firebase-common", "firebase-common-internal", "firebase-config", + "firebase-crashlytics", "firebase-database", "firebase-firestore", "firebase-functions", - "firebase-messaging", "firebase-installations", + "firebase-messaging", "firebase-perf", - "firebase-crashlytics", "firebase-storage", "test-utils" ) pluginManagement { - val kotlinVersion: String by settings + repositories { + google() + mavenCentral() + gradlePluginPortal() + maven { url = uri("https://plugins.gradle.org/m2/") } + } +} - plugins { - kotlin("multiplatform") version kotlinVersion - kotlin("native.cocoapods") version kotlinVersion - kotlin("plugin.serialization") version kotlinVersion - id("com.android.application") version "8.1.3" - id("org.jetbrains.kotlin.android") version "1.9.0" +dependencyResolutionManagement { + repositories { + mavenLocal() + google() + mavenCentral() } } diff --git a/test-utils/build.gradle.kts b/test-utils/build.gradle.kts index d8f7ea223..8d3ed9a84 100644 --- a/test-utils/build.gradle.kts +++ b/test-utils/build.gradle.kts @@ -87,10 +87,8 @@ kotlin { sourceSets { all { languageSettings.apply { - val apiVersion: String by project - val languageVersion: String by project - this.apiVersion = apiVersion - this.languageVersion = languageVersion + this.apiVersion = libs.versions.settings.api.get() + this.languageVersion = libs.versions.settings.language.get() progressiveMode = true if (name.lowercase().contains("ios")) { optIn("kotlinx.cinterop.ExperimentalForeignApi") @@ -101,10 +99,9 @@ kotlin { getByName("commonMain") { dependencies { - val coroutinesVersion: String by project api(kotlin("test")) - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") - api("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion") + api(libs.kotlinx.coroutines.core) + api(libs.kotlinx.coroutines.test) } }