Skip to content

Commit f0964cb

Browse files
authored
Migrate to Gradle version catalog (#34)
* Upgrade Gradle Wrapper Signed-off-by: Arnau Mora Gras <[email protected]> * Migrated plugins Signed-off-by: Arnau Mora Gras <[email protected]> * Migrated libraries Signed-off-by: Arnau Mora Gras <[email protected]> * Rollback sample app Signed-off-by: Arnau Mora Gras <[email protected]> * Removed deprecated extensions Signed-off-by: Arnau Mora Gras <[email protected]> * Migrated to kts and version catalog Signed-off-by: Arnau Mora Gras <[email protected]> --------- Signed-off-by: Arnau Mora Gras <[email protected]>
1 parent 2bb3898 commit f0964cb

File tree

7 files changed

+144
-99
lines changed

7 files changed

+144
-99
lines changed

build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
3-
id("com.android.library") version "8.1.2" apply false
4-
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
5-
id("org.jetbrains.dokka") version "1.8.20" apply false
3+
alias(libs.plugins.android.application) apply false
4+
alias(libs.plugins.android.library) apply false
5+
alias(libs.plugins.dokka) apply false
6+
alias(libs.plugins.kotlin.android) apply false
67
}
78

89
group = "at.bitfire"

gradle/libs.versions.toml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[versions]
2+
agp = "8.2.2"
3+
androidx-activityCompose = "1.8.2"
4+
androidx-appcompat = "1.6.1"
5+
androidx-core = "1.12.0"
6+
androidx-lifecycle = "2.7.0"
7+
androidx-test-core = "1.5.0"
8+
androidx-test-runner = "1.5.2"
9+
androidx-test-rules = "1.5.0"
10+
conscrypt = "2.5.2"
11+
compose-compiler = "1.5.8"
12+
compose-material = "1.6.0"
13+
compose-runtime = "1.6.0"
14+
compose-ui = "1.6.0"
15+
dokka = "1.9.10"
16+
junit = "4.13.2"
17+
kotlin = "1.9.22"
18+
material = "1.11.0"
19+
mockk = "1.13.9"
20+
okhttp3 = "4.12.0"
21+
22+
[libraries]
23+
android-material = { module = "com.google.android.material:material", version.ref = "material" }
24+
androidx-activityCompose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
25+
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
26+
androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core" }
27+
androidx-lifecycle-livedata = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "androidx-lifecycle" }
28+
androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
29+
androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" }
30+
androidx-test-core = { module = "androidx.test:core-ktx", version.ref = "androidx-test-core" }
31+
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" }
32+
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test-rules" }
33+
compose-material = { module = "androidx.compose.material:material", version.ref = "compose-material" }
34+
compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata", version.ref = "compose-runtime" }
35+
compose-ui-base = { module = "androidx.compose.ui:ui", version.ref = "compose-ui" }
36+
compose-ui-graphics = { module = "androidx.compose.ui:ui-graphics", version.ref = "compose-ui" }
37+
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose-ui" }
38+
compose-ui-toolingPreview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose-ui" }
39+
conscrypt = { module = "org.conscrypt:conscrypt-android", version.ref = "conscrypt" }
40+
junit = { module = "junit:junit", version.ref = "junit" }
41+
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
42+
okttp3-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp3" }
43+
mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockk" }
44+
45+
[plugins]
46+
android-application = { id = "com.android.application", version.ref = "agp" }
47+
android-library = { id = "com.android.library", version.ref = "agp" }
48+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
49+
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Wed May 17 11:37:23 CEST 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

lib/build.gradle.kts

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
plugins {
2-
id("com.android.library")
3-
id("kotlin-android")
4-
id("org.jetbrains.dokka")
5-
id("maven-publish")
2+
alias(libs.plugins.android.library)
3+
alias(libs.plugins.dokka)
4+
alias(libs.plugins.kotlin.android)
5+
`maven-publish`
66
}
77

88
android {
@@ -32,7 +32,7 @@ android {
3232
}
3333

3434
composeOptions {
35-
kotlinCompilerExtensionVersion = "1.5.2"
35+
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
3636
}
3737

3838
lint {
@@ -77,30 +77,26 @@ publishing {
7777
}
7878

7979
dependencies {
80-
implementation("org.jetbrains.kotlin:kotlin-stdlib")
80+
implementation(libs.kotlin.stdlib)
8181

82-
implementation("androidx.appcompat:appcompat:1.6.1")
83-
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
84-
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.2")
85-
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2")
86-
implementation("com.google.android.material:material:1.10.0")
87-
implementation("org.conscrypt:conscrypt-android:2.5.2")
82+
implementation(libs.androidx.appcompat)
83+
implementation(libs.androidx.lifecycle.livedata)
84+
implementation(libs.androidx.lifecycle.viewmodel)
85+
implementation(libs.android.material)
86+
implementation(libs.conscrypt)
8887

8988
// Jetpack Compose
90-
val composeBom = platform("androidx.compose:compose-bom:2023.08.00")
91-
implementation(composeBom)
92-
androidTestImplementation(composeBom)
93-
implementation("androidx.activity:activity-compose:1.8.0")
94-
implementation("androidx.compose.material:material")
95-
implementation("androidx.compose.runtime:runtime-livedata")
96-
debugImplementation("androidx.compose.ui:ui-tooling")
97-
implementation("androidx.compose.ui:ui-tooling-preview")
98-
99-
androidTestImplementation("androidx.test:core-ktx:1.5.0")
100-
androidTestImplementation("androidx.test:runner:1.5.2")
101-
androidTestImplementation("androidx.test:rules:1.5.0")
102-
androidTestImplementation("com.squareup.okhttp3:mockwebserver:4.11.0")
103-
androidTestImplementation("io.mockk:mockk-android:1.13.8")
104-
105-
testImplementation("junit:junit:4.13.2")
89+
implementation(libs.androidx.activityCompose)
90+
implementation(libs.compose.material)
91+
implementation(libs.compose.runtime.livedata)
92+
debugImplementation(libs.compose.ui.tooling)
93+
implementation(libs.compose.ui.toolingPreview)
94+
95+
androidTestImplementation(libs.androidx.test.core)
96+
androidTestImplementation(libs.androidx.test.runner)
97+
androidTestImplementation(libs.androidx.test.rules)
98+
androidTestImplementation(libs.okttp3.mockwebserver)
99+
androidTestImplementation(libs.mockk.android)
100+
101+
testImplementation(libs.junit)
106102
}

sample-app/build.gradle

Lines changed: 0 additions & 66 deletions
This file was deleted.

sample-app/build.gradle.kts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
}
5+
6+
android {
7+
namespace = "at.bitfire.cert4android.demo"
8+
compileSdk = 34
9+
10+
defaultConfig {
11+
applicationId = "at.bitfire.cert4android.demo"
12+
versionCode = 1
13+
versionName = "1.0.0"
14+
15+
minSdk = 21
16+
targetSdk = 34
17+
18+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
19+
vectorDrawables {
20+
useSupportLibrary = true
21+
}
22+
}
23+
24+
buildTypes {
25+
release {
26+
isMinifyEnabled = false
27+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
28+
}
29+
}
30+
compileOptions {
31+
sourceCompatibility = JavaVersion.VERSION_1_8
32+
targetCompatibility = JavaVersion.VERSION_1_8
33+
}
34+
kotlinOptions {
35+
jvmTarget = "1.8"
36+
}
37+
buildFeatures {
38+
compose = true
39+
}
40+
composeOptions {
41+
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() // keep in sync with Kotlin version in top-level build.gradle
42+
}
43+
packaging {
44+
resources {
45+
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
46+
}
47+
}
48+
}
49+
50+
dependencies {
51+
implementation(libs.androidx.core)
52+
implementation(libs.androidx.lifecycle.runtime)
53+
54+
implementation(libs.androidx.appcompat)
55+
implementation(libs.android.material)
56+
57+
implementation(libs.androidx.activityCompose)
58+
implementation(libs.compose.material)
59+
implementation(libs.compose.ui.base)
60+
implementation(libs.compose.ui.graphics)
61+
debugImplementation(libs.compose.ui.toolingPreview)
62+
implementation(libs.compose.runtime.livedata)
63+
64+
implementation(project(":cert4android"))
65+
}

sample-app/proguard-rules.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Add project specific ProGuard rules here.
22
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
3+
# proguardFiles setting in build.gradle.kts.
44
#
55
# For more details, see
66
# http://developer.android.com/guide/developing/tools/proguard.html

0 commit comments

Comments
 (0)