From 2d2d41381419230f4d6b538509f03abc2cb034af Mon Sep 17 00:00:00 2001 From: Albin Date: Mon, 12 Aug 2024 18:27:24 +0200 Subject: [PATCH 1/3] Migrate to version catalogs --- android/app/build.gradle.kts | 139 ++++++------ android/build.gradle.kts | 95 ++++---- .../buildSrc/src/main/kotlin/Dependencies.kt | 208 ++---------------- android/buildSrc/src/main/kotlin/Projects.kt | 3 - android/buildSrc/src/main/kotlin/Versions.kt | 80 +------ android/gradle/libs.versions.toml | 174 +++++++++++++++ android/lib/billing/build.gradle.kts | 59 ++--- android/lib/common-test/build.gradle.kts | 14 +- android/lib/common/build.gradle.kts | 24 +- android/lib/daemon-grpc/build.gradle.kts | 69 +++--- android/lib/endpoint/build.gradle.kts | 12 +- android/lib/intent-provider/build.gradle.kts | 14 +- android/lib/map/build.gradle.kts | 20 +- android/lib/model/build.gradle.kts | 35 +-- android/lib/payment/build.gradle.kts | 14 +- android/lib/resource/build.gradle.kts | 14 +- android/lib/shared/build.gradle.kts | 49 +++-- android/lib/talpid/build.gradle.kts | 20 +- android/lib/theme/build.gradle.kts | 16 +- android/service/build.gradle.kts | 48 ++-- android/settings.gradle.kts | 10 + android/test/arch/build.gradle.kts | 23 +- android/test/common/build.gradle.kts | 28 +-- android/test/e2e/build.gradle.kts | 42 ++-- android/test/mockapi/build.gradle.kts | 44 ++-- android/tile/build.gradle.kts | 38 ++-- 26 files changed, 623 insertions(+), 669 deletions(-) delete mode 100644 android/buildSrc/src/main/kotlin/Projects.kt create mode 100644 android/gradle/libs.versions.toml diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index f0c576664768..3c01abf0803c 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -7,13 +7,14 @@ import java.util.Properties import org.gradle.configurationcache.extensions.capitalized plugins { - id(Dependencies.Plugin.androidApplicationId) - id(Dependencies.Plugin.playPublisherId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) - id(Dependencies.Plugin.ksp) version Versions.Plugin.ksp - id(Dependencies.Plugin.junit5) version Versions.Plugin.junit5 - id(Dependencies.Plugin.composeCompiler) version Versions.kotlin + alias(libs.plugins.android.application) + alias(libs.plugins.play.publisher) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) + alias(libs.plugins.kotlin.ksp) + alias(libs.plugins.compose) + + id(Dependencies.junit5AndroidPluginId) version Versions.junit5Plugin } val repoRootPath = rootProject.projectDir.absoluteFile.parentFile.absolutePath @@ -31,14 +32,14 @@ if (keystorePropertiesFile.exists()) { android { namespace = "net.mullvad.mullvadvpn" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion defaultConfig { val localProperties = gradleLocalProperties(rootProject.projectDir, providers) applicationId = "net.mullvad.mullvadvpn" - minSdk = Versions.Android.minSdkVersion - targetSdk = Versions.Android.targetSdkVersion + minSdk = Versions.minSdkVersion + targetSdk = Versions.targetSdkVersion versionCode = generateVersionCode(localProperties) versionName = generateVersionName(localProperties) testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" @@ -245,7 +246,7 @@ android { junitPlatform { instrumentationTests { - version.set(Versions.Android.junit) + version.set(Versions.junit5Android) includeExtensions.set(true) } } @@ -314,72 +315,72 @@ afterEvaluate { play { serviceAccountCredentials.set(file("play-api-key.json")) } dependencies { - implementation(project(Dependencies.Mullvad.commonLib)) - implementation(project(Dependencies.Mullvad.daemonGrpc)) - implementation(project(Dependencies.Mullvad.endpointLib)) - implementation(project(Dependencies.Mullvad.intentLib)) - implementation(project(Dependencies.Mullvad.mapLib)) - implementation(project(Dependencies.Mullvad.modelLib)) - implementation(project(Dependencies.Mullvad.paymentLib)) - implementation(project(Dependencies.Mullvad.resourceLib)) - implementation(project(Dependencies.Mullvad.sharedLib)) - implementation(project(Dependencies.Mullvad.talpidLib)) - implementation(project(Dependencies.Mullvad.tileService)) - implementation(project(Dependencies.Mullvad.themeLib)) - implementation(project(Dependencies.Mullvad.vpnService)) + implementation(projects.lib.common) + implementation(projects.lib.daemonGrpc) + implementation(projects.lib.endpoint) + implementation(projects.lib.intentProvider) + implementation(projects.lib.map) + implementation(projects.lib.model) + implementation(projects.lib.payment) + implementation(projects.lib.resource) + implementation(projects.lib.shared) + implementation(projects.lib.talpid) + implementation(projects.tile) + implementation(projects.lib.theme) + implementation(projects.service) // Play implementation - playImplementation(project(Dependencies.Mullvad.billingLib)) - - implementation(Dependencies.commonsValidator) - implementation(Dependencies.AndroidX.activityCompose) - implementation(Dependencies.AndroidX.coreKtx) - implementation(Dependencies.AndroidX.coreSplashscreen) - implementation(Dependencies.AndroidX.lifecycleRuntimeKtx) - implementation(Dependencies.AndroidX.lifecycleViewmodelKtx) - implementation(Dependencies.AndroidX.lifecycleRuntimeCompose) - implementation(Dependencies.Arrow.core) - implementation(Dependencies.Arrow.resilience) - implementation(Dependencies.Compose.constrainLayout) - implementation(Dependencies.Compose.foundation) - implementation(Dependencies.Compose.material3) - implementation(Dependencies.Compose.ui) - implementation(Dependencies.Compose.uiUtil) - implementation(Dependencies.Compose.destinations) - ksp(Dependencies.Compose.destinationsKsp) - - implementation(Dependencies.jodaTime) - implementation(Dependencies.kermit) - implementation(Dependencies.Koin.core) - implementation(Dependencies.Koin.android) - implementation(Dependencies.Koin.compose) - implementation(Dependencies.Kotlin.reflect) - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.KotlinX.coroutinesAndroid) + playImplementation(projects.lib.billing) + + implementation(libs.commons.validator) + implementation(libs.androidx.activity.compose) + implementation(libs.androidx.ktx) + implementation(libs.androidx.coresplashscreen) + implementation(libs.androidx.lifecycle.runtime) + implementation(libs.androidx.lifecycle.viewmodel) + implementation(libs.androidx.lifecycle.runtime.compose) + implementation(libs.arrow) + implementation(libs.arrow.resilience) + implementation(libs.compose.constrainlayout) + implementation(libs.compose.foundation) + implementation(libs.compose.material3) + implementation(libs.compose.ui) + implementation(libs.compose.ui.util) + implementation(libs.compose.destinations) + ksp(libs.compose.destinations.ksp) + + implementation(libs.jodatime) + implementation(libs.kermit) + implementation(libs.koin) + implementation(libs.koin.android) + implementation(libs.koin.compose) + implementation(libs.kotlin.reflect) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) // UI tooling - implementation(Dependencies.Compose.uiToolingPreview) - debugImplementation(Dependencies.Compose.uiTooling) + implementation(libs.compose.ui.tooling.preview) + debugImplementation(libs.compose.ui.tooling) // Leak canary - leakCanaryImplementation(Dependencies.leakCanary) + leakCanaryImplementation(libs.leakCanary) // Needed for createComposeExtension() and createAndroidComposeExtension() - debugImplementation(Dependencies.Compose.uiTestManifest) - testImplementation(project(Dependencies.Mullvad.commonTestLib)) - testImplementation(Dependencies.Kotlin.test) - testImplementation(Dependencies.KotlinX.coroutinesTest) - testImplementation(Dependencies.MockK.core) - testImplementation(Dependencies.turbine) - testImplementation(Dependencies.junitApi) - testRuntimeOnly(Dependencies.junitEngine) - testImplementation(Dependencies.junitParams) + debugImplementation(libs.compose.ui.test.manifest) + testImplementation(projects.lib.commonTest) + testImplementation(libs.kotlin.test) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.mockk) + testImplementation(libs.turbine) + testImplementation(Dependencies.junitJupiterApi) + testRuntimeOnly(Dependencies.junitJupiterEngine) + testImplementation(Dependencies.junitJupiterParams) // UI test dependencies - debugImplementation(Dependencies.Compose.testManifest) - androidTestImplementation(Dependencies.Koin.test) - androidTestImplementation(Dependencies.Kotlin.test) - androidTestImplementation(Dependencies.MockK.android) - androidTestImplementation(Dependencies.junitApi) - androidTestImplementation(Dependencies.Compose.junit5) + debugImplementation(libs.compose.ui.test.manifest) + androidTestImplementation(libs.koin.test) + androidTestImplementation(libs.kotlin.test) + androidTestImplementation(libs.mockk.android) + androidTestImplementation(Dependencies.junitJupiterApi) + androidTestImplementation(Dependencies.junit5AndroidTestCompose) } diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 7ed0057bebcf..1f9d1289377c 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -3,10 +3,20 @@ import io.gitlab.arturbosch.detekt.Detekt import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask plugins { - id(Dependencies.Plugin.dependencyCheckId) version Versions.Plugin.dependencyCheck apply false - id(Dependencies.Plugin.gradleVersionsId) version Versions.Plugin.gradleVersions - id(Dependencies.Plugin.ktfmtId) version Versions.Plugin.ktfmt apply false - id(Dependencies.Plugin.detektId) version Versions.Plugin.detekt + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.android.test) apply false + alias(libs.plugins.dependency.check) apply false + alias(libs.plugins.dependency.versions) apply false + alias(libs.plugins.ktfmt) apply false + alias(libs.plugins.compose) apply false + alias(libs.plugins.play.publisher) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.ksp) apply false + alias(libs.plugins.kotlin.parcelize) apply false + alias(libs.plugins.protobuf.core) apply false + + alias(libs.plugins.detekt) apply true } buildscript { @@ -16,44 +26,47 @@ buildscript { maven(Repositories.GradlePlugins) gradlePluginPortal() } - dependencies { - classpath(Dependencies.Plugin.android) - classpath(Dependencies.Plugin.playPublisher) - classpath(Dependencies.Plugin.kotlin) - classpath(Dependencies.Plugin.dependencyCheck) - - // Required for Gradle metadata verification to work properly, see: - // https://github.com/gradle/gradle/issues/19228 - // Aapt plugin - classpath(Dependencies.Plugin.aaptLinux) - classpath(Dependencies.Plugin.aaptOsx) - classpath(Dependencies.Plugin.aaptWindows) - // ProtoC gen grpc java plugin - classpath(Dependencies.Plugin.Protobuf.protocGenGrpcJavaLinuxAarch_64) - classpath(Dependencies.Plugin.Protobuf.protocGenGrpcJavaLinuxPpcle_64) - classpath(Dependencies.Plugin.Protobuf.protocGenGrpcJavaLinuxS390_64) - classpath(Dependencies.Plugin.Protobuf.protocGenGrpcJavaLinuxX86_32) - classpath(Dependencies.Plugin.Protobuf.protocGenGrpcJavaLinuxX86_64) - classpath(Dependencies.Plugin.Protobuf.protocGenGrpcJavaOsxAarch_64) - classpath(Dependencies.Plugin.Protobuf.protocGenGrpcJavaOsxX86_64) - classpath(Dependencies.Plugin.Protobuf.protocGenGrpcJavaWindowsX86_32) - classpath(Dependencies.Plugin.Protobuf.protocGenGrpcJavaWindowsX86_64) + // Dependency class paths are required for Gradle metadata verification to work properly, see: + // https://github.com/gradle/gradle/issues/19228s + //noinspection UseTomlInstead + val aapt = libs.android.gradle.aapt.get().toString() + val aaptVersion = libs.versions.android.gradle.aapt.get() + val agpVersion = libs.versions.android.gradle.plugin.get() + classpath("$aapt:$agpVersion-$aaptVersion:linux") + classpath("$aapt:$agpVersion-$aaptVersion:osx") + classpath("$aapt:$agpVersion-$aaptVersion:windows") + // Protoc plugin - classpath(Dependencies.Plugin.Protobuf.protocLinuxAarch_64) - classpath(Dependencies.Plugin.Protobuf.protocLinuxPpcle_64) - classpath(Dependencies.Plugin.Protobuf.protocLinuxS390_64) - classpath(Dependencies.Plugin.Protobuf.protocLinuxX86_32) - classpath(Dependencies.Plugin.Protobuf.protocLinuxX86_64) - classpath(Dependencies.Plugin.Protobuf.protocOsxAarch_64) - classpath(Dependencies.Plugin.Protobuf.protocOsxX86_64) - classpath(Dependencies.Plugin.Protobuf.protocWindowsX86_32) - classpath(Dependencies.Plugin.Protobuf.protocWindowsX86_64) + val protoc = libs.plugins.protobuf.protoc.get().toString() + classpath("$protoc:linux-aarch_64@exe") + classpath("$protoc:linux-ppcle_64@exe") + classpath("$protoc:linux-s390_64@exe") + classpath("$protoc:linux-x86_32@exe") + classpath("$protoc:linux-x86_64@exe") + classpath("$protoc:osx-aarch_64@exe") + classpath("$protoc:osx-x86_64@exe") + classpath("$protoc:windows-x86_32@exe") + classpath("$protoc:windows-x86_64@exe") + + // ProtoC gen grpc java plugin + val protocJava = libs.plugins.grpc.protoc.gen.grpc.java.get().toString() + classpath("$protocJava:linux-aarch_64@exe") + classpath("$protocJava:linux-ppcle_64@exe") + classpath("$protocJava:linux-s390_64@exe") + classpath("$protocJava:linux-x86_32@exe") + classpath("$protocJava:linux-x86_64@exe") + classpath("$protocJava:osx-aarch_64@exe") + classpath("$protocJava:osx-x86_64@exe") + classpath("$protocJava:windows-x86_32@exe") + classpath("$protocJava:windows-x86_64@exe") + // Kotlin Native Prebuilt - classpath(Dependencies.Kotlin.kotlinNavtivePrebuiltLinuxX86_64) - classpath(Dependencies.Kotlin.kotlinNavtivePrebuiltMacOsAArch64) - classpath(Dependencies.Kotlin.kotlinNavtivePrebuiltMacOsX86_64) - classpath(Dependencies.Kotlin.kotlinNavtivePrebuiltWindowsX86_64) + val prebuilt = libs.kotlin.native.prebuilt.get().toString() + classpath("$prebuilt:windows-x86_64@zip") + classpath("$prebuilt:linux-x86_64@tar.gz") + classpath("$prebuilt:macos-aarch64@tar.gz") + classpath("$prebuilt:macos-x86_64@tar.gz") } } @@ -89,8 +102,8 @@ tasks.withType().configureEach { } allprojects { - apply(plugin = Dependencies.Plugin.dependencyCheckId) - apply(plugin = Dependencies.Plugin.ktfmtId) + apply(plugin = rootProject.libs.plugins.dependency.check.get().pluginId) + apply(plugin = rootProject.libs.plugins.ktfmt.get().pluginId) repositories { google() diff --git a/android/buildSrc/src/main/kotlin/Dependencies.kt b/android/buildSrc/src/main/kotlin/Dependencies.kt index 367837caee06..066c065f46d1 100644 --- a/android/buildSrc/src/main/kotlin/Dependencies.kt +++ b/android/buildSrc/src/main/kotlin/Dependencies.kt @@ -1,197 +1,15 @@ object Dependencies { - const val androidVolley = "com.android.volley:volley:${Versions.Android.volley}" - const val commonsValidator = "commons-validator:commons-validator:${Versions.commonsValidator}" - const val jodaTime = "joda-time:joda-time:${Versions.jodaTime}" - const val junitApi = "org.junit.jupiter:junit-jupiter-api:${Versions.junit}" - const val junitEngine = "org.junit.jupiter:junit-jupiter-engine:${Versions.junit}" - const val junitParams = "org.junit.jupiter:junit-jupiter-params:${Versions.junit}" - const val junitAndroidTestExtensions = - "de.mannodermaus.junit5:android-test-core:${Versions.Android.junit}" - const val junitAndroidTestCore = - "de.mannodermaus.junit5:android-test-extensions:${Versions.Android.junit}" - const val junitAndroidTestRunner = - "de.mannodermaus.junit5:android-test-runner:${Versions.Android.junit}" - const val kermit = "co.touchlab:kermit:${Versions.kermit}" - const val konsist = "com.lemonappdev:konsist:${Versions.konsist}" - const val leakCanary = "com.squareup.leakcanary:leakcanary-android:${Versions.leakCanary}" - const val mockkWebserver = "com.squareup.okhttp3:mockwebserver:${Versions.mockWebserver}" - const val turbine = "app.cash.turbine:turbine:${Versions.turbine}" - const val billingClient = "com.android.billingclient:billing-ktx:${Versions.billingClient}" - - object AndroidX { - const val activityCompose = - "androidx.activity:activity-compose:${Versions.AndroidX.activityCompose}" - const val appcompat = "androidx.appcompat:appcompat:${Versions.AndroidX.appcompat}" - const val coreKtx = "androidx.core:core-ktx:${Versions.AndroidX.coreKtx}" - const val coreSplashscreen = "androidx.core:core-splashscreen:${Versions.AndroidX.coreSplashscreen}" - const val lifecycleRuntimeKtx = - "androidx.lifecycle:lifecycle-runtime-ktx:${Versions.AndroidX.lifecycle}" - const val lifecycleViewmodelKtx = - "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.AndroidX.lifecycle}" - const val lifecycleRuntimeCompose = - "androidx.lifecycle:lifecycle-runtime-compose:${Versions.AndroidX.lifecycle}" - const val lifecycleService = - "androidx.lifecycle:lifecycle-service:${Versions.AndroidX.lifecycle}" - const val espressoCore = - "androidx.test.espresso:espresso-core:${Versions.AndroidX.espresso}" - const val testCore = "androidx.test:core:${Versions.AndroidX.test}" - const val testMonitor = "androidx.test:monitor:${Versions.AndroidX.testMonitor}" - const val testRunner = "androidx.test:runner:${Versions.AndroidX.testRunner}" - const val testRules = "androidx.test:rules:${Versions.AndroidX.test}" - const val testUiAutomator = - "androidx.test.uiautomator:uiautomator:${Versions.AndroidX.uiautomator}" - const val testOrchestrator = - "androidx.test:orchestrator:${Versions.AndroidX.testOrchestrator}" - } - - object Arrow { - const val core = "io.arrow-kt:arrow-core:${Versions.Arrow.base}" - const val optics = "io.arrow-kt:arrow-optics:${Versions.Arrow.base}" - const val opticsKsp = "io.arrow-kt:arrow-optics-ksp-plugin:${Versions.Arrow.base}" - const val resilience = "io.arrow-kt:arrow-resilience:${Versions.Arrow.base}" - } - - object Compose { - const val constrainLayout = - "androidx.constraintlayout:constraintlayout-compose:${Versions.Compose.constrainLayout}" - const val destinations = - "io.github.raamcosta.compose-destinations:core:${Versions.Compose.destinations}" - const val destinationsKsp = - "io.github.raamcosta.compose-destinations:ksp:${Versions.Compose.destinations}" - const val foundation = - "androidx.compose.foundation:foundation:${Versions.Compose.foundation}" - const val junit5 = "de.mannodermaus.junit5:android-test-compose:${Versions.Android.junit}" - const val material3 = "androidx.compose.material3:material3:${Versions.Compose.material3}" - const val testManifest = "androidx.compose.ui:ui-test-manifest:${Versions.Compose.base}" - const val ui = "androidx.compose.ui:ui:${Versions.Compose.base}" - const val uiTestManifest = "androidx.compose.ui:ui-test-manifest:${Versions.Compose.base}" - const val uiTooling = "androidx.compose.ui:ui-tooling:${Versions.Compose.base}" - const val uiToolingAndroidPreview = - "androidx.compose.ui:ui-tooling-preview-android:${Versions.Compose.base}" - const val uiToolingPreview = - "androidx.compose.ui:ui-tooling-preview:${Versions.Compose.base}" - const val uiUtil = "androidx.compose.ui:ui-util:${Versions.Compose.base}" - } - - object Grpc { - const val grpcOkHttp = "io.grpc:grpc-okhttp:${Versions.Grpc.grpcVersion}" - const val grpcAndroid = "io.grpc:grpc-android:${Versions.Grpc.grpcVersion}" - const val grpcKotlinStub = "io.grpc:grpc-kotlin-stub:${Versions.Grpc.grpcKotlinVersion}" - const val protobufLite = "io.grpc:grpc-protobuf-lite:${Versions.Grpc.grpcVersion}" - const val protobufKotlinLite = - "com.google.protobuf:protobuf-kotlin-lite:${Versions.Grpc.protobufVersion}" - } - - object Koin { - const val core = "io.insert-koin:koin-core:${Versions.Koin.base}" - const val android = "io.insert-koin:koin-android:${Versions.Koin.base}" - const val compose = "io.insert-koin:koin-androidx-compose:${Versions.Koin.compose}" - const val test = "io.insert-koin:koin-test:${Versions.Koin.base}" - } - - object Kotlin { - const val reflect = "org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}" - const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}" - const val test = "org.jetbrains.kotlin:kotlin-test:${Versions.kotlin}" - - const val kotlinNavtivePrebuiltWindowsX86_64 = - "org.jetbrains.kotlin:kotlin-native-prebuilt:${Versions.kotlin}:windows-x86_64@zip" - const val kotlinNavtivePrebuiltLinuxX86_64 = - "org.jetbrains.kotlin:kotlin-native-prebuilt:${Versions.kotlin}:linux-x86_64@tar.gz" - const val kotlinNavtivePrebuiltMacOsAArch64 = - "org.jetbrains.kotlin:kotlin-native-prebuilt:${Versions.kotlin}:macos-aarch64@tar.gz" - const val kotlinNavtivePrebuiltMacOsX86_64 = - "org.jetbrains.kotlin:kotlin-native-prebuilt:${Versions.kotlin}:macos-x86_64@tar.gz" - } - - object KotlinX { - const val coroutinesCore = - "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinx}" - const val coroutinesAndroid = - "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.kotlinx}" - const val coroutinesTest = - "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.kotlinx}" - } - - object MockK { - const val core = "io.mockk:mockk:${Versions.mockk}" - const val android = "io.mockk:mockk-android:${Versions.mockk}" - } - - object Mullvad { - const val daemonGrpc = ":lib:daemon-grpc" - const val vpnService = ":service" - const val tileService = ":tile" - - const val commonLib = ":lib:common" - const val endpointLib = ":lib:endpoint" - const val modelLib = ":lib:model" - const val resourceLib = ":lib:resource" - const val talpidLib = ":lib:talpid" - const val themeLib = ":lib:theme" - const val commonTestLib = ":lib:common-test" - const val billingLib = ":lib:billing" - const val paymentLib = ":lib:payment" - const val mapLib = ":lib:map" - const val sharedLib = ":lib:shared" - const val intentLib = ":lib:intent-provider" - } - - object Plugin { - // The aapt* plugin versions must be in sync with the android plugin version. - // Required for Gradle metadata verification to work properly, see: - // https://github.com/gradle/gradle/issues/19228 - const val aaptLinux = "com.android.tools.build:aapt2:${Versions.Plugin.androidAapt}:linux" - const val aaptOsx = "com.android.tools.build:aapt2:${Versions.Plugin.androidAapt}:osx" - const val aaptWindows = - "com.android.tools.build:aapt2:${Versions.Plugin.androidAapt}:windows" - const val android = "com.android.tools.build:gradle:${Versions.Plugin.android}" - const val androidApplicationId = "com.android.application" - const val androidLibraryId = "com.android.library" - const val androidTestId = "com.android.test" - const val dependencyCheck = - "org.owasp:dependency-check-gradle:${Versions.Plugin.dependencyCheck}" - const val dependencyCheckId = "org.owasp.dependencycheck" - const val detektId = "io.gitlab.arturbosch.detekt" - const val composeCompiler = "org.jetbrains.kotlin.plugin.compose" - const val gradleVersionsId = "com.github.ben-manes.versions" - const val junit5 = "de.mannodermaus.android-junit5" - const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}" - const val kotlinAndroidId = "kotlin-android" - const val kotlinParcelizeId = "kotlin-parcelize" - const val ksp = "com.google.devtools.ksp" - const val ktfmtId = "com.ncorti.ktfmt.gradle" - const val playPublisher = - "com.github.triplet.gradle:play-publisher:${Versions.Plugin.playPublisher}" - const val playPublisherId = "com.github.triplet.play" - - object Protobuf { - const val protobufId = "com.google.protobuf" - const val protocGenGrpcJava = - "io.grpc:protoc-gen-grpc-java:${Versions.Grpc.grpcVersion}" - const val protoc = "com.google.protobuf:protoc:${Versions.Grpc.protobufVersion}" - const val protocGenGrpcKotlin = - "io.grpc:protoc-gen-grpc-kotlin:${Versions.Grpc.grpcKotlinVersion}:jdk8@jar" - - const val protocGenGrpcJavaLinuxAarch_64 = "$protocGenGrpcJava:linux-aarch_64@exe" - const val protocGenGrpcJavaLinuxPpcle_64 = "$protocGenGrpcJava:linux-ppcle_64@exe" - const val protocGenGrpcJavaLinuxS390_64 = "$protocGenGrpcJava:linux-s390_64@exe" - const val protocGenGrpcJavaLinuxX86_32 = "$protocGenGrpcJava:linux-x86_32@exe" - const val protocGenGrpcJavaLinuxX86_64 = "$protocGenGrpcJava:linux-x86_64@exe" - const val protocGenGrpcJavaOsxAarch_64 = "$protocGenGrpcJava:osx-aarch_64@exe" - const val protocGenGrpcJavaOsxX86_64 = "$protocGenGrpcJava:osx-x86_64@exe" - const val protocGenGrpcJavaWindowsX86_32 = "$protocGenGrpcJava:windows-x86_32@exe" - const val protocGenGrpcJavaWindowsX86_64 = "$protocGenGrpcJava:windows-x86_64@exe" - - const val protocLinuxAarch_64 = "$protoc:linux-aarch_64@exe" - const val protocLinuxPpcle_64 = "$protoc:linux-ppcle_64@exe" - const val protocLinuxS390_64 = "$protoc:linux-s390_64@exe" - const val protocLinuxX86_32 = "$protoc:linux-x86_32@exe" - const val protocLinuxX86_64 = "$protoc:linux-x86_64@exe" - const val protocOsxAarch_64 = "$protoc:osx-aarch_64@exe" - const val protocOsxX86_64 = "$protoc:osx-x86_64@exe" - const val protocWindowsX86_32 = "$protoc:windows-x86_32@exe" - const val protocWindowsX86_64 = "$protoc:windows-x86_64@exe" - } - } + const val junitJupiterApi = "org.junit.jupiter:junit-jupiter-api:${Versions.junitJupiter}" + const val junitJupiterEngine = "org.junit.jupiter:junit-jupiter-engine:${Versions.junitJupiter}" + const val junitJupiterParams = "org.junit.jupiter:junit-jupiter-params:${Versions.junitJupiter}" + + const val junit5AndroidPluginId = "de.mannodermaus.android-junit5" + const val junit5AndroidTestCompose = + "de.mannodermaus.junit5:android-test-compose:${Versions.junit5Android}" + const val junit5AndroidTestCore = + "de.mannodermaus.junit5:android-test-core:${Versions.junit5Android}" + const val junit5AndroidTestExtensions = + "de.mannodermaus.junit5:android-test-extensions:${Versions.junit5Android}" + const val junit5AndroidTestRunner = + "de.mannodermaus.junit5:android-test-runner:${Versions.junit5Android}" } diff --git a/android/buildSrc/src/main/kotlin/Projects.kt b/android/buildSrc/src/main/kotlin/Projects.kt deleted file mode 100644 index 7558674654e8..000000000000 --- a/android/buildSrc/src/main/kotlin/Projects.kt +++ /dev/null @@ -1,3 +0,0 @@ -object Projects { - const val testCommon = ":test:common" -} diff --git a/android/buildSrc/src/main/kotlin/Versions.kt b/android/buildSrc/src/main/kotlin/Versions.kt index a98588925452..432a66e9b8fb 100644 --- a/android/buildSrc/src/main/kotlin/Versions.kt +++ b/android/buildSrc/src/main/kotlin/Versions.kt @@ -1,78 +1,10 @@ object Versions { - const val commonsValidator = "1.9.0" - const val jodaTime = "2.12.7" - const val junit = "5.10.2" const val jvmTarget = "17" - const val kermit = "2.0.4" - const val konsist = "0.15.1" - const val kotlin = "2.0.0" - const val kotlinx = "1.8.1" - const val leakCanary = "2.13" - const val mockk = "1.13.12" - const val mockWebserver = "4.12.0" - const val turbine = "1.1.0" - const val billingClient = "6.2.0" + const val compileSdkVersion = 34 + const val minSdkVersion = 26 + const val targetSdkVersion = 34 - object Android { - const val compileSdkVersion = 34 - const val junit = "1.5.0" - const val minSdkVersion = 26 - const val targetSdkVersion = 34 - const val volley = "1.2.1" - } - - object AndroidX { - const val activityCompose = "1.9.1" - const val appcompat = "1.7.0" - const val coreKtx = "1.13.1" - const val coreSplashscreen = "1.1.0-rc01" - const val espresso = "3.6.1" - const val lifecycle = "2.8.4" - const val test = "1.6.1" - const val testMonitor = "1.7.1" - const val testOrchestrator = "1.5.0" - const val testRunner = "1.6.1" - const val uiautomator = "2.4.0-alpha01" - } - - object Arrow { - const val base = "1.2.4" - } - - object Compose { - const val base = "1.7.0-beta06" - const val destinations = "2.1.0-beta10" - const val constrainLayout = "1.0.1" - const val foundation = base - const val material3 = "1.3.0-beta04" - } - - object Grpc { - const val grpcVersion = "1.65.1" - const val grpcKotlinVersion = "1.4.1" - const val protobufVersion = "4.27.2" - } - - object Plugin { - // The androidAapt plugin version must be in sync with the android plugin version. - // Required for Gradle metadata verification to work properly, see: - // https://github.com/gradle/gradle/issues/19228 - const val android = "8.3.0" - const val androidAapt = "$android-10880808" - const val playPublisher = "3.9.0" - const val protobuf = "0.9.4" - const val dependencyCheck = "10.0.3" - const val detekt = "1.23.6" - const val gradleVersions = "0.51.0" - const val junit5 = "1.10.2.0" - const val ktfmt = "0.17.0" - // Ksp version is linked with kotlin version, find matching release here: - // https://github.com/google/ksp/releases - const val ksp = "${kotlin}-1.0.22" - } - - object Koin { - const val base = "3.5.6" - const val compose = "3.5.6" - } + const val junitJupiter = "5.10.2" + const val junit5Android = "1.5.0" + const val junit5Plugin = "1.10.2.0" } diff --git a/android/gradle/libs.versions.toml b/android/gradle/libs.versions.toml new file mode 100644 index 000000000000..f603f7005337 --- /dev/null +++ b/android/gradle/libs.versions.toml @@ -0,0 +1,174 @@ +[versions] +# Android +# The android-gradle-aapt plugin version must be in sync with the android plugin version. +# Required for Gradle metadata verification to work properly, see: +# https://github.com/gradle/gradle/issues/19228 +android-gradle-plugin = "8.3.0" +android-gradle-aapt = "10880808" +android-billingclient = "6.2.0" +android-volley = "1.2.1" + +# AndroidX +androidx-activitycompose = "1.9.1" +androidx-appcompat = "1.7.0" +androidx-ktx = "1.13.1" +androidx-coresplashscreen = "1.1.0-rc01" +androidx-espresso = "3.6.1" +androidx-lifecycle = "2.8.4" +androidx-test = "1.6.1" +androidx-testmonitor = "1.7.1" +androidx-testorchestrator = "1.5.0" +androidx-testrunner = "1.6.1" +androidx-uiautomator = "2.4.0-alpha01" + +# Arrow +arrow = "1.2.4" + +# Compose +compose = "1.7.0-beta06" +compose-destinations = "2.1.0-beta10" +compose-constraintlayout = "1.0.1" +compose-material3 = "1.3.0-beta04" + +grpc = "1.65.1" +grpc-kotlin = "1.4.1" +grpc-kotlin-jar = "1.4.1:jdk8@jar" +grpc-protobuf = "4.27.2" + +# Koin +koin = "3.5.6" +koin-compose = "3.5.6" + +# Kotlin +# Bump kotlin and kotlin-ksp together, find matching release here: +# https://github.com/google/ksp/releases +kotlin = "2.0.0" +kotlin-ksp = "2.0.0-1.0.22" +kotlinx = "1.8.1" + +# Protobuf +protobuf = "0.9.4" + +# Misc +commonsvalidator = "1.9.0" +dependency-check = "10.0.3" +dependency-versions = "0.51.0" +detekt = "1.23.6" +jodatime = "2.12.7" +kermit = "2.0.4" +konsist = "0.15.1" +ktfmt = "0.17.0" +leakcanary = "2.13" +mockk = "1.13.12" +mockwebserver = "4.12.0" +play-publisher = "3.9.0" +turbine = "1.1.0" + +[libraries] +# Android +android-billingclient = { module = "com.android.billingclient:billing-ktx", version.ref = "android-billingclient" } +android-gradle-aapt = { module = "com.android.tools.build:aapt2" } +android-volley = { module = "com.android.volley:volley", version.ref = "android-volley" } + +# AndroidX +androidx-activity-Compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activitycompose" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } +androidx-coresplashscreen = { module = "androidx.core:core-splashscreen", version.ref = "androidx-coresplashscreen" } +androidx-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-espresso" } +androidx-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-ktx" } +androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" } +androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" } +androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" } +androidx-lifecycle-service = { module = "androidx.lifecycle:lifecycle-service", version.ref = "androidx-lifecycle" } +androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test" } +androidx-test-monitor = { module = "androidx.test:monitor", version.ref = "androidx-testmonitor" } +androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-testrunner" } +androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test" } +androidx-test-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "androidx-uiautomator" } +androidx-test-orchestrator = { module = "androidx.test:orchestrator", version.ref = "androidx-testorchestrator" } + +# Arrow +arrow = { module = "io.arrow-kt:arrow-core", version.ref = "arrow" } +arrow-optics = { module = "io.arrow-kt:arrow-optics", version.ref = "arrow" } +arrow-optics-ksp = { module = "io.arrow-kt:arrow-optics-ksp-plugin", version.ref = "arrow" } +arrow-resilience = { module = "io.arrow-kt:arrow-resilience", version.ref = "arrow" } + +# Compose +compose-constrainlayout = { module = "androidx.constraintlayout:constraintlayout-compose", version.ref = "compose-constraintlayout" } +compose-destinations = { module = "io.github.raamcosta.compose-destinations:core", version.ref = "compose-destinations" } +compose-destinations-ksp = { module = "io.github.raamcosta.compose-destinations:ksp", version.ref = "compose-destinations" } +compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" } +compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" } +compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } +compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose" } +compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } +compose-ui-tooling-android-preview = { module = "androidx.compose.ui:ui-tooling-preview-android", version.ref = "compose" } +compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } +compose-ui-util = { module = "androidx.compose.ui:ui-util", version.ref = "compose" } + +# gRPC +grpc-okhttp = { module = "io.grpc:grpc-okhttp", version.ref = "grpc" } +grpc-android = { module = "io.grpc:grpc-android", version.ref = "grpc" } +grpc-kotlin-stub = { module = "io.grpc:grpc-kotlin-stub", version.ref = "grpc-kotlin" } +grpc-protobuf-lite = { module = "io.grpc:grpc-protobuf-lite", version.ref = "grpc" } +grpc-protobuf-kotlin-lite = { module = "com.google.protobuf:protobuf-kotlin-lite", version.ref = "grpc-protobuf" } + +# Koin +koin = { module = "io.insert-koin:koin-core", version.ref = "koin" } +koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" } +koin-compose = { module = "io.insert-koin:koin-androidx-compose", version.ref = "koin-compose" } +koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" } + +# Kotlin +kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } +kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } +kotlin-native-prebuilt = { module = "org.jetbrains.kotlin:kotlin-native-prebuilt", version.ref = "kotlin" } + +# KotlinX +kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx" } + +# MockK +mockk = { module = "io.mockk:mockk", version.ref = "mockk" } +mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockk" } + +# Misc +commons-validator = { module = "commons-validator:commons-validator", version.ref = "commonsvalidator" } +jodatime = { module = "joda-time:joda-time", version.ref = "jodatime" } +kermit = { module = "co.touchlab:kermit", version.ref = "kermit" } +konsist = { module = "com.lemonappdev:konsist", version.ref = "konsist" } +leakCanary = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanary" } +mockkWebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "mockwebserver" } +turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" } + +[plugins] +# Android +android-gradle-plugin = { id = "com.android.tools.build:gradle", version.ref = "android-gradle-plugin" } +android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" } +android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" } +android-test = { id = "com.android.test", version.ref = "android-gradle-plugin" } + +# Compose +compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } + +# Kotlin +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } +kotlin-ksp = { id = "com.google.devtools.ksp", version.ref = "kotlin-ksp"} + +# Protobuf +protobuf-core = { id = "com.google.protobuf", version.ref = "protobuf" } +protobuf-protoc = { id = "com.google.protobuf:protoc", version.ref = "grpc-protobuf" } + +# gRPC +grpc-protoc-gen-grpc-java = { id = "io.grpc:protoc-gen-grpc-java", version.ref = "grpc" } +grpc-protoc-gen-grpc-kotlin = { id = "io.grpc:protoc-gen-grpc-kotlin", version.ref = "grpc-kotlin-jar" } + +# Misc +dependency-check = { id = "org.owasp.dependencycheck", version.ref = "dependency-check" } +dependency-versions = { id = "com.github.ben-manes.versions", version.ref = "dependency-versions" } +detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } +ktfmt = { id = "com.ncorti.ktfmt.gradle", version.ref = "ktfmt" } +play-publisher = { id = "com.github.triplet.play", version.ref = "play-publisher" } diff --git a/android/lib/billing/build.gradle.kts b/android/lib/billing/build.gradle.kts index 6bb4e5e7a620..ea89bc6dcac4 100644 --- a/android/lib/billing/build.gradle.kts +++ b/android/lib/billing/build.gradle.kts @@ -1,15 +1,16 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.junit5) version Versions.Plugin.junit5 - id(Dependencies.Plugin.kotlinAndroidId) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + + id(Dependencies.junit5AndroidPluginId) version Versions.junit5Plugin } android { namespace = "net.mullvad.mullvadvpn.lib.billing" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion defaultConfig { - minSdk = Versions.Android.minSdkVersion + minSdk = Versions.minSdkVersion testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -40,40 +41,40 @@ android { } dependencies { - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.KotlinX.coroutinesAndroid) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) //Billing library - implementation(Dependencies.billingClient) + implementation(libs.android.billingclient) //Model - implementation(project(Dependencies.Mullvad.modelLib)) + implementation(projects.lib.model) //Payment library - implementation(project(Dependencies.Mullvad.paymentLib)) + implementation(projects.lib.payment) //Either - implementation(Dependencies.Arrow.core) + implementation(libs.arrow) // Management service - implementation(project(Dependencies.Mullvad.daemonGrpc)) + implementation(projects.lib.daemonGrpc) // Test dependencies - testRuntimeOnly(Dependencies.junitEngine) - - testImplementation(project(Dependencies.Mullvad.commonTestLib)) - testImplementation(Dependencies.Kotlin.test) - testImplementation(Dependencies.KotlinX.coroutinesTest) - testImplementation(Dependencies.MockK.core) - testImplementation(Dependencies.junitApi) - testImplementation(Dependencies.turbine) - - androidTestImplementation(project(Dependencies.Mullvad.commonTestLib)) - androidTestImplementation(Dependencies.MockK.android) - androidTestImplementation(Dependencies.Kotlin.test) - androidTestImplementation(Dependencies.KotlinX.coroutinesTest) - androidTestImplementation(Dependencies.turbine) - androidTestImplementation(Dependencies.junitApi) - androidTestImplementation(Dependencies.junitEngine) - androidTestImplementation(Dependencies.AndroidX.espressoCore) + testRuntimeOnly(Dependencies.junitJupiterEngine) + + testImplementation(projects.lib.commonTest) + testImplementation(libs.kotlin.test) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.mockk) + testImplementation(Dependencies.junitJupiterApi) + testImplementation(libs.turbine) + + androidTestImplementation(projects.lib.commonTest) + androidTestImplementation(libs.mockk.android) + androidTestImplementation(libs.kotlin.test) + androidTestImplementation(libs.kotlinx.coroutines.test) + androidTestImplementation(libs.turbine) + androidTestImplementation(Dependencies.junitJupiterApi) + androidTestImplementation(Dependencies.junitJupiterEngine) + androidTestImplementation(libs.androidx.espresso) } diff --git a/android/lib/common-test/build.gradle.kts b/android/lib/common-test/build.gradle.kts index 6e3fc7c02f16..0f96eca4159f 100644 --- a/android/lib/common-test/build.gradle.kts +++ b/android/lib/common-test/build.gradle.kts @@ -1,13 +1,13 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) } android { namespace = "net.mullvad.mullvadvpn.lib.common.test" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -34,7 +34,7 @@ android { } dependencies { - implementation(Dependencies.Kotlin.test) - implementation(Dependencies.KotlinX.coroutinesTest) - implementation(Dependencies.junitApi) + implementation(libs.kotlin.test) + implementation(libs.kotlinx.coroutines.test) + implementation(Dependencies.junitJupiterApi) } diff --git a/android/lib/common/build.gradle.kts b/android/lib/common/build.gradle.kts index e327a8922cd9..0bc10aa6c4de 100644 --- a/android/lib/common/build.gradle.kts +++ b/android/lib/common/build.gradle.kts @@ -1,14 +1,14 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) } android { namespace = "net.mullvad.mullvadvpn.lib.common" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -25,12 +25,12 @@ android { } dependencies { - implementation(project(Dependencies.Mullvad.modelLib)) - implementation(project(Dependencies.Mullvad.resourceLib)) - implementation(project(Dependencies.Mullvad.talpidLib)) + implementation(projects.lib.model) + implementation(projects.lib.resource) + implementation(projects.lib.talpid) - implementation(Dependencies.AndroidX.appcompat) - implementation(Dependencies.jodaTime) - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.KotlinX.coroutinesAndroid) + implementation(libs.androidx.appcompat) + implementation(libs.jodatime) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) } diff --git a/android/lib/daemon-grpc/build.gradle.kts b/android/lib/daemon-grpc/build.gradle.kts index 840de579842f..661e4e0d992f 100644 --- a/android/lib/daemon-grpc/build.gradle.kts +++ b/android/lib/daemon-grpc/build.gradle.kts @@ -1,18 +1,19 @@ import com.google.protobuf.gradle.proto plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) - id(Dependencies.Plugin.Protobuf.protobufId) version Versions.Plugin.protobuf - id(Dependencies.Plugin.junit5) version Versions.Plugin.junit5 + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) + alias(libs.plugins.protobuf.core) + + id(Dependencies.junit5AndroidPluginId) version Versions.junit5Plugin } android { namespace = "net.mullvad.mullvadvpn.lib.daemon.grpc" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -35,11 +36,11 @@ android { } protobuf { - protoc { artifact = Dependencies.Plugin.Protobuf.protoc } + protoc { artifact = libs.plugins.protobuf.protoc.get().toString() } plugins { - create("java") { artifact = Dependencies.Plugin.Protobuf.protocGenGrpcJava } - create("grpc") { artifact = Dependencies.Plugin.Protobuf.protocGenGrpcJava } - create("grpckt") { artifact = Dependencies.Plugin.Protobuf.protocGenGrpcKotlin } + create("java") { artifact = libs.plugins.grpc.protoc.gen.grpc.java.get().toString() } + create("grpc") { artifact = libs.plugins.grpc.protoc.gen.grpc.java.get().toString() } + create("grpckt") { artifact = libs.plugins.grpc.protoc.gen.grpc.kotlin.get().toString() } } generateProtoTasks { all().forEach { @@ -54,31 +55,31 @@ protobuf { } dependencies { - implementation(project(Dependencies.Mullvad.commonLib)) - implementation(project(Dependencies.Mullvad.modelLib)) - implementation(project(Dependencies.Mullvad.talpidLib)) + implementation(projects.lib.common) + implementation(projects.lib.model) + implementation(projects.lib.talpid) - implementation(Dependencies.jodaTime) - implementation(Dependencies.kermit) - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.KotlinX.coroutinesCore) - implementation(Dependencies.KotlinX.coroutinesAndroid) + implementation(libs.jodatime) + implementation(libs.kermit) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines) + implementation(libs.kotlinx.coroutines.android) - implementation(Dependencies.Grpc.grpcOkHttp) - implementation(Dependencies.Grpc.grpcAndroid) - implementation(Dependencies.Grpc.grpcKotlinStub) - implementation(Dependencies.Grpc.protobufLite) - implementation(Dependencies.Grpc.protobufKotlinLite) + implementation(libs.grpc.okhttp) + implementation(libs.grpc.android) + implementation(libs.grpc.kotlin.stub) + implementation(libs.grpc.protobuf.lite) + implementation(libs.grpc.protobuf.kotlin.lite) - implementation(Dependencies.Arrow.core) - implementation(Dependencies.Arrow.optics) + implementation(libs.arrow) + implementation(libs.arrow.optics) - testImplementation(project(Dependencies.Mullvad.commonTestLib)) - testImplementation(Dependencies.Kotlin.test) - testImplementation(Dependencies.KotlinX.coroutinesTest) - testImplementation(Dependencies.MockK.core) - testImplementation(Dependencies.turbine) - testImplementation(Dependencies.junitApi) - testRuntimeOnly(Dependencies.junitEngine) - testImplementation(Dependencies.junitParams) + testImplementation(projects.lib.commonTest) + testImplementation(libs.kotlin.test) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.mockk) + testImplementation(libs.turbine) + testImplementation(Dependencies.junitJupiterApi) + testRuntimeOnly(Dependencies.junitJupiterEngine) + testImplementation(Dependencies.junitJupiterParams) } diff --git a/android/lib/endpoint/build.gradle.kts b/android/lib/endpoint/build.gradle.kts index 0bf140b743dd..638be8b1224d 100644 --- a/android/lib/endpoint/build.gradle.kts +++ b/android/lib/endpoint/build.gradle.kts @@ -1,14 +1,14 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) } android { namespace = "net.mullvad.mullvadvpn.lib.endpoint" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -27,4 +27,4 @@ android { } } -dependencies { implementation(Dependencies.Kotlin.stdlib) } +dependencies { implementation(libs.kotlin.stdlib) } diff --git a/android/lib/intent-provider/build.gradle.kts b/android/lib/intent-provider/build.gradle.kts index f63a9c7f69a8..ca88d7f26fc7 100644 --- a/android/lib/intent-provider/build.gradle.kts +++ b/android/lib/intent-provider/build.gradle.kts @@ -1,14 +1,14 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) } android { namespace = "net.mullvad.mullvadvpn.lib.intent" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -26,6 +26,6 @@ android { } dependencies { - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.KotlinX.coroutinesAndroid) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) } diff --git a/android/lib/map/build.gradle.kts b/android/lib/map/build.gradle.kts index dee6779d8a72..ceef054d35c2 100644 --- a/android/lib/map/build.gradle.kts +++ b/android/lib/map/build.gradle.kts @@ -1,14 +1,14 @@ plugins { - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.composeCompiler) version Versions.kotlin + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.compose) } android { namespace = "net.mullvad.mullvadvpn.lib.map" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -30,10 +30,10 @@ android { } dependencies { - implementation(project(Dependencies.Mullvad.modelLib)) + implementation(projects.lib.model) - implementation(Dependencies.AndroidX.lifecycleRuntimeKtx) - implementation(Dependencies.Compose.ui) - implementation(Dependencies.Compose.foundation) - implementation(Dependencies.kermit) + implementation(libs.androidx.lifecycle.runtime) + implementation(libs.compose.ui) + implementation(libs.compose.foundation) + implementation(libs.kermit) } diff --git a/android/lib/model/build.gradle.kts b/android/lib/model/build.gradle.kts index 28a5804b5f4f..0a19eecee5d2 100644 --- a/android/lib/model/build.gradle.kts +++ b/android/lib/model/build.gradle.kts @@ -1,17 +1,18 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.junit5) version Versions.Plugin.junit5 - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) - id(Dependencies.Plugin.ksp) version Versions.Plugin.ksp + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) + alias(libs.plugins.kotlin.ksp) + + id(Dependencies.junit5AndroidPluginId) version Versions.junit5Plugin } android { namespace = "net.mullvad.mullvadvpn.lib.model" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion defaultConfig { - minSdk = Versions.Android.minSdkVersion + minSdk = Versions.minSdkVersion testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -30,18 +31,18 @@ android { } dependencies { - implementation(Dependencies.jodaTime) - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.KotlinX.coroutinesAndroid) - implementation(Dependencies.Arrow.core) - implementation(Dependencies.Arrow.optics) - ksp(Dependencies.Arrow.opticsKsp) + implementation(libs.jodatime) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) + implementation(libs.arrow) + implementation(libs.arrow.optics) + ksp(libs.arrow.optics.ksp) // Test dependencies - testRuntimeOnly(Dependencies.junitEngine) + testRuntimeOnly(Dependencies.junitJupiterEngine) - testImplementation(Dependencies.Kotlin.test) - testImplementation(Dependencies.junitApi) + testImplementation(libs.kotlin.test) + testImplementation(Dependencies.junitJupiterApi) - testImplementation(project(Dependencies.Mullvad.commonTestLib)) + testImplementation(projects.lib.commonTest) } diff --git a/android/lib/payment/build.gradle.kts b/android/lib/payment/build.gradle.kts index 892ce21c75df..57a16627a13e 100644 --- a/android/lib/payment/build.gradle.kts +++ b/android/lib/payment/build.gradle.kts @@ -1,14 +1,14 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) } android { namespace = "net.mullvad.mullvadvpn.lib.payment" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion defaultConfig { - minSdk = Versions.Android.minSdkVersion + minSdk = Versions.minSdkVersion testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -39,7 +39,7 @@ android { } dependencies { - implementation(Dependencies.Arrow.core) - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.KotlinX.coroutinesAndroid) + implementation(libs.arrow) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) } diff --git a/android/lib/resource/build.gradle.kts b/android/lib/resource/build.gradle.kts index f3b1d02faf8d..c2547d1beb56 100644 --- a/android/lib/resource/build.gradle.kts +++ b/android/lib/resource/build.gradle.kts @@ -1,14 +1,14 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) } android { namespace = "net.mullvad.mullvadvpn.lib.resource" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -26,6 +26,6 @@ android { } dependencies { - implementation(Dependencies.AndroidX.appcompat) - implementation(Dependencies.AndroidX.coreSplashscreen) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.coresplashscreen) } diff --git a/android/lib/shared/build.gradle.kts b/android/lib/shared/build.gradle.kts index a1bf4a9c7504..68078c0a6aaf 100644 --- a/android/lib/shared/build.gradle.kts +++ b/android/lib/shared/build.gradle.kts @@ -1,15 +1,16 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) - id(Dependencies.Plugin.junit5) version Versions.Plugin.junit5 + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) + + id(Dependencies.junit5AndroidPluginId) version Versions.junit5Plugin } android { namespace = "net.mullvad.mullvadvpn.lib.shared" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -27,22 +28,22 @@ android { } dependencies { - implementation(project(Dependencies.Mullvad.commonLib)) - implementation(project(Dependencies.Mullvad.daemonGrpc)) - implementation(project(Dependencies.Mullvad.modelLib)) - - implementation(Dependencies.Arrow.core) - implementation(Dependencies.kermit) - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.KotlinX.coroutinesAndroid) - implementation(Dependencies.jodaTime) - - testImplementation(Dependencies.Kotlin.test) - testImplementation(Dependencies.KotlinX.coroutinesTest) - testImplementation(Dependencies.MockK.core) - testImplementation(Dependencies.junitApi) - testImplementation(Dependencies.junitParams) - testImplementation(Dependencies.turbine) - testImplementation(project(Dependencies.Mullvad.commonTestLib)) - testRuntimeOnly(Dependencies.junitEngine) + implementation(projects.lib.common) + implementation(projects.lib.daemonGrpc) + implementation(projects.lib.model) + + implementation(libs.arrow) + implementation(libs.kermit) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) + implementation(libs.jodatime) + + testImplementation(libs.kotlin.test) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.mockk) + testImplementation(Dependencies.junitJupiterApi) + testImplementation(Dependencies.junitJupiterParams) + testImplementation(libs.turbine) + testImplementation(projects.lib.commonTest) + testRuntimeOnly(Dependencies.junitJupiterEngine) } diff --git a/android/lib/talpid/build.gradle.kts b/android/lib/talpid/build.gradle.kts index b8426e3a8140..353621b30bc5 100644 --- a/android/lib/talpid/build.gradle.kts +++ b/android/lib/talpid/build.gradle.kts @@ -1,14 +1,14 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) } android { namespace = "net.mullvad.talpid" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -25,10 +25,10 @@ android { } dependencies { - implementation(project(Dependencies.Mullvad.modelLib)) + implementation(projects.lib.model) - implementation(Dependencies.AndroidX.lifecycleService) - implementation(Dependencies.kermit) - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.KotlinX.coroutinesAndroid) + implementation(libs.androidx.lifecycle.service) + implementation(libs.kermit) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) } diff --git a/android/lib/theme/build.gradle.kts b/android/lib/theme/build.gradle.kts index 33f094fba487..22387a5e8c21 100644 --- a/android/lib/theme/build.gradle.kts +++ b/android/lib/theme/build.gradle.kts @@ -1,14 +1,14 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.composeCompiler) version Versions.kotlin + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.compose) } android { namespace = "net.mullvad.mullvadvpn.lib.theme" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } buildFeatures { compose = true } @@ -27,7 +27,7 @@ android { } dependencies { - implementation(Dependencies.Compose.material3) - implementation(Dependencies.Compose.ui) - implementation(Dependencies.Kotlin.stdlib) + implementation(libs.compose.material3) + implementation(libs.compose.ui) + implementation(libs.kotlin.stdlib) } diff --git a/android/service/build.gradle.kts b/android/service/build.gradle.kts index 0927cde58b8b..89bcf1e663ca 100644 --- a/android/service/build.gradle.kts +++ b/android/service/build.gradle.kts @@ -1,21 +1,25 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) } android { namespace = "net.mullvad.mullvadvpn.service" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { + minSdk = Versions.minSdkVersion + } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } - kotlinOptions { jvmTarget = Versions.jvmTarget } + kotlinOptions { + jvmTarget = Versions.jvmTarget + } lint { lintConfig = file("${rootProject.projectDir}/config/lint.xml") @@ -49,21 +53,21 @@ android { } dependencies { - implementation(project(Dependencies.Mullvad.commonLib)) - implementation(project(Dependencies.Mullvad.daemonGrpc)) - implementation(project(Dependencies.Mullvad.endpointLib)) - implementation(project(Dependencies.Mullvad.intentLib)) - implementation(project(Dependencies.Mullvad.modelLib)) - implementation(project(Dependencies.Mullvad.sharedLib)) - implementation(project(Dependencies.Mullvad.talpidLib)) + implementation(projects.lib.common) + implementation(projects.lib.daemonGrpc) + implementation(projects.lib.endpoint) + implementation(projects.lib.intentProvider) + implementation(projects.lib.model) + implementation(projects.lib.shared) + implementation(projects.lib.talpid) - implementation(Dependencies.AndroidX.coreKtx) - implementation(Dependencies.AndroidX.lifecycleService) - implementation(Dependencies.Arrow.core) - implementation(Dependencies.kermit) - implementation(Dependencies.Koin.android) - implementation(Dependencies.Koin.core) - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.KotlinX.coroutinesAndroid) - implementation(Dependencies.jodaTime) + implementation(libs.androidx.ktx) + implementation(libs.androidx.lifecycle.service) + implementation(libs.arrow) + implementation(libs.kermit) + implementation(libs.koin) + implementation(libs.koin.android) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) + implementation(libs.jodatime) } diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts index b03fc2538a4b..2f97c653dda4 100644 --- a/android/settings.gradle.kts +++ b/android/settings.gradle.kts @@ -1,3 +1,13 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + include( ":app", ":service", diff --git a/android/test/arch/build.gradle.kts b/android/test/arch/build.gradle.kts index d2debc07dd98..01922ac2dea0 100644 --- a/android/test/arch/build.gradle.kts +++ b/android/test/arch/build.gradle.kts @@ -1,14 +1,15 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.junit5) version Versions.Plugin.junit5 + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + + id(Dependencies.junit5AndroidPluginId) version Versions.junit5Plugin } android { namespace = "net.mullvad.mullvadvpn.test.arch" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -29,11 +30,11 @@ androidComponents { } dependencies { - testRuntimeOnly(Dependencies.junitEngine) + testRuntimeOnly(Dependencies.junitJupiterEngine) - testImplementation(Dependencies.Compose.uiToolingAndroidPreview) - testImplementation(Dependencies.Compose.destinations) - testImplementation(Dependencies.AndroidX.appcompat) - testImplementation(Dependencies.junitApi) - testImplementation(Dependencies.konsist) + testImplementation(libs.compose.ui.tooling.android.preview) + testImplementation(libs.compose.destinations) + testImplementation(libs.androidx.appcompat) + testImplementation(Dependencies.junitJupiterApi) + testImplementation(libs.konsist) } diff --git a/android/test/common/build.gradle.kts b/android/test/common/build.gradle.kts index 84a7a46c9c24..65bd43ed1cd8 100644 --- a/android/test/common/build.gradle.kts +++ b/android/test/common/build.gradle.kts @@ -1,14 +1,14 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) } android { namespace = "net.mullvad.mullvadvpn.test.common" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -41,15 +41,15 @@ androidComponents { } dependencies { - implementation(project(Dependencies.Mullvad.endpointLib)) + implementation(projects.lib.endpoint) - implementation(Dependencies.AndroidX.testCore) - implementation(Dependencies.AndroidX.testRunner) - implementation(Dependencies.AndroidX.testRules) - implementation(Dependencies.AndroidX.testUiAutomator) - implementation(Dependencies.junitEngine) - implementation(Dependencies.kermit) - implementation(Dependencies.Kotlin.stdlib) + implementation(libs.androidx.test.core) + implementation(libs.androidx.test.runner) + implementation(libs.androidx.test.rules) + implementation(libs.androidx.test.uiautomator) + implementation(Dependencies.junitJupiterEngine) + implementation(libs.kermit) + implementation(libs.kotlin.stdlib) - androidTestUtil(Dependencies.AndroidX.testOrchestrator) + androidTestUtil(libs.androidx.test.orchestrator) } diff --git a/android/test/e2e/build.gradle.kts b/android/test/e2e/build.gradle.kts index f7afe1b3afb0..2e9d19b83cd2 100644 --- a/android/test/e2e/build.gradle.kts +++ b/android/test/e2e/build.gradle.kts @@ -3,17 +3,18 @@ import java.util.Properties import org.gradle.configurationcache.extensions.capitalized plugins { - id(Dependencies.Plugin.androidTestId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.junit5) version Versions.Plugin.junit5 + alias(libs.plugins.android.test) + alias(libs.plugins.kotlin.android) + + id(Dependencies.junit5AndroidPluginId) version Versions.junit5Plugin } android { namespace = "net.mullvad.mullvadvpn.test.e2e" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion defaultConfig { - minSdk = Versions.Android.minSdkVersion + minSdk = Versions.minSdkVersion testApplicationId = "net.mullvad.mullvadvpn.test.e2e" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments["runnerBuilder"] = @@ -125,21 +126,20 @@ configure { } dependencies { - implementation(project(Projects.testCommon)) - implementation(project(Dependencies.Mullvad.endpointLib)) - implementation(Dependencies.AndroidX.testCore) + implementation(projects.test.common) + implementation(projects.lib.endpoint) + implementation(libs.androidx.test.core) // Fixes: https://github.com/android/android-test/issues/1589 - implementation(Dependencies.AndroidX.testMonitor) - implementation(Dependencies.AndroidX.testRunner) - implementation(Dependencies.AndroidX.testRules) - implementation(Dependencies.AndroidX.testUiAutomator) - implementation(Dependencies.androidVolley) - implementation(Dependencies.kermit) - implementation(Dependencies.junitAndroidTestExtensions) - implementation(Dependencies.junitApi) - implementation(Dependencies.junitAndroidTestCore) - implementation(Dependencies.junitAndroidTestRunner) - implementation(Dependencies.Kotlin.stdlib) - - androidTestUtil(Dependencies.AndroidX.testOrchestrator) + implementation(libs.androidx.test.monitor) + implementation(libs.androidx.test.runner) + implementation(libs.androidx.test.rules) + implementation(libs.androidx.test.uiautomator) + implementation(libs.android.volley) + implementation(libs.kermit) + implementation(Dependencies.junitJupiterApi) + implementation(Dependencies.junit5AndroidTestExtensions) + implementation(Dependencies.junit5AndroidTestRunner) + implementation(libs.kotlin.stdlib) + + androidTestUtil(libs.androidx.test.orchestrator) } diff --git a/android/test/mockapi/build.gradle.kts b/android/test/mockapi/build.gradle.kts index 69991d24bba2..cc13c6dbed46 100644 --- a/android/test/mockapi/build.gradle.kts +++ b/android/test/mockapi/build.gradle.kts @@ -1,15 +1,16 @@ plugins { - id(Dependencies.Plugin.androidTestId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.junit5) version Versions.Plugin.junit5 + alias(libs.plugins.android.test) + alias(libs.plugins.kotlin.android) + + id(Dependencies.junit5AndroidPluginId) version Versions.junit5Plugin } android { namespace = "net.mullvad.mullvadvpn.test.mockapi" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion defaultConfig { - minSdk = Versions.Android.minSdkVersion + minSdk = Versions.minSdkVersion testApplicationId = "net.mullvad.mullvadvpn.test.mockapi" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments["runnerBuilder"] = @@ -69,23 +70,22 @@ configure { } dependencies { - implementation(project(Projects.testCommon)) - implementation(project(Dependencies.Mullvad.endpointLib)) + implementation(projects.lib.endpoint) + implementation(projects.test.common) - implementation(Dependencies.AndroidX.testCore) + implementation(libs.androidx.test.core) // Fixes: https://github.com/android/android-test/issues/1589 - implementation(Dependencies.AndroidX.testMonitor) - implementation(Dependencies.AndroidX.testRunner) - implementation(Dependencies.AndroidX.testRules) - implementation(Dependencies.AndroidX.testUiAutomator) - implementation(Dependencies.kermit) - implementation(Dependencies.jodaTime) - implementation(Dependencies.junitAndroidTestExtensions) - implementation(Dependencies.junitApi) - implementation(Dependencies.junitAndroidTestCore) - implementation(Dependencies.junitAndroidTestRunner) - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.mockkWebserver) - - androidTestUtil(Dependencies.AndroidX.testOrchestrator) + implementation(libs.androidx.test.monitor) + implementation(libs.androidx.test.runner) + implementation(libs.androidx.test.rules) + implementation(libs.androidx.test.uiautomator) + implementation(libs.kermit) + implementation(libs.jodatime) + implementation(Dependencies.junitJupiterApi) + implementation(Dependencies.junit5AndroidTestExtensions) + implementation(Dependencies.junit5AndroidTestRunner) + implementation(libs.kotlin.stdlib) + implementation(libs.mockkWebserver) + + androidTestUtil(libs.androidx.test.orchestrator) } diff --git a/android/tile/build.gradle.kts b/android/tile/build.gradle.kts index ecd1884e2d85..cb2806d0e0e8 100644 --- a/android/tile/build.gradle.kts +++ b/android/tile/build.gradle.kts @@ -1,14 +1,14 @@ plugins { - id(Dependencies.Plugin.androidLibraryId) - id(Dependencies.Plugin.kotlinAndroidId) - id(Dependencies.Plugin.kotlinParcelizeId) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) } android { namespace = "net.mullvad.mullvadvpn.tile" - compileSdk = Versions.Android.compileSdkVersion + compileSdk = Versions.compileSdkVersion - defaultConfig { minSdk = Versions.Android.minSdkVersion } + defaultConfig { minSdk = Versions.minSdkVersion } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -25,18 +25,18 @@ android { } dependencies { - implementation(project(Dependencies.Mullvad.commonLib)) - implementation(project(Dependencies.Mullvad.daemonGrpc)) - implementation(project(Dependencies.Mullvad.modelLib)) - implementation(project(Dependencies.Mullvad.resourceLib)) - implementation(project(Dependencies.Mullvad.sharedLib)) - implementation(project(Dependencies.Mullvad.talpidLib)) - - implementation(Dependencies.Koin.core) - implementation(Dependencies.Koin.android) - - implementation(Dependencies.AndroidX.appcompat) - implementation(Dependencies.kermit) - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.KotlinX.coroutinesAndroid) + implementation(projects.lib.common) + implementation(projects.lib.daemonGrpc) + implementation(projects.lib.model) + implementation(projects.lib.resource) + implementation(projects.lib.shared) + implementation(projects.lib.talpid) + + implementation(libs.koin) + implementation(libs.koin.android) + + implementation(libs.androidx.appcompat) + implementation(libs.kermit) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.android) } From 02fa21f7935ec460e137d1a9d13679a6a3fa7af1 Mon Sep 17 00:00:00 2001 From: Albin Date: Mon, 12 Aug 2024 21:51:35 +0200 Subject: [PATCH 2/3] Ignore gradle dependency lint checks temporarily These checks will be enabled again after the version catalog migration. --- android/config/lint.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/config/lint.xml b/android/config/lint.xml index e8916acb638d..b885b0b711aa 100644 --- a/android/config/lint.xml +++ b/android/config/lint.xml @@ -9,4 +9,7 @@ + + + From 389318041ad9b6326e11e4de173bcdd4094f1f5f Mon Sep 17 00:00:00 2001 From: Albin Date: Mon, 12 Aug 2024 23:15:30 +0200 Subject: [PATCH 3/3] Update gradle lockfile --- android/gradle/verification-metadata.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/android/gradle/verification-metadata.xml b/android/gradle/verification-metadata.xml index f4e4e7c3ce27..6f05da405939 100644 --- a/android/gradle/verification-metadata.xml +++ b/android/gradle/verification-metadata.xml @@ -2999,11 +2999,6 @@ - - - - -