Skip to content

Commit bfa19f6

Browse files
Merge pull request #635 from pennlabs/kotlin-migration
Introducing Gradle Version Catalog
2 parents 0732e18 + 81b2052 commit bfa19f6

File tree

3 files changed

+246
-90
lines changed

3 files changed

+246
-90
lines changed

PennMobile/build.gradle

Lines changed: 60 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
plugins {
2-
id 'com.android.application'
3-
id 'org.jetbrains.kotlin.android'
4-
id 'com.google.gms.google-services'
5-
id("com.google.firebase.crashlytics")
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
alias(libs.plugins.google.services)
5+
alias(libs.plugins.firebase.crashlytics)
66
id 'jacoco'
77
id 'kotlin-parcelize'
88
}
99

10-
apply plugin: "kotlin-android"
11-
1210
android {
1311
namespace 'com.pennapps.labs.pennmobile'
1412
buildFeatures {
@@ -52,88 +50,65 @@ android {
5250
dependencies {
5351
implementation fileTree(include: ['*.jar'], dir: 'libs')
5452

55-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
56-
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
57-
androidTestImplementation 'com.kaspersky.android-components:kaspresso:1.5.3'
58-
androidTestImplementation 'org.testng:testng:7.8.0'
53+
androidTestImplementation libs.androidx.espresso.core
54+
androidTestImplementation libs.androidx.junit
55+
androidTestImplementation libs.kaspresso
56+
androidTestImplementation libs.testng
5957

60-
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
58+
annotationProcessor libs.compiler
6159

62-
debugImplementation 'com.squareup.leakcanary:leakcanary-android:3.0-alpha-1'
60+
debugImplementation libs.leakcanary.android
6361

64-
implementation "io.reactivex.rxjava2:rxandroid:2.0.2"
65-
implementation 'androidx.annotation:annotation:1.7.0'
66-
implementation ("androidx.lifecycle:lifecycle-extensions:2.2.0@aar") {
62+
implementation libs.rxandroid
63+
implementation libs.androidx.annotation
64+
implementation (libs.androidx.lifecycle.extensions) {
6765
transitive = true
6866
}
69-
implementation 'androidx.browser:browser:1.5.0'
70-
implementation 'androidx.cardview:cardview:1.0.0'
71-
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
72-
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
73-
implementation 'androidx.exifinterface:exifinterface:1.3.6'
74-
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
75-
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
76-
implementation 'androidx.multidex:multidex:2.0.1'
77-
implementation 'androidx.palette:palette-ktx:1.0.0'
78-
implementation 'androidx.percentlayout:percentlayout:1.0.0'
79-
implementation 'androidx.preference:preference-ktx:1.1.1'
80-
implementation 'androidx.recyclerview:recyclerview:1.3.2'
81-
implementation 'com.airbnb.android:lottie:5.2.0'
82-
implementation 'com.daimajia.swipelayout:library:1.2.0'
83-
implementation 'com.github.Dimezis:BlurView:version-2.0.5'
84-
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
85-
implementation 'com.github.ahorn:android-rss:master-SNAPSHOT'
86-
implementation 'com.github.bumptech.glide:glide:4.11.0'
87-
implementation('com.github.meiron03:CustomAlertViewDialogue:a1fc69d54d'){
67+
implementation libs.androidx.browser
68+
implementation libs.androidx.cardview
69+
implementation libs.androidx.constraintlayout
70+
implementation libs.androidx.coordinatorlayout
71+
implementation libs.androidx.exifinterface
72+
implementation libs.androidx.legacy.support.v4
73+
implementation libs.androidx.lifecycle.runtime.ktx
74+
implementation libs.androidx.multidex
75+
implementation libs.androidx.palette.ktx
76+
implementation libs.androidx.percentlayout
77+
implementation libs.androidx.preference.ktx
78+
implementation libs.androidx.recyclerview
79+
implementation libs.lottie
80+
implementation libs.library
81+
implementation libs.blurview
82+
implementation libs.mpandroidchart
83+
implementation libs.android.rss
84+
implementation libs.glide
85+
implementation(libs.customalertviewdialogue){
8886
exclude group: 'com.github.Dimezis.BlurView', module: 'blurview'
8987
}
90-
implementation 'com.google.android.gms:play-services-location:21.0.1'
91-
implementation 'com.google.android.gms:play-services-maps:18.2.0'
92-
implementation 'com.google.android.material:material:1.6.1'
93-
implementation 'com.google.firebase:firebase-analytics'
94-
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.6.0'
95-
implementation 'com.google.maps:google-maps-services:2.2.0'
96-
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.11'
97-
implementation 'com.squareup.okhttp:okhttp:2.7.5'
98-
implementation 'com.squareup.picasso:picasso:2.71828'
99-
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
100-
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
101-
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
102-
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
103-
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
104-
implementation 'com.squareup.retrofit:retrofit:1.9.0'
105-
implementation 'io.reactivex:rxandroid:1.2.1'
106-
implementation 'joda-time:joda-time:2.12.5'
107-
implementation 'org.apache.commons:commons-lang3:3.13.0'
108-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
109-
implementation 'org.jsoup:jsoup:1.16.2'
110-
implementation("com.google.firebase:firebase-crashlytics")
111-
112-
def composeBom = platform("androidx.compose:compose-bom:2024.09.03")
113-
implementation composeBom
114-
testImplementation composeBom
115-
androidTestImplementation composeBom
116-
117-
implementation 'androidx.compose.material3:material3-android'
118-
implementation 'androidx.compose.runtime:runtime'
119-
implementation 'androidx.compose.runtime:runtime-rxjava2'
120-
implementation 'androidx.compose.runtime:runtime-livedata'
121-
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.8.6'
122-
implementation 'androidx.compose.ui:ui-tooling-preview'
123-
debugImplementation 'androidx.compose.ui:ui-tooling'
124-
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
125-
debugImplementation 'androidx.compose.ui:ui-test-manifest'
126-
implementation 'androidx.compose.material:material-icons-core'
127-
implementation 'androidx.compose.material:material-icons-extended'
128-
implementation 'androidx.activity:activity-compose:1.8.0'
129-
130-
implementation "androidx.glance:glance-appwidget:1.1.0"
131-
implementation "androidx.glance:glance-material3:1.1.0"
132-
implementation "androidx.glance:glance-material:1.1.0"
133-
134-
implementation(platform("com.google.firebase:firebase-bom:31.5.0"))
135-
136-
testImplementation 'junit:junit:4.13.2'
88+
implementation libs.logging.interceptor
89+
implementation libs.okhttp
90+
implementation libs.picasso
91+
implementation libs.adapter.rxjava2
92+
implementation libs.squareup.retrofit
93+
implementation libs.reactivex.rxandroid
94+
implementation libs.joda.time
95+
implementation libs.commons.lang3
96+
implementation libs.kotlinx.coroutines.core
97+
implementation libs.jsoup
98+
implementation platform(libs.androidx.compose.bom)
99+
testImplementation platform(libs.androidx.compose.bom)
100+
androidTestImplementation platform(libs.androidx.compose.bom)
101+
implementation platform(libs.firebase.bom)
102+
103+
implementation libs.bundles.compose
104+
implementation libs.bundles.material
105+
implementation libs.bundles.firebase
106+
implementation libs.bundles.runtime
107+
implementation libs.bundles.retrofit2
108+
implementation libs.bundles.ui
109+
implementation libs.bundles.google
110+
111+
testImplementation libs.junit
137112
}
138113

139114
String getPlatformClientID() {
@@ -159,7 +134,7 @@ jacoco {
159134
}
160135

161136
// https://stackoverflow.com/questions/68065743/cannot-run-gradle-test-tasks-because-of-java-lang-noclassdeffounderror-jdk-inte
162-
tasks.withType(Test) {
137+
tasks.withType(Test).configureEach {
163138
jacoco.includeNoLocationClasses = true
164139
jacoco.excludes = ['jdk.internal.*']
165140
}
@@ -169,15 +144,15 @@ def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*',
169144
'**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
170145

171146
// Location of generated output classes
172-
def debugTree = fileTree(dir: "$project.buildDir/tmp/kotlin-classes/debug",
147+
def debugTree = fileTree(dir: "$project.layout.buildDirectory/tmp/kotlin-classes/debug",
173148
excludes: fileFilter)
174149

175150
// Source code directory
176151
def mainSrc = "$project.projectDir/src/main/java"
177152

178153
// Task declaration
179154

180-
task jacocoTestReport(type: JacocoReport) {
155+
tasks.register('jacocoTestReport', JacocoReport) {
181156
// Runs only after the dependencies are executed
182157
dependsOn = ['testDebugUnitTest', 'createDebugCoverageReport']
183158
// Export formats
@@ -190,7 +165,7 @@ task jacocoTestReport(type: JacocoReport) {
190165
classDirectories.setFrom(files([debugTree]))
191166

192167
// Inform Gradle where the files generated by test cases - are located
193-
executionData.from = fileTree(dir: project.buildDir, includes: [
168+
executionData.from = fileTree(dir: project.layout.buildDirectory, includes: [
194169
'jacoco/testDebugUnitTest.exec'
195170
// 'outputs/code_coverage/debugAndroidTest/connected/*.ec'
196171
])

build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
3-
id 'com.android.application' version '8.0.2' apply false
4-
id 'com.android.library' version '8.0.2' apply false
5-
id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
6-
id 'com.google.gms.google-services' version "4.4.0" apply false
7-
id("com.google.firebase.crashlytics") version "2.9.9" apply false
3+
alias(libs.plugins.android.application) apply false
4+
alias(libs.plugins.kotlin.android) apply false
5+
alias(libs.plugins.google.services) apply false
6+
alias(libs.plugins.firebase.crashlytics) apply false
87
}

gradle/libs.versions.toml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
[versions]
2+
activityCompose = "1.8.0"
3+
adapterRxjava2 = "2.4.0"
4+
agp = "8.6.1"
5+
androidRss = "master-SNAPSHOT"
6+
annotation = "1.7.0"
7+
blurview = "version-2.0.5"
8+
browser = "1.5.0"
9+
cardview = "1.0.0"
10+
commonsLang3 = "3.13.0"
11+
compiler = "4.11.0"
12+
composeBom = "2024.10.01"
13+
constraintlayout = "2.1.4"
14+
converterGson = "2.9.0"
15+
converterMoshi = "2.9.0"
16+
converterScalars = "2.9.0"
17+
coordinatorlayout = "1.2.0"
18+
customalertviewdialogue = "a1fc69d54d"
19+
espressoCore = "3.5.0"
20+
exifinterface = "1.3.6"
21+
firebaseBom = "31.5.0"
22+
firebaseCrashlyticsKtx = "18.6.0"
23+
firebaseCrashalytics = "2.9.9"
24+
glanceAppwidget = "1.1.0"
25+
glide = "4.11.0"
26+
googleMapsServices = "2.2.0"
27+
googleServices = "4.4.0"
28+
jodaTime = "2.12.5"
29+
jsoup = "1.16.2"
30+
junit = "1.1.5"
31+
kaspresso = "1.5.3"
32+
kotlin = "1.9.24"
33+
junitVersion = "4.13.2"
34+
kotlinxCoroutinesCore = "1.7.3"
35+
leakcanaryAndroid = "3.0-alpha-1"
36+
legacySupportV4 = "1.0.0"
37+
library = "1.2.0"
38+
lifecycleExtensions = "2.2.0"
39+
lifecycleRuntimeKtx = "2.4.0"
40+
lifecycleViewmodelCompose = "2.8.6"
41+
loggingInterceptor = "5.0.0-alpha.11"
42+
lottie = "5.2.0"
43+
material = "1.6.1"
44+
mpandroidchart = "v3.1.0"
45+
multidex = "2.0.1"
46+
okhttp = "2.7.5"
47+
paletteKtx = "1.0.0"
48+
percentlayout = "1.0.0"
49+
picasso = "2.71828"
50+
playServicesLocation = "21.0.1"
51+
playServicesMaps = "18.2.0"
52+
preferenceKtx = "1.1.1"
53+
recyclerview = "1.3.2"
54+
retrofit = "2.9.0"
55+
retrofitVersion = "1.9.0"
56+
rxandroid = "2.0.2"
57+
rxandroidVersion = "1.2.1"
58+
testng = "7.8.0"
59+
60+
[libraries]
61+
adapter-rxjava2 = { module = "com.squareup.retrofit2:adapter-rxjava2", version.ref = "adapterRxjava2" }
62+
android-rss = { module = "com.github.ahorn:android-rss", version.ref = "androidRss" }
63+
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
64+
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" }
65+
androidx-browser = { module = "androidx.browser:browser", version.ref = "browser" }
66+
androidx-cardview = { module = "androidx.cardview:cardview", version.ref = "cardview" }
67+
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
68+
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
69+
androidx-coordinatorlayout = { module = "androidx.coordinatorlayout:coordinatorlayout", version.ref = "coordinatorlayout" }
70+
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
71+
androidx-exifinterface = { module = "androidx.exifinterface:exifinterface", version.ref = "exifinterface" }
72+
androidx-glance-appwidget = { module = "androidx.glance:glance-appwidget", version.ref = "glanceAppwidget" }
73+
androidx-glance-material = { module = "androidx.glance:glance-material", version.ref = "glanceAppwidget" }
74+
androidx-glance-material3 = { module = "androidx.glance:glance-material3", version.ref = "glanceAppwidget" }
75+
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "junit" }
76+
androidx-legacy-support-v4 = { module = "androidx.legacy:legacy-support-v4", version.ref = "legacySupportV4" }
77+
androidx-lifecycle-extensions = { module = "androidx.lifecycle:lifecycle-extensions", version.ref = "lifecycleExtensions" }
78+
androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
79+
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" }
80+
androidx-material-icons-core = { module = "androidx.compose.material:material-icons-core" }
81+
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
82+
androidx-material3-android = { module = "androidx.compose.material3:material3" }
83+
androidx-multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" }
84+
androidx-palette-ktx = { module = "androidx.palette:palette-ktx", version.ref = "paletteKtx" }
85+
androidx-preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "preferenceKtx" }
86+
androidx-percentlayout = { module = "androidx.percentlayout:percentlayout", version.ref = "percentlayout" }
87+
androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" }
88+
androidx-runtime = { module = "androidx.compose.runtime:runtime" }
89+
androidx-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata" }
90+
androidx-runtime-rxjava2 = { module = "androidx.compose.runtime:runtime-rxjava2" }
91+
androidx-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
92+
androidx-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
93+
androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
94+
androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
95+
blurview = { module = "com.github.Dimezis:BlurView", version.ref = "blurview" }
96+
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commonsLang3" }
97+
compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "compiler" }
98+
converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "converterGson" }
99+
converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "converterMoshi" }
100+
converter-scalars = { module = "com.squareup.retrofit2:converter-scalars", version.ref = "converterScalars" }
101+
customalertviewdialogue = { module = "com.github.meiron03:CustomAlertViewDialogue", version.ref = "customalertviewdialogue" }
102+
firebase-analytics = { module = "com.google.firebase:firebase-analytics" }
103+
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBom" }
104+
firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics" }
105+
firebase-crashlytics-ktx = { module = "com.google.firebase:firebase-crashlytics-ktx", version.ref = "firebaseCrashlyticsKtx" }
106+
glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" }
107+
google-maps-services = { module = "com.google.maps:google-maps-services", version.ref = "googleMapsServices" }
108+
joda-time = { module = "joda-time:joda-time", version.ref = "jodaTime" }
109+
jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
110+
junit = { module = "junit:junit", version.ref = "junitVersion" }
111+
kaspresso = { module = "com.kaspersky.android-components:kaspresso", version.ref = "kaspresso" }
112+
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
113+
leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanaryAndroid" }
114+
library = { module = "com.daimajia.swipelayout:library", version.ref = "library" }
115+
logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptor" }
116+
lottie = { module = "com.airbnb.android:lottie", version.ref = "lottie" }
117+
material = { module = "com.google.android.material:material", version.ref = "material" }
118+
mpandroidchart = { module = "com.github.PhilJay:MPAndroidChart", version.ref = "mpandroidchart" }
119+
okhttp = { module = "com.squareup.okhttp:okhttp", version.ref = "okhttp" }
120+
picasso = { module = "com.squareup.picasso:picasso", version.ref = "picasso" }
121+
play-services-location = { module = "com.google.android.gms:play-services-location", version.ref = "playServicesLocation" }
122+
play-services-maps = { module = "com.google.android.gms:play-services-maps", version.ref = "playServicesMaps" }
123+
reactivex-rxandroid = { module = "io.reactivex:rxandroid", version.ref = "rxandroidVersion" }
124+
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
125+
rxandroid = { module = "io.reactivex.rxjava2:rxandroid", version.ref = "rxandroid" }
126+
squareup-retrofit = { module = "com.squareup.retrofit:retrofit", version.ref = "retrofitVersion" }
127+
testng = { module = "org.testng:testng", version.ref = "testng" }
128+
129+
[plugins]
130+
android-application = { id = "com.android.application", version.ref = "agp" }
131+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
132+
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices"}
133+
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashalytics"}
134+
135+
136+
[bundles]
137+
compose = [
138+
"androidx-activity-compose",
139+
"androidx-glance-appwidget",
140+
"androidx-lifecycle-viewmodel-compose",
141+
]
142+
143+
material = [
144+
"androidx-material3-android",
145+
"androidx-glance-material",
146+
"androidx-glance-material3",
147+
"androidx-material-icons-core",
148+
"androidx-material-icons-extended",
149+
"material"
150+
]
151+
152+
firebase = [
153+
"firebase-crashlytics",
154+
"firebase-analytics",
155+
"firebase-crashlytics-ktx"
156+
]
157+
158+
runtime = [
159+
"androidx-runtime",
160+
"androidx-runtime-livedata",
161+
"androidx-runtime-rxjava2"
162+
]
163+
164+
ui = [
165+
"androidx-ui-test-junit4",
166+
"androidx-ui-test-manifest",
167+
"androidx-ui-tooling",
168+
"androidx-ui-tooling-preview"
169+
]
170+
171+
retrofit2 = [
172+
"retrofit",
173+
"converter-gson",
174+
"converter-moshi",
175+
"converter-scalars"
176+
]
177+
178+
google = [
179+
"google-maps-services",
180+
"play-services-location",
181+
"play-services-maps"
182+
]

0 commit comments

Comments
 (0)