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"
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. kotlinx. serialization
13+ alias libs. plugins. checkstyle
14+ alias libs. plugins. sonarqube
15+ alias libs. plugins. hilt
16+ alias libs. plugins. aboutlibraries
1217}
1318
1419android {
@@ -103,6 +108,7 @@ android {
103108
104109 buildFeatures {
105110 viewBinding true
111+ compose true
106112 buildConfig true
107113 }
108114
@@ -117,23 +123,6 @@ android {
117123 }
118124}
119125
120- ext {
121- checkstyleVersion = ' 10.12.1'
122-
123- androidxLifecycleVersion = ' 2.6.2'
124- androidxRoomVersion = ' 2.6.1'
125- androidxWorkVersion = ' 2.8.1'
126-
127- stateSaverVersion = ' 1.4.1'
128- exoPlayerVersion = ' 2.18.7'
129- googleAutoServiceVersion = ' 1.1.1'
130- groupieVersion = ' 2.10.1'
131- markwonVersion = ' 4.6.2'
132-
133- leakCanaryVersion = ' 2.12'
134- stethoVersion = ' 1.6.0'
135- }
136-
137126configurations {
138127 checkstyle
139128 ktlint
@@ -143,7 +132,7 @@ checkstyle {
143132 getConfigDirectory(). set(rootProject. file(" checkstyle" ))
144133 ignoreFailures false
145134 showViolations true
146- toolVersion = checkstyleVersion
135+ toolVersion = libs . versions . checkstyle . get()
147136}
148137
149138tasks. register(' runCheckstyle' , Checkstyle ) {
@@ -185,11 +174,13 @@ tasks.register('formatKtlint', JavaExec) {
185174 jvmArgs(" --add-opens" , " java.base/java.lang=ALL-UNNAMED" )
186175}
187176
177+ apply from : ' check-dependencies.gradle'
178+
188179afterEvaluate {
189180 if (! System . properties. containsKey(' skipFormatKtlint' )) {
190181 preDebugBuild. dependsOn formatKtlint
191182 }
192- preDebugBuild. dependsOn runCheckstyle, runKtlint
183+ preDebugBuild. dependsOn runCheckstyle, runKtlint, checkDependenciesOrder
193184}
194185
195186sonar {
@@ -200,125 +191,161 @@ sonar {
200191 }
201192}
202193
194+ kapt {
195+ correctErrorTypes true
196+ }
197+
198+ aboutLibraries {
199+ // note: offline mode prevents the plugin from fetching licenses at build time, which would be
200+ // harmful for reproducible builds
201+ offlineMode = true
202+ duplicationMode = DuplicateMode . MERGE
203+ }
204+
203205dependencies {
204206/* * Desugaring **/
205- coreLibraryDesugaring ' com.android.tools:desugar_jdk_libs_nio:2.0.4 '
207+ coreLibraryDesugaring libs . desugar . jdk . libs . nio
206208
207209/* * NewPipe libraries **/
208- // You can use a local version by uncommenting a few lines in settings.gradle
209- // Or you can use a commit you pushed to GitHub by just replacing TeamNewPipe with your GitHub
210- // name and the commit hash with the commit hash of the (pushed) commit you want to test
211- // This works thanks to JitPack: https://jitpack.io/
212- implementation ' com.github.TeamNewPipe:nanojson:e9d656ddb49a412a5a0a5d5ef20ca7ef09549996'
213- // WORKAROUND: if you get errors with the NewPipeExtractor dependency, replace `v0.24.3` with
214- // the corresponding commit hash, since JitPack sometimes deletes artifacts.
215- // If there’s already a git hash, just add more of it to the end (or remove a letter)
216- // to cause jitpack to regenerate the artifact.
217- implementation ' com.github.TeamNewPipe:NewPipeExtractor:0023b22095a2d62a60cdfc87f4b5cd85c8b266c3'
218- implementation ' com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0'
210+ implementation libs. teamnewpipe. nanojson
211+ implementation libs. teamnewpipe. newpipe. extractor
212+ implementation libs. teamnewpipe. nononsense. filepicker
219213
220214/* * Checkstyle **/
221- checkstyle " com.puppycrawl. tools: checkstyle: ${ checkstyleVersion } "
222- ktlint ' com.pinterest:ktlint:0.45.2 '
215+ checkstyle libs . tools. checkstyle
216+ ktlint libs . tools . ktlint
223217
224218/* * Kotlin **/
225- implementation " org.jetbrains. kotlin:kotlin- stdlib: ${ kotlin_version } "
219+ implementation libs . kotlin. stdlib
226220
227221/* * AndroidX **/
228- implementation ' androidx.appcompat:appcompat:1.7.1'
229- implementation ' androidx.cardview:cardview:1.0.0'
230- implementation ' androidx.constraintlayout:constraintlayout:2.1.4'
231- implementation ' androidx.core:core-ktx:1.12.0'
232- implementation ' androidx.documentfile:documentfile:1.0.1'
233- implementation ' androidx.fragment:fragment-ktx:1.6.2'
234- implementation " androidx.lifecycle:lifecycle-livedata-ktx:${ androidxLifecycleVersion} "
235- implementation " androidx.lifecycle:lifecycle-viewmodel-ktx:${ androidxLifecycleVersion} "
236- implementation ' androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
237- implementation ' androidx.media:media:1.7.0'
238- implementation ' androidx.preference:preference:1.2.1'
239- implementation ' androidx.recyclerview:recyclerview:1.3.2'
240- implementation " androidx.room:room-runtime:${ androidxRoomVersion} "
241- implementation " androidx.room:room-rxjava3:${ androidxRoomVersion} "
242- kapt " androidx.room:room-compiler:${ androidxRoomVersion} "
243- implementation ' androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
244- // Newer version specified to prevent accessibility regressions with RecyclerView, see:
245- // https://developer.android.com/jetpack/androidx/releases/viewpager2#1.1.0-alpha01
246- implementation ' androidx.viewpager2:viewpager2:1.1.0-beta02'
247- implementation " androidx.work:work-runtime-ktx:${ androidxWorkVersion} "
248- implementation " androidx.work:work-rxjava3:${ androidxWorkVersion} "
249- implementation ' com.google.android.material:material:1.11.0'
250- implementation " androidx.webkit:webkit:1.9.0"
222+ implementation libs. androidx. appcompat
223+ implementation libs. androidx. cardview
224+ implementation libs. androidx. constraintlayout
225+ implementation libs. androidx. core. ktx
226+ implementation libs. androidx. documentfile
227+ implementation libs. androidx. fragment. compose
228+ implementation libs. androidx. lifecycle. livedata
229+ implementation libs. androidx. lifecycle. viewmodel
230+ implementation libs. androidx. media
231+ implementation libs. androidx. preference
232+ implementation libs. androidx. recyclerview
233+ implementation libs. androidx. room. runtime
234+ implementation libs. androidx. room. rxjava3
235+ kapt libs. androidx. room. compiler
236+ implementation libs. androidx. swiperefreshlayout
237+ implementation libs. androidx. work. runtime
238+ implementation libs. androidx. work. rxjava3
239+ implementation libs. androidx. material
240+ implementation libs. androidx. webkit
251241
252242/* * Third-party libraries **/
253243 // Instance state boilerplate elimination
254- implementation ' com.github. livefront:bridge:v2.0.2 '
255- implementation " com.evernote: android- state: $s tateSaverVersion "
256- kapt " com.evernote: android- state- processor: $s tateSaverVersion "
244+ implementation libs . livefront. bridge
245+ implementation libs . android. state
246+ kapt libs . android. state. processor
257247
258248 // HTML parser
259- implementation " org .jsoup:jsoup:1.17.2 "
249+ implementation libs . jsoup
260250
261251 // HTTP client
262- implementation " com.squareup.okhttp3: okhttp:4.12.0 "
252+ implementation libs . okhttp
263253
264254 // Media player
265- implementation " com.google.android. exoplayer:exoplayer- core: ${ exoPlayerVersion } "
266- implementation " com.google.android. exoplayer:exoplayer- dash: ${ exoPlayerVersion } "
267- implementation " com.google.android. exoplayer:exoplayer- database: ${ exoPlayerVersion } "
268- implementation " com.google.android. exoplayer:exoplayer- datasource: ${ exoPlayerVersion } "
269- implementation " com.google.android. exoplayer:exoplayer- hls: ${ exoPlayerVersion } "
270- implementation " com.google.android. exoplayer:exoplayer- smoothstreaming: ${ exoPlayerVersion } "
271- implementation " com.google.android. exoplayer:exoplayer-ui: ${ exoPlayerVersion } "
272- implementation " com.google.android.exoplayer: extension- mediasession: ${ exoPlayerVersion } "
255+ implementation libs . exoplayer. core
256+ implementation libs . exoplayer. dash
257+ implementation libs . exoplayer. database
258+ implementation libs . exoplayer. datasource
259+ implementation libs . exoplayer. hls
260+ implementation libs . exoplayer. smoothstreaming
261+ implementation libs . exoplayer. ui
262+ implementation libs . extension. mediasession
273263
274264 // Metadata generator for service descriptors
275- compileOnly " com.google. auto.service:auto-service-annotations: ${ googleAutoServiceVersion } "
276- kapt " com.google. auto.service:auto-service: ${ googleAutoServiceVersion } "
265+ compileOnly libs . auto. service
266+ kapt libs . auto. service. kapt
277267
278268 // Manager for complex RecyclerView layouts
279- implementation " com.github. lisawray.groupie:groupie: ${ groupieVersion } "
280- implementation " com.github. lisawray.groupie:groupie- viewbinding: ${ groupieVersion } "
269+ implementation libs . lisawray. groupie
270+ implementation libs . lisawray. groupie. viewbinding
281271
282272 // Image loading
283- // noinspection NewerVersionAvailable,GradleDependency --> 2.8 is the last version, not 2.71828!
284- implementation " com.squareup.picasso:picasso:2.8 "
273+ implementation libs . coil . compose
274+ implementation libs . coil . network . okhttp
285275
286276 // Markdown library for Android
287- implementation " io.noties. markwon: core: ${ markwonVersion } "
288- implementation " io.noties. markwon: linkify: ${ markwonVersion } "
277+ implementation libs . markwon. core
278+ implementation libs . markwon. linkify
289279
290280 // Crash reporting
291- implementation " ch .acra:acra-core:5.11.3 "
281+ implementation libs . acra. core
292282
293283 // Properly restarting
294- implementation ' com.jakewharton: process-phoenix:2.1.2 '
284+ implementation libs . process. phoenix
295285
296286 // Reactive extensions for Java VM
297- implementation " io.reactivex. rxjava3:rxjava:3.1.8 "
298- implementation " io.reactivex. rxjava3:rxandroid:3.0.2 "
287+ implementation libs . rxjava3. rxjava
288+ implementation libs . rxjava3. rxandroid
299289 // RxJava binding APIs for Android UI widgets
300- implementation " com.jakewharton. rxbinding4:rxbinding:4.0.0 "
290+ implementation libs . rxbinding4. rxbinding
301291
302292 // Date and time formatting
303- implementation " org.ocpsoft.prettytime:prettytime:5.0.8.Final"
293+ implementation libs. prettytime
294+
295+ // Jetpack Compose
296+ implementation(platform(libs. androidx. compose. bom))
297+ implementation libs. androidx. compose. material3
298+ implementation libs. androidx. compose. adaptive
299+ implementation libs. androidx. activity. compose
300+ implementation libs. androidx. compose. ui. tooling. preview
301+ implementation libs. androidx. lifecycle. viewmodel. compose
302+ implementation libs. androidx. compose. ui. text // Needed for parsing HTML to AnnotatedString
303+ implementation libs. androidx. compose. material. icons. extended
304+
305+ // Jetpack Compose related dependencies
306+ implementation libs. androidx. paging. compose
307+ implementation libs. androidx. navigation. compose
308+
309+ // Coroutines interop
310+ implementation libs. kotlinx. coroutines. rx3
311+
312+ // Library loading for About screen
313+ implementation libs. aboutlibraries. compose. m3
314+
315+ // Hilt
316+ implementation libs. hilt. android
317+ kapt(libs. hilt. compiler)
318+
319+ // Scroll
320+ implementation libs. lazycolumnscrollbar
321+
322+ // Kotlinx Serialization
323+ implementation libs. kotlinx. serialization. json
304324
305325/* * Debugging **/
306326 // Memory leak detection
307- debugImplementation " com.squareup. leakcanary:leakcanary- object- watcher-android: ${ leakCanaryVersion } "
308- debugImplementation " com.squareup. leakcanary: plumber- android: ${ leakCanaryVersion } "
309- debugImplementation " com.squareup. leakcanary:leakcanary- android- core: ${ leakCanaryVersion } "
327+ debugImplementation libs . leakcanary. object. watcher
328+ debugImplementation libs . leakcanary. plumber. android
329+ debugImplementation libs . leakcanary. android. core
310330 // Debug bridge for Android
311- debugImplementation " com.facebook.stetho:stetho:${ stethoVersion} "
312- debugImplementation " com.facebook.stetho:stetho-okhttp3:${ stethoVersion} "
331+ debugImplementation libs. stetho
332+ debugImplementation libs. stetho. okhttp3
333+
334+ // Jetpack Compose
335+ debugImplementation libs. androidx. compose. ui. tooling
313336
314337/* * Testing **/
315- testImplementation ' junit:junit:4.13.2'
316- testImplementation ' org.mockito:mockito-core:5.6.0'
338+ testImplementation libs. junit
339+ testImplementation libs. mockito. core
340+
341+ androidTestImplementation libs. androidx. junit
342+ androidTestImplementation libs. androidx. runner
343+ androidTestImplementation libs. androidx. room. testing
344+ androidTestImplementation libs. assertj. core
345+ androidTestImplementation platform(libs. androidx. compose. bom)
346+ androidTestImplementation libs. androidx. compose. ui. test. junit4
347+ debugImplementation libs. androidx. compose. ui. test. manifest
317348
318- androidTestImplementation " androidx.test.ext:junit:1.1.5"
319- androidTestImplementation " androidx.test:runner:1.5.2"
320- androidTestImplementation " androidx.room:room-testing:${ androidxRoomVersion} "
321- androidTestImplementation " org.assertj:assertj-core:3.24.2"
322349}
323350
324351static String getGitWorkingBranch () {
0 commit comments