Skip to content

Commit

Permalink
migrated to version catalogs
Browse files Browse the repository at this point in the history
  • Loading branch information
JL0000 committed Nov 10, 2024
1 parent 134dc4c commit d60170b
Show file tree
Hide file tree
Showing 2 changed files with 195 additions and 90 deletions.
163 changes: 73 additions & 90 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import com.android.tools.profgen.ArtProfileSerializer
import com.android.tools.profgen.DexFile

plugins {
id "com.android.application"
id "kotlin-android"
id "kotlin-kapt"
id "kotlin-parcelize"
id "checkstyle"
id "org.sonarqube" version "4.0.0.2929"
id "org.jetbrains.kotlin.plugin.compose" version "${kotlin_version}"
id 'com.google.dagger.hilt.android'
alias libs.plugins.android.application
alias libs.plugins.kotlin.android
alias libs.plugins.kotlin.kapt
alias libs.plugins.kotlin.parcelize
alias libs.plugins.checkstyle
alias libs.plugins.sonarqube
}

android {
Expand Down Expand Up @@ -115,23 +113,6 @@ android {
}
}

ext {
checkstyleVersion = '10.12.1'

androidxLifecycleVersion = '2.6.2'
androidxRoomVersion = '2.6.1'
androidxWorkVersion = '2.8.1'

stateSaverVersion = '1.4.1'
exoPlayerVersion = '2.18.7'
googleAutoServiceVersion = '1.1.1'
groupieVersion = '2.10.1'
markwonVersion = '4.6.2'

leakCanaryVersion = '2.12'
stethoVersion = '1.6.0'
}

configurations {
checkstyle
ktlint
Expand All @@ -141,7 +122,7 @@ checkstyle {
getConfigDirectory().set(rootProject.file("checkstyle"))
ignoreFailures false
showViolations true
toolVersion = checkstyleVersion
toolVersion = libs.versions.checkstyle.get()
}

tasks.register('runCheckstyle', Checkstyle) {
Expand Down Expand Up @@ -204,99 +185,101 @@ kapt {

dependencies {
/** Desugaring **/
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.0.4'
coreLibraryDesugaring libs.android.desugarJdkLibsNio

/** NewPipe libraries **/
// You can use a local version by uncommenting a few lines in settings.gradle
// Or you can use a commit you pushed to GitHub by just replacing TeamNewPipe with your GitHub
// name and the commit hash with the commit hash of the (pushed) commit you want to test
// This works thanks to JitPack: https://jitpack.io/
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
implementation 'com.github.teamnewpipe:newpipeextractor:v0.24.2'
implementation 'com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0'
implementation libs.newpipeteam.nanojson
// WORKAROUND: v0.24.2 can't be resolved by jitpack -> use git commit hash instead
implementation libs.newpipeteam.newPipeExtractor
implementation libs.newpipeteam.filePicker

/** Checkstyle **/
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
ktlint 'com.pinterest:ktlint:0.45.2'
checkstyle libs.checkstyle
ktlint libs.ktlint

/** Kotlin **/
implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
implementation libs.kotlin.stdlib

/** AndroidX **/
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'androidx.fragment:fragment-ktx:1.6.2'
implementation "androidx.lifecycle:lifecycle-livedata-ktx:${androidxLifecycleVersion}"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${androidxLifecycleVersion}"
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
implementation 'androidx.media:media:1.7.0'
implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation "androidx.room:room-runtime:${androidxRoomVersion}"
implementation "androidx.room:room-rxjava3:${androidxRoomVersion}"
kapt "androidx.room:room-compiler:${androidxRoomVersion}"
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation libs.androidx.appcompat
implementation libs.androidx.cardview
implementation libs.androidx.constraintlayout
implementation libs.androidx.core.ktx
implementation libs.androidx.documentfile
implementation libs.androidx.fragment.ktx
implementation libs.androidx.lifecycle.livedata.ktx
implementation libs.androidx.lifecycle.viewmodel.ktx
implementation libs.androidx.localbroadcastmanager
implementation libs.androidx.media
implementation libs.androidx.preference
implementation libs.androidx.recyclerview
implementation libs.androidx.room.runtime
implementation libs.androidx.room.rxjava3
kapt libs.androidx.room.compiler
implementation libs.androidx.swiperefreshlayout
// Newer version specified to prevent accessibility regressions with RecyclerView, see:
// https://developer.android.com/jetpack/androidx/releases/viewpager2#1.1.0-alpha01
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta02'
implementation "androidx.work:work-runtime-ktx:${androidxWorkVersion}"
implementation "androidx.work:work-rxjava3:${androidxWorkVersion}"
implementation 'com.google.android.material:material:1.11.0'
implementation libs.androidx.viewpager2
implementation libs.androidx.work.runtime.ktx
implementation libs.androidx.work.rxjava3
implementation libs.android.material

/** Third-party libraries **/
// Instance state boilerplate elimination
implementation 'com.github.livefront:bridge:v2.0.2'
implementation "com.evernote:android-state:$stateSaverVersion"
kapt "com.evernote:android-state-processor:$stateSaverVersion"
implementation libs.livefront.bridge
implementation libs.android.state
kapt libs.android.state.processor

// HTML parser
implementation "org.jsoup:jsoup:1.17.2"
implementation libs.jsoup

// HTTP client
implementation "com.squareup.okhttp3:okhttp:4.12.0"
implementation libs.okhttp

// Media player
implementation "com.google.android.exoplayer:exoplayer-core:${exoPlayerVersion}"
implementation "com.google.android.exoplayer:exoplayer-dash:${exoPlayerVersion}"
implementation "com.google.android.exoplayer:exoplayer-database:${exoPlayerVersion}"
implementation "com.google.android.exoplayer:exoplayer-datasource:${exoPlayerVersion}"
implementation "com.google.android.exoplayer:exoplayer-hls:${exoPlayerVersion}"
implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:${exoPlayerVersion}"
implementation "com.google.android.exoplayer:exoplayer-ui:${exoPlayerVersion}"
implementation "com.google.android.exoplayer:extension-mediasession:${exoPlayerVersion}"
implementation libs.android.exoplayer.core
implementation libs.android.exoplayer.dash
implementation libs.android.exoplayer.database
implementation libs.android.exoplayer.datasource
implementation libs.android.exoplayer.hls
implementation libs.android.exoplayer.smoothstreaming
implementation libs.android.exoplayer.ui
implementation libs.android.exoplayer.extension.mediasession

// Metadata generator for service descriptors
compileOnly "com.google.auto.service:auto-service-annotations:${googleAutoServiceVersion}"
kapt "com.google.auto.service:auto-service:${googleAutoServiceVersion}"
compileOnly libs.google.auto.service.annotations
kapt libs.google.auto.service

// Manager for complex RecyclerView layouts
implementation "com.github.lisawray.groupie:groupie:${groupieVersion}"
implementation "com.github.lisawray.groupie:groupie-viewbinding:${groupieVersion}"
implementation libs.lisawray.groupie
implementation libs.lisawray.groupie.viewbinding

// Image loading
implementation 'io.coil-kt:coil-compose:2.7.0'
//noinspection GradleDependency --> 2.8 is the last version, not 2.71828!
implementation libs.picasso

// Markdown library for Android
implementation "io.noties.markwon:core:${markwonVersion}"
implementation "io.noties.markwon:linkify:${markwonVersion}"
implementation libs.markwon.core
implementation libs.markwon.linkify

// Crash reporting
implementation "ch.acra:acra-core:5.11.3"
implementation libs.acra.core

// Properly restarting
implementation 'com.jakewharton:process-phoenix:2.1.2'
implementation libs.process.phoenix

// Reactive extensions for Java VM
implementation "io.reactivex.rxjava3:rxjava:3.1.8"
implementation "io.reactivex.rxjava3:rxandroid:3.0.2"
implementation libs.rxjava.rxjava
implementation libs.rxjava.rxandroid
// RxJava binding APIs for Android UI widgets
implementation "com.jakewharton.rxbinding4:rxbinding:4.0.0"
implementation libs.rxbinding

// Date and time formatting
implementation "org.ocpsoft.prettytime:prettytime:5.0.8.Final"
implementation libs.prettytime

// Jetpack Compose BOM group
implementation(platform('androidx.compose:compose-bom:2024.09.03'))
Expand All @@ -323,24 +306,24 @@ dependencies {

/** Debugging **/
// Memory leak detection
debugImplementation "com.squareup.leakcanary:leakcanary-object-watcher-android:${leakCanaryVersion}"
debugImplementation "com.squareup.leakcanary:plumber-android:${leakCanaryVersion}"
debugImplementation "com.squareup.leakcanary:leakcanary-android-core:${leakCanaryVersion}"
debugImplementation libs.leakcanary.object.watcher.android
debugImplementation libs.leakcanary.plumber.android
debugImplementation libs.leakcanary.android.core
// Debug bridge for Android
debugImplementation "com.facebook.stetho:stetho:${stethoVersion}"
debugImplementation "com.facebook.stetho:stetho-okhttp3:${stethoVersion}"
debugImplementation libs.stetho
debugImplementation libs.stetho.okhttp

// Jetpack Compose
debugImplementation 'androidx.compose.ui:ui-tooling'

/** Testing **/
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.6.0'
testImplementation libs.junit
testImplementation libs.mockito.core

androidTestImplementation "androidx.test.ext:junit:1.1.5"
androidTestImplementation "androidx.test:runner:1.5.2"
androidTestImplementation "androidx.room:room-testing:${androidxRoomVersion}"
androidTestImplementation "org.assertj:assertj-core:3.24.2"
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.runner
androidTestImplementation libs.androidx.room.testing
androidTestImplementation libs.assertj.core
}

static String getGitWorkingBranch() {
Expand Down
122 changes: 122 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
[versions]
androidMaterial = "1.11.0"
androidxAppcompat = "1.6.1"
androidxCardview = "1.0.0"
androidxConstraintlayout = "2.1.4"
androidxCore = "1.12.0"
androidxDocumentfile = "1.0.1"
androidxFragment = "1.6.2"
androidxLifecycle = "2.6.2"
androidxLocalbroadcastmanager = "1.1.0"
androidxMedia = "1.7.0"
androidxPreference = "1.2.1"
androidxRecyclerview = "1.3.2"
androidxRoom = "2.6.1"
androidxSwiperefreshlayout = "1.1.0"
androidxViewpager2 = "1.1.0-beta02"
androidxWork = "2.8.1"
assertj = "3.24.2"
checkstyle = "10.12.1"
androidDesugarJdkLibsNio = "2.0.4"
exoPlayer = "2.18.7"
googleAutoService = "1.1.1"
groupie = "2.10.1"
jsoup = "1.17.2"
junit = "4.13.2"
kotlin = "1.8.0"
ktlint = "0.45.2"
leakCanary = "2.12"
markwon = "4.6.2"
mockito = "5.6.0"
prettytime = "5.0.8.Final"
rxjavaRxjava = "3.1.8"
rxjavaRxandroid = "3.0.2"
stateSaver = "1.4.1"
stetho = "1.6.0"
sonarqube = "4.0.0.2929"
newpipeteamNanojson = "1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751"
newpipeteamNewpipeExtractor = "176da72cb4c3ec4679211339b0e59f6b01bf2f52"
newpipeteamNoNonsenseFilePicker = "5.0.0"
liveFront = "v2.0.2"
okhttp = "4.12.0"
picasso = "2.8"
acraCore = "5.11.3"
processPhoenix = "2.1.2"
rxbinding = "4.0.0"
androidxTestExt = "1.1.5"
androidxTest = "1.5.2"

[libraries]
android-desugarJdkLibsNio = { group = "com.android.tools", name = "desugar_jdk_libs_nio", version.ref = "androidDesugarJdkLibsNio" }
newpipeteam-nanojson = {group = "com.github.TeamNewPipe", name = "nanojson", version.ref = "newpipeteamNanojson"}
newpipeteam-newPipeExtractor = {group = "com.github.TeamNewPipe", name = "NewPipeExtractor", version.ref = "newpipeteamNewpipeExtractor"}
newpipeteam-filePicker = {group = "com.github.TeamNewPipe", name = "NoNonsense-FilePicker", version.ref = "newpipeteamNoNonsenseFilePicker"}
checkstyle = {group = "com.puppycrawl.tools", name = "checkstyle", version.ref = "checkstyle"}
ktlint = {group = "com.pinterest", name = "ktlink", version.ref = "ktlint"}
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidxAppcompat" }
androidx-cardview = { group = "androidx.cardview", name = "cardview", version.ref = "androidxCardview" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidxConstraintlayout" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" }
androidx-documentfile = { group = "androidx.documentfile", name = "documentfile", version.ref = "androidxDocumentfile" }
androidx-fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "androidxFragment" }
androidx-lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "androidxLifecycle" }
androidx-lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "androidxLifecycle" }
androidx-localbroadcastmanager = { group = "androidx.localbroadcastmanager", name = "localbroadcastmanager", version.ref = "androidxLocalbroadcastmanager" }
androidx-media = { group = "androidx.media", name = "media", version.ref = "androidxMedia" }
androidx-preference = { group = "androidx.preference", name = "preference", version.ref = "androidxPreference" }
androidx-recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "androidxRecyclerview" }
androidx-room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "androidxRoom" }
androidx-room-rxjava3 = { group = "androidx.room", name = "room-rxjava3", version.ref = "androidxRoom" }
androidx-room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "androidxRoom" }
androidx-swiperefreshlayout = { group = "androidx.swiperefreshlayout", name = "swiperefreshlayout", version.ref = "androidxSwiperefreshlayout" }
androidx-viewpager2 = { group = "androidx.viewpager2", name = "viewpager2", version.ref = "androidxViewpager2" }
androidx-work-runtime-ktx = { group = "androidx.work", name = "work-runtime-ktx", version.ref = "androidxWork" }
androidx-work-rxjava3 = { group = "androidx.work", name = "work-rxjava3", version.ref = "androidxWork" }
android-material = { group = "com.google.android.material", name = "material", version.ref = "androidMaterial" }
livefront-bridge = { group = "com.github.livefront", name = "bridge", version.ref = "liveFront" }
android-state = { group = "com.evernote", name = "android-state", version.ref = "stateSaver" }
android-state-processor = { group = "com.evernote", name = "android-state-processor", version.ref = "stateSaver" }
jsoup = { group = "org.jsoup", name = "jsoup", version.ref = "jsoup" }
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
android-exoplayer-core = { group = "com.google.android.exoplayer", name = "exoplayer-core", version.ref = "exoPlayer" }
android-exoplayer-dash = { group = "com.google.android.exoplayer", name = "exoplayer-dash", version.ref = "exoPlayer" }
android-exoplayer-database = { group = "com.google.android.exoplayer", name = "exoplayer-database", version.ref = "exoPlayer" }
android-exoplayer-datasource = { group = "com.google.android.exoplayer", name = "exoplayer-datasource", version.ref = "exoPlayer" }
android-exoplayer-hls = { group = "com.google.android.exoplayer", name = "exoplayer-hls", version.ref = "exoPlayer" }
android-exoplayer-smoothstreaming = { group = "com.google.android.exoplayer", name = "exoplayer-smoothstreaming", version.ref = "exoPlayer" }
android-exoplayer-ui = { group = "com.google.android.exoplayer", name = "exoplayer-ui", version.ref = "exoPlayer" }
android-exoplayer-extension-mediasession = { group = "com.google.android.exoplayer", name = "extension-mediasession", version.ref = "exoPlayer" }
google-auto-service-annotations = { group = "com.google.auto.service", name = "auto-service-annotations", version.ref = "googleAutoService" }
google-auto-service = { group = "com.google.auto.service", name = "auto-service", version.ref = "googleAutoService" }
lisawray-groupie = { group = "com.github.lisawray.groupie", name = "groupie", version.ref = "groupie" }
lisawray-groupie-viewbinding = { group = "com.github.lisawray.groupie", name = "groupie-viewbinding", version.ref = "groupie" }
picasso = { group = "com.squareup.picasso", name = "picasso", version.ref = "picasso" }
markwon-core = { group = "io.noties.markwon", name = "core", version.ref = "markwon" }
markwon-linkify = { group = "io.noties.markwon", name = "linkify", version.ref = "markwon" }
acra-core = { group = "ch.acra", name = "acra-core", version.ref = "acraCore" }
process-phoenix = { group = "com.jakewharton", name = "process-phoenix", version.ref = "processPhoenix" }
rxjava-rxjava = { group = "io.reactivex.rxjava3", name = "rxjava", version.ref = "rxjavaRxjava" }
rxjava-rxandroid = { group = "io.reactivex.rxjava3", name = "rxandroid", version.ref = "rxjavaRxandroid" }
rxbinding = { group = "com.jakewharton.rxbinding4", name = "rxbinding", version.ref = "rxbinding" }
prettytime = { group = "org.ocpsoft.prettytime", name = "prettytime", version.ref = "prettytime" }
leakcanary-object-watcher-android = { group = "com.squareup.leakcanary", name = "leakcanary-object-watcher-android", version.ref = "leakCanary" }
leakcanary-plumber-android = { group = "com.squareup.leakcanary", name = "plumber-android", version.ref = "leakCanary" }
leakcanary-android-core = { group = "com.squareup.leakcanary", name = "leakcanary-android-core", version.ref = "leakCanary" }
stetho = { group = "com.facebook.stetho", name = "stetho", version.ref = "stetho" }
stetho-okhttp = { group = "com.facebook.stetho", name = "stetho-okhttp3", version.ref = "stetho" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidxTestExt" }
androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidxTest" }
androidx-room-testing = { group = "androidx.room", name = "room-testing", version.ref = "androidxRoom" }
assertj-core = { group = "org.assertj", name = "assertj-core", version.ref = "assertj" }

[plugins]
android-application = { id = "com.android.application"}
checkstyle = { id = "checkstyle" }
kotlin-android = { id = "kotlin-android" }
kotlin-kapt = { id = "kotlin-kapt" }
kotlin-parcelize = { id = "kotlin-parcelize" }
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }

0 comments on commit d60170b

Please sign in to comment.