Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to version catalogs #6607

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 70 additions & 69 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -245,7 +246,7 @@ android {

junitPlatform {
instrumentationTests {
version.set(Versions.Android.junit)
version.set(Versions.junit5Android)
includeExtensions.set(true)
}
}
Expand Down Expand Up @@ -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)
}
95 changes: 54 additions & 41 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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:[email protected]")
classpath("$prebuilt:[email protected]")
classpath("$prebuilt:[email protected]")
}
}

Expand Down Expand Up @@ -89,8 +102,8 @@ tasks.withType<DetektCreateBaselineTask>().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()
Expand Down
Loading
Loading