Skip to content

Commit 1508924

Browse files
committed
Migrate to build version catalog
Ref: https://developer.android.com/build/migrate-to-catalogs Signed-off-by: Aayush Gupta <[email protected]>
1 parent d99435c commit 1508924

File tree

3 files changed

+206
-97
lines changed

3 files changed

+206
-97
lines changed

app/build.gradle.kts

Lines changed: 71 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
*/
55

66
plugins {
7-
id("com.android.application")
8-
id("kotlin-android")
9-
id("kotlin-kapt")
10-
id("kotlin-parcelize")
11-
id("org.sonarqube")
7+
alias(libs.plugins.android.application)
8+
alias(libs.plugins.jetbrains.kotlin.android)
9+
alias(libs.plugins.jetbrains.kotlin.kapt)
10+
alias(libs.plugins.jetbrains.kotlin.parcelize)
11+
alias(libs.plugins.sonarqube)
1212
checkstyle
1313
}
1414

@@ -126,28 +126,14 @@ android {
126126
}
127127
}
128128

129-
val checkstyleVersion = "10.12.1"
130-
131-
val androidxLifecycleVersion = "2.6.2"
132-
val androidxRoomVersion = "2.6.1"
133-
val androidxWorkVersion = "2.8.1"
134-
135-
val stateSaverVersion = "1.4.1"
136-
val exoPlayerVersion = "2.18.7"
137-
val googleAutoServiceVersion = "1.1.1"
138-
val groupieVersion = "2.10.1"
139-
val markwonVersion = "4.6.2"
140-
141-
val leakCanaryVersion = "2.12"
142-
val stethoVersion = "1.6.0"
143-
129+
// Custom dependency configuration for ktlint
144130
val ktlint by configurations.creating
145131

146132
checkstyle {
147133
configDirectory = rootProject.file("checkstyle")
148134
isIgnoreFailures = false
149135
isShowViolations = true
150-
toolVersion = checkstyleVersion
136+
toolVersion = libs.versions.checkstyle.get()
151137
}
152138

153139
tasks.register<Checkstyle>("runCheckstyle") {
@@ -208,113 +194,106 @@ sonar {
208194

209195
dependencies {
210196
/** Desugaring **/
211-
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs_nio:2.0.4")
197+
coreLibraryDesugaring(libs.android.desugar)
212198

213199
/** NewPipe libraries **/
214-
implementation("com.github.TeamNewPipe:nanojson:e9d656ddb49a412a5a0a5d5ef20ca7ef09549996")
215-
// WORKAROUND: if you get errors with the NewPipeExtractor dependency, replace `v0.24.3` with
216-
// the corresponding commit hash, since JitPack sometimes deletes artifacts.
217-
// If there’s already a git hash, just add more of it to the end (or remove a letter)
218-
// to cause jitpack to regenerate the artifact.
219-
implementation("com.github.TeamNewPipe:NewPipeExtractor:0023b22095a2d62a60cdfc87f4b5cd85c8b266c3")
220-
implementation("com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0")
200+
implementation(libs.newpipe.nanojson)
201+
implementation(libs.newpipe.extractor)
202+
implementation(libs.newpipe.filepicker)
221203

222204
/** Checkstyle **/
223-
checkstyle("com.puppycrawl.tools:checkstyle:$checkstyleVersion")
224-
ktlint("com.pinterest:ktlint:0.45.2")
205+
checkstyle(libs.puppycrawl.checkstyle)
206+
ktlint(libs.pinterest.ktlint)
225207

226208
/** AndroidX **/
227-
implementation("androidx.appcompat:appcompat:1.7.1")
228-
implementation("androidx.cardview:cardview:1.0.0")
229-
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
230-
implementation("androidx.core:core-ktx:1.12.0")
231-
implementation("androidx.documentfile:documentfile:1.0.1")
232-
implementation("androidx.fragment:fragment-ktx:1.6.2")
233-
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$androidxLifecycleVersion")
234-
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$androidxLifecycleVersion")
235-
implementation("androidx.localbroadcastmanager:localbroadcastmanager:1.1.0")
236-
implementation("androidx.media:media:1.7.0")
237-
implementation("androidx.preference:preference:1.2.1")
238-
implementation("androidx.recyclerview:recyclerview:1.3.2")
239-
implementation("androidx.room:room-runtime:$androidxRoomVersion")
240-
implementation("androidx.room:room-rxjava3:$androidxRoomVersion")
241-
kapt("androidx.room:room-compiler:$androidxRoomVersion")
242-
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
243-
// Newer version specified to prevent accessibility regressions with RecyclerView, see:
244-
// https://developer.android.com/jetpack/androidx/releases/viewpager2#1.1.0-alpha01
245-
implementation("androidx.viewpager2:viewpager2:1.1.0-beta02")
246-
implementation("androidx.work:work-runtime-ktx:$androidxWorkVersion")
247-
implementation("androidx.work:work-rxjava3:$androidxWorkVersion")
248-
implementation("com.google.android.material:material:1.11.0")
249-
implementation("androidx.webkit:webkit:1.9.0")
209+
implementation(libs.androidx.appcompat)
210+
implementation(libs.androidx.cardview)
211+
implementation(libs.androidx.constraintlayout)
212+
implementation(libs.androidx.core)
213+
implementation(libs.androidx.documentfile)
214+
implementation(libs.androidx.fragment)
215+
implementation(libs.androidx.lifecycle.livedata)
216+
implementation(libs.androidx.lifecycle.viewmodel)
217+
implementation(libs.androidx.localbroadcastmanager)
218+
implementation(libs.androidx.media)
219+
implementation(libs.androidx.preference)
220+
implementation(libs.androidx.recyclerview)
221+
implementation(libs.androidx.room.runtime)
222+
implementation(libs.androidx.room.rxjava3)
223+
kapt(libs.androidx.room.compiler)
224+
implementation(libs.androidx.swiperefreshlayout)
225+
implementation(libs.androidx.viewpager2)
226+
implementation(libs.androidx.work.runtime)
227+
implementation(libs.androidx.work.rxjava3)
228+
implementation(libs.google.android.material)
229+
implementation(libs.androidx.webkit)
250230

251231
/** Third-party libraries **/
252-
implementation("com.github.livefront:bridge:v2.0.2")
253-
implementation("com.evernote:android-state:$stateSaverVersion")
254-
kapt("com.evernote:android-state-processor:$stateSaverVersion")
232+
implementation(libs.livefront.bridge)
233+
implementation(libs.evernote.statesaver.core)
234+
kapt(libs.evernote.statesaver.compiler)
255235

256236
// HTML parser
257-
implementation("org.jsoup:jsoup:1.17.2")
237+
implementation(libs.jsoup)
258238

259239
// HTTP client
260-
implementation("com.squareup.okhttp3:okhttp:4.12.0")
240+
implementation(libs.squareup.okhttp)
261241

262242
// Media player
263-
implementation("com.google.android.exoplayer:exoplayer-core:$exoPlayerVersion")
264-
implementation("com.google.android.exoplayer:exoplayer-dash:$exoPlayerVersion")
265-
implementation("com.google.android.exoplayer:exoplayer-database:$exoPlayerVersion")
266-
implementation("com.google.android.exoplayer:exoplayer-datasource:$exoPlayerVersion")
267-
implementation("com.google.android.exoplayer:exoplayer-hls:$exoPlayerVersion")
268-
implementation("com.google.android.exoplayer:exoplayer-smoothstreaming:$exoPlayerVersion")
269-
implementation("com.google.android.exoplayer:exoplayer-ui:$exoPlayerVersion")
270-
implementation("com.google.android.exoplayer:extension-mediasession:$exoPlayerVersion")
243+
implementation(libs.google.exoplayer.core)
244+
implementation(libs.google.exoplayer.dash)
245+
implementation(libs.google.exoplayer.database)
246+
implementation(libs.google.exoplayer.datasource)
247+
implementation(libs.google.exoplayer.hls)
248+
implementation(libs.google.exoplayer.mediasession)
249+
implementation(libs.google.exoplayer.smoothstreaming)
250+
implementation(libs.google.exoplayer.ui)
271251

272252
// Metadata generator for service descriptors
273-
compileOnly("com.google.auto.service:auto-service-annotations:$googleAutoServiceVersion")
274-
kapt("com.google.auto.service:auto-service:$googleAutoServiceVersion")
253+
compileOnly(libs.google.autoservice.annotations)
254+
kapt(libs.google.autoservice.compiler)
275255

276256
// Manager for complex RecyclerView layouts
277-
implementation("com.github.lisawray.groupie:groupie:$groupieVersion")
278-
implementation("com.github.lisawray.groupie:groupie-viewbinding:$groupieVersion")
257+
implementation(libs.lisawray.groupie.core)
258+
implementation(libs.lisawray.groupie.viewbinding)
279259

280260
// Image loading
281-
//noinspection NewerVersionAvailable,GradleDependency --> 2.8 is the last version, not 2.71828!
282-
implementation("com.squareup.picasso:picasso:2.8")
261+
implementation(libs.squareup.picasso)
283262

284263
// Markdown library for Android
285-
implementation("io.noties.markwon:core:$markwonVersion")
286-
implementation("io.noties.markwon:linkify:$markwonVersion")
264+
implementation(libs.noties.markwon.core)
265+
implementation(libs.noties.markwon.linkify)
287266

288267
// Crash reporting
289-
implementation("ch.acra:acra-core:5.11.3")
268+
implementation(libs.acra.core)
290269

291270
// Properly restarting
292-
implementation("com.jakewharton:process-phoenix:2.1.2")
271+
implementation(libs.jakewharton.phoenix)
293272

294273
// Reactive extensions for Java VM
295-
implementation("io.reactivex.rxjava3:rxjava:3.1.8")
296-
implementation("io.reactivex.rxjava3:rxandroid:3.0.2")
274+
implementation(libs.reactivex.rxjava)
275+
implementation(libs.reactivex.rxandroid)
297276
// RxJava binding APIs for Android UI widgets
298-
implementation("com.jakewharton.rxbinding4:rxbinding:4.0.0")
277+
implementation(libs.jakewharton.rxbinding)
299278

300279
// Date and time formatting
301-
implementation("org.ocpsoft.prettytime:prettytime:5.0.8.Final")
280+
implementation(libs.ocpsoft.prettytime)
302281

303282
/** Debugging **/
304283
// Memory leak detection
305-
debugImplementation("com.squareup.leakcanary:leakcanary-object-watcher-android:$leakCanaryVersion")
306-
debugImplementation("com.squareup.leakcanary:plumber-android:$leakCanaryVersion")
307-
debugImplementation("com.squareup.leakcanary:leakcanary-android-core:$leakCanaryVersion")
284+
debugImplementation(libs.squareup.leakcanary.watcher)
285+
debugImplementation(libs.squareup.leakcanary.plumber)
286+
debugImplementation(libs.squareup.leakcanary.core)
308287
// Debug bridge for Android
309-
debugImplementation("com.facebook.stetho:stetho:$stethoVersion")
310-
debugImplementation("com.facebook.stetho:stetho-okhttp3:$stethoVersion")
288+
debugImplementation(libs.facebook.stetho.core)
289+
debugImplementation(libs.facebook.stetho.okhttp3)
311290

312291
/** Testing **/
313-
testImplementation("junit:junit:4.13.2")
314-
testImplementation("org.mockito:mockito-core:5.6.0")
292+
testImplementation(libs.junit)
293+
testImplementation(libs.mockito.core)
315294

316-
androidTestImplementation("androidx.test.ext:junit:1.1.5")
317-
androidTestImplementation("androidx.test:runner:1.5.2")
318-
androidTestImplementation("androidx.room:room-testing:$androidxRoomVersion")
319-
androidTestImplementation("org.assertj:assertj-core:3.24.2")
295+
androidTestImplementation(libs.androidx.junit)
296+
androidTestImplementation(libs.androidx.runner)
297+
androidTestImplementation(libs.androidx.room.testing)
298+
androidTestImplementation(libs.assertj.core)
320299
}

build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*/
55

66
plugins {
7-
id("com.android.application") version "8.13.0" apply false
8-
id("org.jetbrains.kotlin.android") version "1.9.25" apply false
9-
id("org.jetbrains.kotlin.kapt") version "1.9.25" apply false
10-
id("org.jetbrains.kotlin.plugin.parcelize") version "1.9.25" apply false
11-
id("org.sonarqube") version "4.0.0.2929" apply false
7+
alias(libs.plugins.android.application) apply false
8+
alias(libs.plugins.jetbrains.kotlin.android) apply false
9+
alias(libs.plugins.jetbrains.kotlin.kapt) apply false
10+
alias(libs.plugins.jetbrains.kotlin.parcelize) apply false
11+
alias(libs.plugins.sonarqube) apply false
1212
}

gradle/libs.versions.toml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
#
2+
# SPDX-FileCopyrightText: 2025 NewPipe e.V. <https://newpipe-ev.de>
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
#
5+
6+
[versions]
7+
acra = "5.11.3"
8+
agp = "8.13.0"
9+
appcompat = "1.7.1"
10+
assertj = "3.24.2"
11+
autoservice = "1.1.1"
12+
bridge = "v2.0.2"
13+
cardview = "1.0.0"
14+
checkstyle = "10.12.1"
15+
constraintlayout = "2.1.4"
16+
core = "1.12.0"
17+
desugar = "2.0.4"
18+
documentfile = "1.0.1"
19+
exoplayer = "2.18.7"
20+
extractor = "0023b22095a2d62a60cdfc87f4b5cd85c8b266c3"
21+
filepicker = "5.0.0"
22+
fragment = "1.6.2"
23+
groupie = "2.10.1"
24+
jsoup = "1.17.2"
25+
junit = "4.13.2"
26+
junit-ext = "1.1.5"
27+
kotlin = "1.9.25"
28+
ktlint = "0.45.2"
29+
leakcanary = "2.12"
30+
lifecycle = "2.6.2"
31+
localbroadcastmanager = "1.1.0"
32+
markwon = "4.6.2"
33+
material = "1.11.0"
34+
media = "1.7.0"
35+
mockitoCore = "5.6.0"
36+
nanojson = "e9d656ddb49a412a5a0a5d5ef20ca7ef09549996"
37+
okhttp = "4.12.0"
38+
phoenix = "2.1.2"
39+
#noinspection NewerVersionAvailable,GradleDependency --> 2.8 is the last version, not 2.71828!
40+
picasso = "2.8"
41+
preference = "1.2.1"
42+
prettytime = "5.0.8.Final"
43+
recyclerview = "1.3.2"
44+
room = "2.6.1"
45+
runner = "1.5.2"
46+
rxandroid = "3.0.2"
47+
rxbinding = "4.0.0"
48+
rxjava = "3.1.8"
49+
sonarqube = "4.0.0.2929"
50+
statesaver = "1.4.1"
51+
stetho = "1.6.0"
52+
swiperefreshlayout = "1.1.0"
53+
# Newer version specified to prevent accessibility regressions with RecyclerView
54+
# see: https://developer.android.com/jetpack/androidx/releases/viewpager2#1.1.0-alpha01
55+
viewpager2 = "1.1.0-beta02"
56+
webkit = "1.9.0"
57+
work = "2.8.1"
58+
59+
[libraries]
60+
acra-core = { module = "ch.acra:acra-core", version.ref = "acra" }
61+
android-desugar = { module = "com.android.tools:desugar_jdk_libs_nio", version.ref = "desugar" }
62+
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
63+
androidx-cardview = { module = "androidx.cardview:cardview", version.ref = "cardview" }
64+
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
65+
androidx-core = { module = "androidx.core:core-ktx", version.ref = "core" }
66+
androidx-documentfile = { module = "androidx.documentfile:documentfile", version.ref = "documentfile" }
67+
androidx-fragment = { module = "androidx.fragment:fragment-ktx", version.ref = "fragment" }
68+
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "junit-ext" }
69+
androidx-lifecycle-livedata = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycle" }
70+
androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle" }
71+
androidx-localbroadcastmanager = { module = "androidx.localbroadcastmanager:localbroadcastmanager", version.ref = "localbroadcastmanager" }
72+
androidx-media = { module = "androidx.media:media", version.ref = "media" }
73+
androidx-preference = { module = "androidx.preference:preference", version.ref = "preference" }
74+
androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" }
75+
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
76+
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
77+
androidx-room-rxjava3 = { module = "androidx.room:room-rxjava3", version.ref = "room" }
78+
androidx-room-testing = { module = "androidx.room:room-testing", version.ref = "room" }
79+
androidx-runner = { module = "androidx.test:runner", version.ref = "runner" }
80+
androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "swiperefreshlayout" }
81+
androidx-viewpager2 = { module = "androidx.viewpager2:viewpager2", version.ref = "viewpager2" }
82+
androidx-webkit = { module = "androidx.webkit:webkit", version.ref = "webkit" }
83+
androidx-work-runtime = { module = "androidx.work:work-runtime-ktx", version.ref = "work" }
84+
androidx-work-rxjava3 = { module = "androidx.work:work-rxjava3", version.ref = "work" }
85+
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" }
86+
evernote-statesaver-compiler = { module = "com.evernote:android-state-processor", version.ref = "statesaver" }
87+
evernote-statesaver-core = { module = "com.evernote:android-state", version.ref = "statesaver" }
88+
facebook-stetho-core = { module = "com.facebook.stetho:stetho", version.ref = "stetho" }
89+
facebook-stetho-okhttp3 = { module = "com.facebook.stetho:stetho-okhttp3", version.ref = "stetho" }
90+
google-android-material = { module = "com.google.android.material:material", version.ref = "material" }
91+
google-autoservice-annotations = { module = "com.google.auto.service:auto-service-annotations", version.ref = "autoservice" }
92+
google-autoservice-compiler = { module = "com.google.auto.service:auto-service", version.ref = "autoservice" }
93+
google-exoplayer-core = { module = "com.google.android.exoplayer:exoplayer-core", version.ref = "exoplayer" }
94+
google-exoplayer-dash = { module = "com.google.android.exoplayer:exoplayer-dash", version.ref = "exoplayer" }
95+
google-exoplayer-database = { module = "com.google.android.exoplayer:exoplayer-database", version.ref = "exoplayer" }
96+
google-exoplayer-datasource = { module = "com.google.android.exoplayer:exoplayer-datasource", version.ref = "exoplayer" }
97+
google-exoplayer-hls = { module = "com.google.android.exoplayer:exoplayer-hls", version.ref = "exoplayer" }
98+
google-exoplayer-mediasession = { module = "com.google.android.exoplayer:extension-mediasession", version.ref = "exoplayer" }
99+
google-exoplayer-smoothstreaming = { module = "com.google.android.exoplayer:exoplayer-smoothstreaming", version.ref = "exoplayer" }
100+
google-exoplayer-ui = { module = "com.google.android.exoplayer:exoplayer-ui", version.ref = "exoplayer" }
101+
jakewharton-phoenix = { module = "com.jakewharton:process-phoenix", version.ref = "phoenix" }
102+
jakewharton-rxbinding = { module = "com.jakewharton.rxbinding4:rxbinding", version.ref = "rxbinding" }
103+
jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
104+
junit = { module = "junit:junit", version.ref = "junit" }
105+
lisawray-groupie-core = { module = "com.github.lisawray.groupie:groupie", version.ref = "groupie" }
106+
lisawray-groupie-viewbinding = { module = "com.github.lisawray.groupie:groupie-viewbinding", version.ref = "groupie" }
107+
livefront-bridge = { module = "com.github.livefront:bridge", version.ref = "bridge" }
108+
mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockitoCore" }
109+
newpipe-extractor = { module = "com.github.TeamNewPipe:NewPipeExtractor", version.ref = "extractor" }
110+
newpipe-filepicker = { module = "com.github.TeamNewPipe:NoNonsense-FilePicker", version.ref = "filepicker" }
111+
newpipe-nanojson = { module = "com.github.TeamNewPipe:nanojson", version.ref = "nanojson" }
112+
noties-markwon-core = { module = "io.noties.markwon:core", version.ref = "markwon" }
113+
noties-markwon-linkify = { module = "io.noties.markwon:linkify", version.ref = "markwon" }
114+
ocpsoft-prettytime = { module = "org.ocpsoft.prettytime:prettytime", version.ref = "prettytime" }
115+
pinterest-ktlint = { module = "com.pinterest:ktlint", version.ref = "ktlint" }
116+
puppycrawl-checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" }
117+
reactivex-rxandroid = { module = "io.reactivex.rxjava3:rxandroid", version.ref = "rxandroid" }
118+
reactivex-rxjava = { module = "io.reactivex.rxjava3:rxjava", version.ref = "rxjava" }
119+
squareup-leakcanary-core = { module = "com.squareup.leakcanary:leakcanary-android-core", version.ref = "leakcanary" }
120+
squareup-leakcanary-plumber = { module = "com.squareup.leakcanary:plumber-android", version.ref = "leakcanary" }
121+
squareup-leakcanary-watcher = { module = "com.squareup.leakcanary:leakcanary-object-watcher-android", version.ref = "leakcanary" }
122+
squareup-okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
123+
squareup-picasso = { module = "com.squareup.picasso:picasso", version.ref = "picasso" }
124+
125+
[plugins]
126+
android-application = { id = "com.android.application", version.ref = "agp" }
127+
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
128+
jetbrains-kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
129+
jetbrains-kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
130+
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }

0 commit comments

Comments
 (0)