11import com.android.tools.profgen.ArtProfileKt
22import com.android.tools.profgen.ArtProfileSerializer
33import com.android.tools.profgen.DexFile
4+ import com.mikepenz.aboutlibraries.plugin.DuplicateMode
45
56plugins {
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'
7+ alias libs. plugins. android. application
8+ alias libs. plugins. kotlin. android
9+ alias libs. plugins. kotlin. compose
10+ alias libs. plugins. kotlin. kapt
11+ alias libs. plugins. kotlin. parcelize
12+ alias libs. plugins. checkstyle
13+ alias libs. plugins. sonarqube
14+ alias libs. plugins. hilt
15+ alias libs. plugins. aboutlibraries
1416}
1517
1618android {
@@ -109,25 +111,6 @@ android {
109111 }
110112}
111113
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-
131114configurations {
132115 checkstyle
133116 ktlint
@@ -137,7 +120,7 @@ checkstyle {
137120 getConfigDirectory(). set(rootProject. file(" checkstyle" ))
138121 ignoreFailures false
139122 showViolations true
140- toolVersion = checkstyleVersion
123+ toolVersion = libs . versions . checkstyle . get()
141124}
142125
143126tasks. register(' runCheckstyle' , Checkstyle ) {
@@ -179,11 +162,13 @@ tasks.register('formatKtlint', JavaExec) {
179162 jvmArgs(" --add-opens" , " java.base/java.lang=ALL-UNNAMED" )
180163}
181164
165+ apply from : ' check-dependencies.gradle'
166+
182167afterEvaluate {
183168 if (! System . properties. containsKey(' skipFormatKtlint' )) {
184169 preDebugBuild. dependsOn formatKtlint
185170 }
186- preDebugBuild. dependsOn runCheckstyle, runKtlint
171+ preDebugBuild. dependsOn runCheckstyle, runKtlint, checkDependenciesOrder
187172}
188173
189174sonar {
@@ -198,148 +183,153 @@ kapt {
198183 correctErrorTypes true
199184}
200185
186+ aboutLibraries {
187+ // note: offline mode prevents the plugin from fetching licenses at build time, which would be
188+ // harmful for reproducible builds
189+ offlineMode = true
190+ duplicationMode = DuplicateMode . MERGE
191+ }
192+
201193dependencies {
202194/* * Desugaring **/
203- coreLibraryDesugaring ' com.android.tools:desugar_jdk_libs_nio:2.0.4 '
195+ coreLibraryDesugaring libs . desugar . jdk . libs . nio
204196
205197/* * 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'
198+ implementation libs. teamnewpipe. nanojson
199+ implementation libs. teamnewpipe. newpipe. extractor
200+ implementation libs. teamnewpipe. nononsense. filepicker
214201
215202/* * Checkstyle **/
216- checkstyle " com.puppycrawl. tools: checkstyle: ${ checkstyleVersion } "
217- ktlint ' com.pinterest:ktlint:0.45.2 '
203+ checkstyle libs . tools. checkstyle
204+ ktlint libs . tools . ktlint
218205
219206/* * Kotlin **/
220- implementation " org.jetbrains. kotlin:kotlin- stdlib: ${ kotlin_version } "
207+ implementation libs . kotlin. stdlib
221208
222209/* * 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 '
210+ implementation libs . androidx. appcompat
211+ implementation libs . androidx. cardview
212+ implementation libs . androidx. constraintlayout
213+ implementation libs . androidx. core. ktx
214+ implementation libs . androidx. documentfile
215+ implementation libs . androidx. fragment. compose
216+ implementation libs . androidx. lifecycle. livedata
217+ implementation libs . androidx. lifecycle. viewmodel
218+ implementation libs . androidx. localbroadcastmanager
219+ implementation libs . androidx. media
220+ implementation libs . androidx. preference
221+ implementation libs . androidx. recyclerview
222+ implementation libs . androidx. room. runtime
223+ implementation libs . androidx. room. rxjava3
224+ kapt libs . androidx. room. compiler
225+ implementation libs . androidx. swiperefreshlayout
239226 // Newer version specified to prevent accessibility regressions with RecyclerView, see:
240227 // 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 '
228+ implementation libs . androidx. viewpager2
229+ implementation libs . androidx. work. runtime
230+ implementation libs . androidx. work. rxjava3
231+ implementation libs . androidx . material
245232
246233/* * Third-party libraries **/
247234 // Instance state boilerplate elimination
248- implementation ' com.github. livefront:bridge:v2.0.2 '
249- implementation " com.evernote: android- state: $s tateSaverVersion "
250- kapt " com.evernote: android- state- processor: $s tateSaverVersion "
235+ implementation libs . livefront. bridge
236+ implementation libs . android. state
237+ kapt libs . android. state. processor
251238
252239 // HTML parser
253- implementation " org .jsoup:jsoup:1.17.2 "
240+ implementation libs . jsoup
254241
255242 // HTTP client
256- implementation " com.squareup.okhttp3: okhttp:4.12.0 "
243+ implementation libs . okhttp
257244
258245 // 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 } "
246+ implementation libs . exoplayer. core
247+ implementation libs . exoplayer. dash
248+ implementation libs . exoplayer. database
249+ implementation libs . exoplayer. datasource
250+ implementation libs . exoplayer. hls
251+ implementation libs . exoplayer. smoothstreaming
252+ implementation libs . exoplayer. ui
253+ implementation libs . extension. mediasession
267254
268255 // Metadata generator for service descriptors
269- compileOnly " com.google. auto.service:auto-service-annotations: ${ googleAutoServiceVersion } "
270- kapt " com.google. auto.service:auto-service: ${ googleAutoServiceVersion } "
256+ compileOnly libs . auto. service
257+ kapt libs . auto. service. kapt
271258
272259 // Manager for complex RecyclerView layouts
273- implementation " com.github. lisawray.groupie:groupie: ${ groupieVersion } "
274- implementation " com.github. lisawray.groupie:groupie- viewbinding: ${ groupieVersion } "
260+ implementation libs . lisawray. groupie
261+ implementation libs . lisawray. groupie. viewbinding
275262
276263 // Image loading
277- implementation " io .coil-kt.coil3:coil- compose: ${ coilVersion } "
278- implementation " io .coil-kt.coil3:coil- network- okhttp: ${ coilVersion } "
264+ implementation libs . coil. compose
265+ implementation libs . coil. network. okhttp
279266
280267 // Markdown library for Android
281- implementation " io.noties. markwon: core: ${ markwonVersion } "
282- implementation " io.noties. markwon: linkify: ${ markwonVersion } "
268+ implementation libs . markwon. core
269+ implementation libs . markwon. linkify
283270
284271 // Crash reporting
285- implementation " ch .acra:acra-core:5.11.3 "
272+ implementation libs . acra. core
286273
287274 // Properly restarting
288- implementation ' com.jakewharton: process-phoenix:2.1.2 '
275+ implementation libs . process. phoenix
289276
290277 // Reactive extensions for Java VM
291- implementation " io.reactivex. rxjava3:rxjava:3.1.8 "
292- implementation " io.reactivex. rxjava3:rxandroid:3.0.2 "
278+ implementation libs . rxjava3. rxjava
279+ implementation libs . rxjava3. rxandroid
293280 // RxJava binding APIs for Android UI widgets
294- implementation " com.jakewharton. rxbinding4:rxbinding:4.0.0 "
281+ implementation libs . rxbinding4. rxbinding
295282
296283 // Date and time formatting
297- implementation " org.ocpsoft. prettytime:prettytime:5.0.8.Final "
284+ implementation libs . prettytime
298285
299286 // 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'
287+ implementation(platform(libs . androidx. compose. bom ))
288+ implementation libs . androidx. compose. material3
289+ implementation libs . androidx. compose. adaptive
290+ implementation libs . androidx. activity. compose
291+ implementation libs . androidx. compose. ui. tooling. preview
292+ implementation libs . androidx. lifecycle. viewmodel. compose
293+ implementation libs . androidx. compose. ui. text // Needed for parsing HTML to AnnotatedString
294+ implementation libs . androidx. compose. material. icons. extended
308295
309296 // Jetpack Compose related dependencies
310- implementation ' androidx.paging:paging-compose:3.3.2 '
311- implementation " androidx.navigation:navigation-compose:2.8.3 "
297+ implementation libs . androidx. paging. compose
298+ implementation libs . androidx. navigation. compose
312299
313300 // Coroutines interop
314- implementation ' org.jetbrains.kotlinx:kotlinx-coroutines-rx3:1.8.1'
301+ implementation libs. kotlinx. coroutines. rx3
302+
303+ // Library loading for About screen
304+ implementation libs. aboutlibraries. compose. m3
315305
316306 // Hilt
317- implementation( " com.google.dagger: hilt-android:2.51.1 " )
318- kapt(" com.google.dagger: hilt-compiler:2.51.1 " )
307+ implementation libs . hilt. android
308+ kapt(libs . hilt. compiler )
319309
320310 // Scroll
321- implementation ' com.github.nanihadesuka:LazyColumnScrollbar:2.2.0 '
311+ implementation libs . lazycolumnscrollbar
322312
323313/* * Debugging **/
324314 // 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 } "
315+ debugImplementation libs . leakcanary. object. watcher
316+ debugImplementation libs . leakcanary. plumber. android
317+ debugImplementation libs . leakcanary. android. core
328318 // Debug bridge for Android
329- debugImplementation " com.facebook. stetho:stetho: ${ stethoVersion } "
330- debugImplementation " com.facebook. stetho:stetho- okhttp3: ${ stethoVersion } "
319+ debugImplementation libs . stetho
320+ debugImplementation libs . stetho. okhttp3
331321
332322 // Jetpack Compose
333- debugImplementation ' androidx.compose.ui:ui- tooling'
323+ debugImplementation libs . androidx. compose. ui. tooling
334324
335325/* * Testing **/
336- testImplementation ' junit:junit:4.13.2 '
337- testImplementation ' org .mockito:mockito-core:5.6.0 '
326+ testImplementation libs . junit
327+ testImplementation libs . mockito. core
338328
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 "
329+ androidTestImplementation libs . androidx. junit
330+ androidTestImplementation libs . androidx. runner
331+ androidTestImplementation libs . androidx. room. testing
332+ androidTestImplementation libs . assertj. core
343333}
344334
345335static String getGitWorkingBranch () {
0 commit comments