Skip to content

Commit

Permalink
Merge pull request #635 from pennlabs/kotlin-migration
Browse files Browse the repository at this point in the history
Introducing Gradle Version Catalog
  • Loading branch information
baronhsieh2005 authored Nov 11, 2024
2 parents 0732e18 + 81b2052 commit bfa19f6
Show file tree
Hide file tree
Showing 3 changed files with 246 additions and 90 deletions.
145 changes: 60 additions & 85 deletions PennMobile/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
id("com.google.firebase.crashlytics")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.google.services)
alias(libs.plugins.firebase.crashlytics)
id 'jacoco'
id 'kotlin-parcelize'
}

apply plugin: "kotlin-android"

android {
namespace 'com.pennapps.labs.pennmobile'
buildFeatures {
Expand Down Expand Up @@ -52,88 +50,65 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'com.kaspersky.android-components:kaspresso:1.5.3'
androidTestImplementation 'org.testng:testng:7.8.0'
androidTestImplementation libs.androidx.espresso.core
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.kaspresso
androidTestImplementation libs.testng

annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
annotationProcessor libs.compiler

debugImplementation 'com.squareup.leakcanary:leakcanary-android:3.0-alpha-1'
debugImplementation libs.leakcanary.android

implementation "io.reactivex.rxjava2:rxandroid:2.0.2"
implementation 'androidx.annotation:annotation:1.7.0'
implementation ("androidx.lifecycle:lifecycle-extensions:2.2.0@aar") {
implementation libs.rxandroid
implementation libs.androidx.annotation
implementation (libs.androidx.lifecycle.extensions) {
transitive = true
}
implementation 'androidx.browser:browser:1.5.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
implementation 'androidx.exifinterface:exifinterface:1.3.6'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'com.airbnb.android:lottie:5.2.0'
implementation 'com.daimajia.swipelayout:library:1.2.0'
implementation 'com.github.Dimezis:BlurView:version-2.0.5'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.github.ahorn:android-rss:master-SNAPSHOT'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation('com.github.meiron03:CustomAlertViewDialogue:a1fc69d54d'){
implementation libs.androidx.browser
implementation libs.androidx.cardview
implementation libs.androidx.constraintlayout
implementation libs.androidx.coordinatorlayout
implementation libs.androidx.exifinterface
implementation libs.androidx.legacy.support.v4
implementation libs.androidx.lifecycle.runtime.ktx
implementation libs.androidx.multidex
implementation libs.androidx.palette.ktx
implementation libs.androidx.percentlayout
implementation libs.androidx.preference.ktx
implementation libs.androidx.recyclerview
implementation libs.lottie
implementation libs.library
implementation libs.blurview
implementation libs.mpandroidchart
implementation libs.android.rss
implementation libs.glide
implementation(libs.customalertviewdialogue){
exclude group: 'com.github.Dimezis.BlurView', module: 'blurview'
}
implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation 'com.google.android.gms:play-services-maps:18.2.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.6.0'
implementation 'com.google.maps:google-maps-services:2.2.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.11'
implementation 'com.squareup.okhttp:okhttp:2.7.5'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'joda-time:joda-time:2.12.5'
implementation 'org.apache.commons:commons-lang3:3.13.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
implementation 'org.jsoup:jsoup:1.16.2'
implementation("com.google.firebase:firebase-crashlytics")

def composeBom = platform("androidx.compose:compose-bom:2024.09.03")
implementation composeBom
testImplementation composeBom
androidTestImplementation composeBom

implementation 'androidx.compose.material3:material3-android'
implementation 'androidx.compose.runtime:runtime'
implementation 'androidx.compose.runtime:runtime-rxjava2'
implementation 'androidx.compose.runtime:runtime-livedata'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.8.6'
implementation 'androidx.compose.ui:ui-tooling-preview'
debugImplementation 'androidx.compose.ui:ui-tooling'
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
implementation 'androidx.compose.material:material-icons-core'
implementation 'androidx.compose.material:material-icons-extended'
implementation 'androidx.activity:activity-compose:1.8.0'

implementation "androidx.glance:glance-appwidget:1.1.0"
implementation "androidx.glance:glance-material3:1.1.0"
implementation "androidx.glance:glance-material:1.1.0"

implementation(platform("com.google.firebase:firebase-bom:31.5.0"))

testImplementation 'junit:junit:4.13.2'
implementation libs.logging.interceptor
implementation libs.okhttp
implementation libs.picasso
implementation libs.adapter.rxjava2
implementation libs.squareup.retrofit
implementation libs.reactivex.rxandroid
implementation libs.joda.time
implementation libs.commons.lang3
implementation libs.kotlinx.coroutines.core
implementation libs.jsoup
implementation platform(libs.androidx.compose.bom)
testImplementation platform(libs.androidx.compose.bom)
androidTestImplementation platform(libs.androidx.compose.bom)
implementation platform(libs.firebase.bom)

implementation libs.bundles.compose
implementation libs.bundles.material
implementation libs.bundles.firebase
implementation libs.bundles.runtime
implementation libs.bundles.retrofit2
implementation libs.bundles.ui
implementation libs.bundles.google

testImplementation libs.junit
}

String getPlatformClientID() {
Expand All @@ -159,7 +134,7 @@ jacoco {
}

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

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

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

// Task declaration

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

// Inform Gradle where the files generated by test cases - are located
executionData.from = fileTree(dir: project.buildDir, includes: [
executionData.from = fileTree(dir: project.layout.buildDirectory, includes: [
'jacoco/testDebugUnitTest.exec'
// 'outputs/code_coverage/debugAndroidTest/connected/*.ec'
])
Expand Down
9 changes: 4 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
id 'com.google.gms.google-services' version "4.4.0" apply false
id("com.google.firebase.crashlytics") version "2.9.9" apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.google.services) apply false
alias(libs.plugins.firebase.crashlytics) apply false
}
182 changes: 182 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
[versions]
activityCompose = "1.8.0"
adapterRxjava2 = "2.4.0"
agp = "8.6.1"
androidRss = "master-SNAPSHOT"
annotation = "1.7.0"
blurview = "version-2.0.5"
browser = "1.5.0"
cardview = "1.0.0"
commonsLang3 = "3.13.0"
compiler = "4.11.0"
composeBom = "2024.10.01"
constraintlayout = "2.1.4"
converterGson = "2.9.0"
converterMoshi = "2.9.0"
converterScalars = "2.9.0"
coordinatorlayout = "1.2.0"
customalertviewdialogue = "a1fc69d54d"
espressoCore = "3.5.0"
exifinterface = "1.3.6"
firebaseBom = "31.5.0"
firebaseCrashlyticsKtx = "18.6.0"
firebaseCrashalytics = "2.9.9"
glanceAppwidget = "1.1.0"
glide = "4.11.0"
googleMapsServices = "2.2.0"
googleServices = "4.4.0"
jodaTime = "2.12.5"
jsoup = "1.16.2"
junit = "1.1.5"
kaspresso = "1.5.3"
kotlin = "1.9.24"
junitVersion = "4.13.2"
kotlinxCoroutinesCore = "1.7.3"
leakcanaryAndroid = "3.0-alpha-1"
legacySupportV4 = "1.0.0"
library = "1.2.0"
lifecycleExtensions = "2.2.0"
lifecycleRuntimeKtx = "2.4.0"
lifecycleViewmodelCompose = "2.8.6"
loggingInterceptor = "5.0.0-alpha.11"
lottie = "5.2.0"
material = "1.6.1"
mpandroidchart = "v3.1.0"
multidex = "2.0.1"
okhttp = "2.7.5"
paletteKtx = "1.0.0"
percentlayout = "1.0.0"
picasso = "2.71828"
playServicesLocation = "21.0.1"
playServicesMaps = "18.2.0"
preferenceKtx = "1.1.1"
recyclerview = "1.3.2"
retrofit = "2.9.0"
retrofitVersion = "1.9.0"
rxandroid = "2.0.2"
rxandroidVersion = "1.2.1"
testng = "7.8.0"

[libraries]
adapter-rxjava2 = { module = "com.squareup.retrofit2:adapter-rxjava2", version.ref = "adapterRxjava2" }
android-rss = { module = "com.github.ahorn:android-rss", version.ref = "androidRss" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" }
androidx-browser = { module = "androidx.browser:browser", version.ref = "browser" }
androidx-cardview = { module = "androidx.cardview:cardview", version.ref = "cardview" }
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
androidx-coordinatorlayout = { module = "androidx.coordinatorlayout:coordinatorlayout", version.ref = "coordinatorlayout" }
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
androidx-exifinterface = { module = "androidx.exifinterface:exifinterface", version.ref = "exifinterface" }
androidx-glance-appwidget = { module = "androidx.glance:glance-appwidget", version.ref = "glanceAppwidget" }
androidx-glance-material = { module = "androidx.glance:glance-material", version.ref = "glanceAppwidget" }
androidx-glance-material3 = { module = "androidx.glance:glance-material3", version.ref = "glanceAppwidget" }
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "junit" }
androidx-legacy-support-v4 = { module = "androidx.legacy:legacy-support-v4", version.ref = "legacySupportV4" }
androidx-lifecycle-extensions = { module = "androidx.lifecycle:lifecycle-extensions", version.ref = "lifecycleExtensions" }
androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" }
androidx-material-icons-core = { module = "androidx.compose.material:material-icons-core" }
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
androidx-material3-android = { module = "androidx.compose.material3:material3" }
androidx-multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" }
androidx-palette-ktx = { module = "androidx.palette:palette-ktx", version.ref = "paletteKtx" }
androidx-preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "preferenceKtx" }
androidx-percentlayout = { module = "androidx.percentlayout:percentlayout", version.ref = "percentlayout" }
androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" }
androidx-runtime = { module = "androidx.compose.runtime:runtime" }
androidx-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata" }
androidx-runtime-rxjava2 = { module = "androidx.compose.runtime:runtime-rxjava2" }
androidx-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
androidx-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
blurview = { module = "com.github.Dimezis:BlurView", version.ref = "blurview" }
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commonsLang3" }
compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "compiler" }
converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "converterGson" }
converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "converterMoshi" }
converter-scalars = { module = "com.squareup.retrofit2:converter-scalars", version.ref = "converterScalars" }
customalertviewdialogue = { module = "com.github.meiron03:CustomAlertViewDialogue", version.ref = "customalertviewdialogue" }
firebase-analytics = { module = "com.google.firebase:firebase-analytics" }
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBom" }
firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics" }
firebase-crashlytics-ktx = { module = "com.google.firebase:firebase-crashlytics-ktx", version.ref = "firebaseCrashlyticsKtx" }
glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" }
google-maps-services = { module = "com.google.maps:google-maps-services", version.ref = "googleMapsServices" }
joda-time = { module = "joda-time:joda-time", version.ref = "jodaTime" }
jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
junit = { module = "junit:junit", version.ref = "junitVersion" }
kaspresso = { module = "com.kaspersky.android-components:kaspresso", version.ref = "kaspresso" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanaryAndroid" }
library = { module = "com.daimajia.swipelayout:library", version.ref = "library" }
logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptor" }
lottie = { module = "com.airbnb.android:lottie", version.ref = "lottie" }
material = { module = "com.google.android.material:material", version.ref = "material" }
mpandroidchart = { module = "com.github.PhilJay:MPAndroidChart", version.ref = "mpandroidchart" }
okhttp = { module = "com.squareup.okhttp:okhttp", version.ref = "okhttp" }
picasso = { module = "com.squareup.picasso:picasso", version.ref = "picasso" }
play-services-location = { module = "com.google.android.gms:play-services-location", version.ref = "playServicesLocation" }
play-services-maps = { module = "com.google.android.gms:play-services-maps", version.ref = "playServicesMaps" }
reactivex-rxandroid = { module = "io.reactivex:rxandroid", version.ref = "rxandroidVersion" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
rxandroid = { module = "io.reactivex.rxjava2:rxandroid", version.ref = "rxandroid" }
squareup-retrofit = { module = "com.squareup.retrofit:retrofit", version.ref = "retrofitVersion" }
testng = { module = "org.testng:testng", version.ref = "testng" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices"}
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashalytics"}


[bundles]
compose = [
"androidx-activity-compose",
"androidx-glance-appwidget",
"androidx-lifecycle-viewmodel-compose",
]

material = [
"androidx-material3-android",
"androidx-glance-material",
"androidx-glance-material3",
"androidx-material-icons-core",
"androidx-material-icons-extended",
"material"
]

firebase = [
"firebase-crashlytics",
"firebase-analytics",
"firebase-crashlytics-ktx"
]

runtime = [
"androidx-runtime",
"androidx-runtime-livedata",
"androidx-runtime-rxjava2"
]

ui = [
"androidx-ui-test-junit4",
"androidx-ui-test-manifest",
"androidx-ui-tooling",
"androidx-ui-tooling-preview"
]

retrofit2 = [
"retrofit",
"converter-gson",
"converter-moshi",
"converter-scalars"
]

google = [
"google-maps-services",
"play-services-location",
"play-services-maps"
]

0 comments on commit bfa19f6

Please sign in to comment.