Skip to content

Commit e49156f

Browse files
authored
Merge pull request #11684 from JL0000/version-catalogs
Migrate build to version catalogs
2 parents 9b78e49 + de5d458 commit e49156f

3 files changed

Lines changed: 243 additions & 117 deletions

File tree

app/build.gradle

Lines changed: 88 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import com.android.tools.profgen.ArtProfileSerializer
33
import com.android.tools.profgen.DexFile
44

55
plugins {
6-
id "com.android.application"
7-
id "kotlin-android"
8-
id "kotlin-kapt"
9-
id "kotlin-parcelize"
10-
id "checkstyle"
11-
id "org.sonarqube" version "4.0.0.2929"
12-
id "org.jetbrains.kotlin.plugin.compose" version "${kotlin_version}"
13-
id 'com.google.dagger.hilt.android'
6+
alias libs.plugins.android.application
7+
alias libs.plugins.kotlin.android
8+
alias libs.plugins.kotlin.compose
9+
alias libs.plugins.kotlin.kapt
10+
alias libs.plugins.kotlin.parcelize
11+
alias libs.plugins.checkstyle
12+
alias libs.plugins.sonarqube
13+
alias libs.plugins.hilt
1414
}
1515

1616
android {
@@ -109,25 +109,6 @@ android {
109109
}
110110
}
111111

112-
ext {
113-
checkstyleVersion = '10.12.1'
114-
115-
androidxLifecycleVersion = '2.6.2'
116-
androidxRoomVersion = '2.6.1'
117-
androidxWorkVersion = '2.8.1'
118-
119-
stateSaverVersion = '1.4.1'
120-
exoPlayerVersion = '2.18.7'
121-
googleAutoServiceVersion = '1.1.1'
122-
groupieVersion = '2.10.1'
123-
markwonVersion = '4.6.2'
124-
125-
leakCanaryVersion = '2.12'
126-
stethoVersion = '1.6.0'
127-
128-
coilVersion = '3.0.3'
129-
}
130-
131112
configurations {
132113
checkstyle
133114
ktlint
@@ -137,7 +118,7 @@ checkstyle {
137118
getConfigDirectory().set(rootProject.file("checkstyle"))
138119
ignoreFailures false
139120
showViolations true
140-
toolVersion = checkstyleVersion
121+
toolVersion = libs.versions.checkstyle.get()
141122
}
142123

143124
tasks.register('runCheckstyle', Checkstyle) {
@@ -200,146 +181,140 @@ kapt {
200181

201182
dependencies {
202183
/** Desugaring **/
203-
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.0.4'
184+
coreLibraryDesugaring libs.desugar.jdk.libs.nio
204185

205186
/** NewPipe libraries **/
206-
// You can use a local version by uncommenting a few lines in settings.gradle
207-
// Or you can use a commit you pushed to GitHub by just replacing TeamNewPipe with your GitHub
208-
// name and the commit hash with the commit hash of the (pushed) commit you want to test
209-
// This works thanks to JitPack: https://jitpack.io/
210-
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
211-
// WORKAROUND: v0.24.2 can't be resolved by jitpack -> use git commit hash instead
212-
implementation 'com.github.TeamNewPipe:NewPipeExtractor:d3d5f2b3f03a5f2b479b9f6fdf1c2555cbb9de0e'
213-
implementation 'com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0'
187+
implementation libs.teamnewpipe.nanojson
188+
implementation libs.teamnewpipe.newpipe.extractor
189+
implementation libs.teamnewpipe.nononsense.filepicker
214190

215191
/** Checkstyle **/
216-
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
217-
ktlint 'com.pinterest:ktlint:0.45.2'
192+
checkstyle libs.tools.checkstyle
193+
ktlint libs.tools.ktlint
218194

219195
/** Kotlin **/
220-
implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
196+
implementation libs.kotlin.stdlib
221197

222198
/** AndroidX **/
223-
implementation 'androidx.appcompat:appcompat:1.6.1'
224-
implementation 'androidx.cardview:cardview:1.0.0'
225-
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
226-
implementation 'androidx.core:core-ktx:1.12.0'
227-
implementation 'androidx.documentfile:documentfile:1.0.1'
228-
implementation 'androidx.fragment:fragment-compose:1.8.2'
229-
implementation "androidx.lifecycle:lifecycle-livedata-ktx:${androidxLifecycleVersion}"
230-
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${androidxLifecycleVersion}"
231-
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
232-
implementation 'androidx.media:media:1.7.0'
233-
implementation 'androidx.preference:preference:1.2.1'
234-
implementation 'androidx.recyclerview:recyclerview:1.3.2'
235-
implementation "androidx.room:room-runtime:${androidxRoomVersion}"
236-
implementation "androidx.room:room-rxjava3:${androidxRoomVersion}"
237-
kapt "androidx.room:room-compiler:${androidxRoomVersion}"
238-
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
199+
implementation libs.androidx.appcompat
200+
implementation libs.androidx.cardview
201+
implementation libs.androidx.constraintlayout
202+
implementation libs.androidx.core.ktx
203+
implementation libs.androidx.documentfile
204+
implementation libs.androidx.fragment.compose
205+
implementation libs.androidx.lifecycle.livedata
206+
implementation libs.androidx.lifecycle.viewmodel
207+
implementation libs.androidx.localbroadcastmanager
208+
implementation libs.androidx.media
209+
implementation libs.androidx.preference
210+
implementation libs.androidx.recyclerview
211+
implementation libs.androidx.room.runtime
212+
implementation libs.androidx.room.rxjava3
213+
kapt libs.androidx.room.compiler
214+
implementation libs.androidx.swiperefreshlayout
239215
// Newer version specified to prevent accessibility regressions with RecyclerView, see:
240216
// https://developer.android.com/jetpack/androidx/releases/viewpager2#1.1.0-alpha01
241-
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta02'
242-
implementation "androidx.work:work-runtime-ktx:${androidxWorkVersion}"
243-
implementation "androidx.work:work-rxjava3:${androidxWorkVersion}"
244-
implementation 'com.google.android.material:material:1.11.0'
217+
implementation libs.androidx.viewpager2
218+
implementation libs.androidx.work.runtime
219+
implementation libs.androidx.work.rxjava3
220+
implementation libs.androidx.material
245221

246222
/** Third-party libraries **/
247223
// Instance state boilerplate elimination
248-
implementation 'com.github.livefront:bridge:v2.0.2'
249-
implementation "com.evernote:android-state:$stateSaverVersion"
250-
kapt "com.evernote:android-state-processor:$stateSaverVersion"
224+
implementation libs.livefront.bridge
225+
implementation libs.android.state
226+
kapt libs.android.state.processor
251227

252228
// HTML parser
253-
implementation "org.jsoup:jsoup:1.17.2"
229+
implementation libs.jsoup
254230

255231
// HTTP client
256-
implementation "com.squareup.okhttp3:okhttp:4.12.0"
232+
implementation libs.okhttp
257233

258234
// Media player
259-
implementation "com.google.android.exoplayer:exoplayer-core:${exoPlayerVersion}"
260-
implementation "com.google.android.exoplayer:exoplayer-dash:${exoPlayerVersion}"
261-
implementation "com.google.android.exoplayer:exoplayer-database:${exoPlayerVersion}"
262-
implementation "com.google.android.exoplayer:exoplayer-datasource:${exoPlayerVersion}"
263-
implementation "com.google.android.exoplayer:exoplayer-hls:${exoPlayerVersion}"
264-
implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:${exoPlayerVersion}"
265-
implementation "com.google.android.exoplayer:exoplayer-ui:${exoPlayerVersion}"
266-
implementation "com.google.android.exoplayer:extension-mediasession:${exoPlayerVersion}"
235+
implementation libs.exoplayer.core
236+
implementation libs.exoplayer.dash
237+
implementation libs.exoplayer.database
238+
implementation libs.exoplayer.datasource
239+
implementation libs.exoplayer.hls
240+
implementation libs.exoplayer.smoothstreaming
241+
implementation libs.exoplayer.ui
242+
implementation libs.extension.mediasession
267243

268244
// Metadata generator for service descriptors
269-
compileOnly "com.google.auto.service:auto-service-annotations:${googleAutoServiceVersion}"
270-
kapt "com.google.auto.service:auto-service:${googleAutoServiceVersion}"
245+
compileOnly libs.auto.service
246+
kapt libs.auto.service.kapt
271247

272248
// Manager for complex RecyclerView layouts
273-
implementation "com.github.lisawray.groupie:groupie:${groupieVersion}"
274-
implementation "com.github.lisawray.groupie:groupie-viewbinding:${groupieVersion}"
249+
implementation libs.lisawray.groupie
250+
implementation libs.lisawray.groupie.viewbinding
275251

276252
// Image loading
277-
implementation "io.coil-kt.coil3:coil-compose:${coilVersion}"
278-
implementation "io.coil-kt.coil3:coil-network-okhttp:${coilVersion}"
253+
implementation libs.coil.compose
279254

280255
// Markdown library for Android
281-
implementation "io.noties.markwon:core:${markwonVersion}"
282-
implementation "io.noties.markwon:linkify:${markwonVersion}"
256+
implementation libs.markwon.core
257+
implementation libs.markwon.linkify
283258

284259
// Crash reporting
285-
implementation "ch.acra:acra-core:5.11.3"
260+
implementation libs.acra.core
286261

287262
// Properly restarting
288-
implementation 'com.jakewharton:process-phoenix:2.1.2'
263+
implementation libs.process.phoenix
289264

290265
// Reactive extensions for Java VM
291-
implementation "io.reactivex.rxjava3:rxjava:3.1.8"
292-
implementation "io.reactivex.rxjava3:rxandroid:3.0.2"
266+
implementation libs.rxjava3.rxjava
267+
implementation libs.rxjava3.rxandroid
293268
// RxJava binding APIs for Android UI widgets
294-
implementation "com.jakewharton.rxbinding4:rxbinding:4.0.0"
269+
implementation libs.rxbinding4.rxbinding
295270

296271
// Date and time formatting
297-
implementation "org.ocpsoft.prettytime:prettytime:5.0.8.Final"
272+
implementation libs.prettytime
298273

299274
// Jetpack Compose
300-
implementation(platform('androidx.compose:compose-bom:2024.10.01'))
301-
implementation 'androidx.compose.material3:material3'
302-
implementation 'androidx.compose.material3.adaptive:adaptive'
303-
implementation 'androidx.activity:activity-compose'
304-
implementation 'androidx.compose.ui:ui-tooling-preview'
305-
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose'
306-
implementation 'androidx.compose.ui:ui-text' // Needed for parsing HTML to AnnotatedString
307-
implementation 'androidx.compose.material:material-icons-extended'
275+
implementation(platform(libs.androidx.compose.bom))
276+
implementation libs.androidx.compose.material3
277+
implementation libs.androidx.compose.adaptive
278+
implementation libs.androidx.activity.compose
279+
implementation libs.androidx.compose.ui.tooling.preview
280+
implementation libs.androidx.lifecycle.viewmodel.compose
281+
implementation libs.androidx.compose.ui.text // Needed for parsing HTML to AnnotatedString
282+
implementation libs.androidx.compose.material.icons.extended
308283

309284
// Jetpack Compose related dependencies
310-
implementation 'androidx.paging:paging-compose:3.3.2'
311-
implementation "androidx.navigation:navigation-compose:2.8.3"
285+
implementation libs.androidx.paging.compose
286+
implementation libs.androidx.navigation.compose
312287

313288
// Coroutines interop
314-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-rx3:1.8.1'
289+
implementation libs.kotlinx.coroutines.rx3
315290

316291
// Hilt
317-
implementation("com.google.dagger:hilt-android:2.51.1")
318-
kapt("com.google.dagger:hilt-compiler:2.51.1")
292+
implementation libs.hilt.android
293+
kapt(libs.hilt.compiler)
319294

320295
// Scroll
321-
implementation 'com.github.nanihadesuka:LazyColumnScrollbar:2.2.0'
296+
implementation libs.lazycolumnscrollbar
322297

323298
/** Debugging **/
324299
// Memory leak detection
325-
debugImplementation "com.squareup.leakcanary:leakcanary-object-watcher-android:${leakCanaryVersion}"
326-
debugImplementation "com.squareup.leakcanary:plumber-android:${leakCanaryVersion}"
327-
debugImplementation "com.squareup.leakcanary:leakcanary-android-core:${leakCanaryVersion}"
300+
debugImplementation libs.leakcanary.object.watcher
301+
debugImplementation libs.leakcanary.plumber.android
302+
debugImplementation libs.leakcanary.android.core
328303
// Debug bridge for Android
329-
debugImplementation "com.facebook.stetho:stetho:${stethoVersion}"
330-
debugImplementation "com.facebook.stetho:stetho-okhttp3:${stethoVersion}"
304+
debugImplementation libs.stetho
305+
debugImplementation libs.stetho.okhttp3
331306

332307
// Jetpack Compose
333-
debugImplementation 'androidx.compose.ui:ui-tooling'
308+
debugImplementation libs.androidx.compose.ui.tooling
334309

335310
/** Testing **/
336-
testImplementation 'junit:junit:4.13.2'
337-
testImplementation 'org.mockito:mockito-core:5.6.0'
311+
testImplementation libs.junit
312+
testImplementation libs.mockito.core
338313

339-
androidTestImplementation "androidx.test.ext:junit:1.1.5"
340-
androidTestImplementation "androidx.test:runner:1.5.2"
341-
androidTestImplementation "androidx.room:room-testing:${androidxRoomVersion}"
342-
androidTestImplementation "org.assertj:assertj-core:3.24.2"
314+
androidTestImplementation libs.androidx.junit
315+
androidTestImplementation libs.androidx.runner
316+
androidTestImplementation libs.androidx.room.testing
317+
androidTestImplementation libs.assertj.core
343318
}
344319

345320
static String getGitWorkingBranch() {

build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '2.0.21'
54
repositories {
65
google()
76
mavenCentral()
87
}
98
dependencies {
10-
classpath 'com.android.tools.build:gradle:8.7.1'
11-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12-
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.51.1'
9+
classpath libs.android.tools.build.gradle
10+
classpath libs.kotlin.gradle.plugin
11+
classpath libs.hilt.android.gradle.plugin
1312

1413
// NOTE: Do not place your application dependencies here; they belong
1514
// in the individual module build.gradle files

0 commit comments

Comments
 (0)