build.gradle 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. /*
  2. * Nextcloud Talk - Android Client
  3. *
  4. * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-FileCopyrightText: 2021-2023 Marcel Hibbe <dev@mhibbe.de>
  6. * SPDX-FileCopyrightText: 2022 Tim Krüger <t@timkrueger.me>
  7. * SPDX-FileCopyrightText: 2021 Andy Scherzinger <info@andy-scherzinger.de>
  8. * SPDX-FileCopyrightText: 2017-2019 Mario Danic <mario@lovelyhq.com>
  9. * SPDX-License-Identifier: GPL-3.0-or-later
  10. */
  11. import com.github.spotbugs.snom.Confidence
  12. import com.github.spotbugs.snom.Effort
  13. import com.github.spotbugs.snom.SpotBugsTask
  14. plugins {
  15. id "org.jetbrains.kotlin.plugin.compose" version "2.0.0"
  16. id "org.jetbrains.kotlin.kapt"
  17. id 'com.google.devtools.ksp' version '2.0.0-1.0.21'
  18. }
  19. apply plugin: 'com.android.application'
  20. apply plugin: 'kotlin-android'
  21. apply plugin: 'kotlin-kapt'
  22. apply plugin: 'kotlin-parcelize'
  23. apply plugin: 'com.github.spotbugs'
  24. apply plugin: 'io.gitlab.arturbosch.detekt'
  25. apply plugin: "org.jlleitschuh.gradle.ktlint"
  26. apply plugin: 'kotlinx-serialization'
  27. android {
  28. compileSdk 34
  29. namespace 'com.nextcloud.talk'
  30. defaultConfig {
  31. minSdkVersion 24
  32. targetSdkVersion 34
  33. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  34. // mayor.minor.hotfix.increment (for increment: 01-50=Alpha / 51-89=RC / 90-99=stable)
  35. // xx .xxx .xx .xx
  36. versionCode 190010004
  37. versionName "19.1.0 Alpha 04"
  38. flavorDimensions "default"
  39. renderscriptTargetApi 19
  40. renderscriptSupportModeEnabled true
  41. productFlavors {
  42. // used for f-droid
  43. generic {
  44. applicationId 'com.nextcloud.talk2'
  45. dimension "default"
  46. }
  47. gplay {
  48. applicationId 'com.nextcloud.talk2'
  49. dimension "default"
  50. }
  51. qa {
  52. applicationId "com.nextcloud.talk2.qa"
  53. dimension "default"
  54. versionCode 1
  55. versionName "1"
  56. }
  57. }
  58. // Enabling multidex support.
  59. multiDexEnabled true
  60. vectorDrawables.useSupportLibrary = true
  61. lintOptions {
  62. disable 'InvalidPackage'
  63. disable 'MissingTranslation'
  64. disable 'VectorPath'
  65. disable 'UnusedQuantity'
  66. }
  67. javaCompileOptions {
  68. annotationProcessorOptions {
  69. arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
  70. }
  71. }
  72. testInstrumentationRunnerArgument "TEST_SERVER_URL", "${NC_TEST_SERVER_BASEURL}"
  73. testInstrumentationRunnerArgument "TEST_SERVER_USERNAME", "${NC_TEST_SERVER_USERNAME}"
  74. testInstrumentationRunnerArgument "TEST_SERVER_PASSWORD", "${NC_TEST_SERVER_PASSWORD}"
  75. def localBroadcastPermission = "PRIVATE_BROADCAST"
  76. manifestPlaceholders.broadcastPermission = localBroadcastPermission
  77. buildConfigField "String", "PERMISSION_LOCAL_BROADCAST", "\"${localBroadcastPermission}\""
  78. }
  79. buildTypes {
  80. release {
  81. minifyEnabled false
  82. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  83. }
  84. }
  85. packagingOptions {
  86. resources {
  87. excludes += [
  88. 'META-INF/LICENSE.txt',
  89. 'META-INF/LICENSE',
  90. 'META-INF/NOTICE.txt',
  91. 'META-INF/NOTICE',
  92. 'META-INF/DEPENDENCIES',
  93. 'META-INF/rxjava.properties'
  94. ]
  95. }
  96. }
  97. check.dependsOn 'spotbugsGplayDebug', 'lint', 'ktlintCheck', 'detekt'
  98. compileOptions {
  99. sourceCompatibility JavaVersion.VERSION_17
  100. targetCompatibility JavaVersion.VERSION_17
  101. }
  102. buildFeatures {
  103. viewBinding true
  104. buildConfig = true
  105. }
  106. lint {
  107. abortOnError false
  108. disable 'MissingTranslation','PrivateResource'
  109. htmlOutput file("$project.buildDir/reports/lint/lint.html")
  110. htmlReport true
  111. }
  112. }
  113. ext {
  114. androidxCameraVersion = "1.3.4"
  115. coilKtVersion = "2.6.0"
  116. daggerVersion = "2.51.1"
  117. emojiVersion = "1.4.0"
  118. fidoVersion = "4.1.0-patch2"
  119. lifecycleVersion = '2.8.3'
  120. okhttpVersion = "4.12.0"
  121. markwonVersion = "4.6.2"
  122. materialDialogsVersion = "3.3.0"
  123. parcelerVersion = "1.1.13"
  124. prismVersion = "2.0.0"
  125. retrofit2Version = "2.11.0"
  126. roomVersion = "2.6.1"
  127. workVersion = "2.9.0"
  128. espressoVersion = "3.6.1"
  129. media3_version = "1.3.1"
  130. }
  131. configurations.configureEach {
  132. exclude group: 'com.google.firebase', module: 'firebase-core'
  133. exclude group: 'com.google.firebase', module: 'firebase-analytics'
  134. exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
  135. exclude group: 'org.jetbrains', module: 'annotations-java5' // via prism4j, already using annotations explicitly
  136. }
  137. dependencies {
  138. implementation("androidx.compose.runtime:runtime:1.6.8")
  139. implementation 'androidx.preference:preference-ktx:1.2.1'
  140. implementation 'androidx.datastore:datastore-core:1.1.1'
  141. implementation 'androidx.datastore:datastore-preferences:1.1.1'
  142. detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6")
  143. implementation fileTree(include: ['*'], dir: 'libs')
  144. implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3"
  145. implementation 'androidx.appcompat:appcompat:1.7.0'
  146. implementation 'com.google.android.material:material:1.12.0'
  147. implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
  148. implementation "com.vanniktech:emoji-google:0.18.0"
  149. implementation "androidx.emoji2:emoji2:${emojiVersion}"
  150. implementation "androidx.emoji2:emoji2-bundled:${emojiVersion}"
  151. implementation "androidx.emoji2:emoji2-views:${emojiVersion}"
  152. implementation "androidx.emoji2:emoji2-views-helper:${emojiVersion}"
  153. implementation 'org.michaelevans.colorart:library:0.0.3'
  154. implementation "androidx.work:work-runtime:${workVersion}"
  155. implementation "androidx.work:work-rxjava2:${workVersion}"
  156. implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
  157. androidTestImplementation "androidx.work:work-testing:${workVersion}"
  158. implementation 'com.google.android.flexbox:flexbox:3.0.0'
  159. implementation ('com.github.bitfireAT:dav4jvm:2.1.3', {
  160. exclude group: 'org.ogce', module: 'xpp3' // Android comes with its own XmlPullParser
  161. })
  162. implementation 'org.conscrypt:conscrypt-android:2.5.2'
  163. implementation "androidx.camera:camera-core:${androidxCameraVersion}"
  164. implementation "androidx.camera:camera-camera2:${androidxCameraVersion}"
  165. implementation "androidx.camera:camera-lifecycle:${androidxCameraVersion}"
  166. implementation "androidx.camera:camera-view:${androidxCameraVersion}"
  167. implementation "androidx.exifinterface:exifinterface:1.3.7"
  168. implementation "androidx.lifecycle:lifecycle-runtime-ktx:${lifecycleVersion}"
  169. implementation "androidx.lifecycle:lifecycle-livedata-ktx:${lifecycleVersion}"
  170. implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${lifecycleVersion}"
  171. implementation "androidx.lifecycle:lifecycle-process:${lifecycleVersion}"
  172. implementation "androidx.lifecycle:lifecycle-common:${lifecycleVersion}"
  173. implementation 'androidx.biometric:biometric:1.1.0'
  174. implementation 'androidx.multidex:multidex:2.0.1'
  175. implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
  176. implementation "io.reactivex.rxjava2:rxjava:2.2.21"
  177. implementation "com.squareup.okhttp3:okhttp:${okhttpVersion}"
  178. implementation "com.squareup.okhttp3:okhttp-urlconnection:${okhttpVersion}"
  179. implementation "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}"
  180. implementation 'com.bluelinelabs:logansquare:1.3.7'
  181. implementation 'com.fasterxml.jackson.core:jackson-core:2.14.3'
  182. kapt 'com.bluelinelabs:logansquare-compiler:1.3.7'
  183. implementation "com.squareup.retrofit2:retrofit:${retrofit2Version}"
  184. implementation "com.squareup.retrofit2:adapter-rxjava2:${retrofit2Version}"
  185. implementation 'com.github.aurae.retrofit2:converter-logansquare:1.4.1'
  186. implementation "com.google.dagger:dagger:${daggerVersion}"
  187. kapt "com.google.dagger:dagger-compiler:${daggerVersion}"
  188. implementation 'com.github.lukaspili.autodagger2:autodagger2:1.1'
  189. kapt 'com.github.lukaspili.autodagger2:autodagger2-compiler:1.1'
  190. compileOnly 'javax.annotation:javax.annotation-api:1.3.2'
  191. // Android only
  192. implementation 'org.greenrobot:eventbus:3.3.1'
  193. implementation 'net.zetetic:android-database-sqlcipher:4.5.4'
  194. implementation "androidx.room:room-runtime:${roomVersion}"
  195. implementation "androidx.room:room-rxjava2:${roomVersion}"
  196. ksp "androidx.room:room-compiler:${roomVersion}"
  197. implementation "androidx.room:room-ktx:${roomVersion}"
  198. implementation "org.parceler:parceler-api:$parcelerVersion"
  199. implementation 'eu.davidea:flexible-adapter:5.1.0'
  200. implementation 'eu.davidea:flexible-adapter-ui:1.0.0'
  201. implementation 'org.apache.commons:commons-lang3:3.14.0'
  202. implementation 'com.github.wooplr:Spotlight:1.3'
  203. implementation 'com.google.code.findbugs:jsr305:3.0.2'
  204. implementation 'com.github.nextcloud-deps:ChatKit:0.4.2'
  205. implementation 'joda-time:joda-time:2.12.7'
  206. implementation "io.coil-kt:coil:${coilKtVersion}"
  207. implementation "io.coil-kt:coil-gif:${coilKtVersion}"
  208. implementation "io.coil-kt:coil-svg:${coilKtVersion}"
  209. implementation 'com.github.natario1:Autocomplete:1.1.0'
  210. implementation "com.github.nextcloud-deps.hwsecurity:hwsecurity-fido:${fidoVersion}"
  211. implementation "com.github.nextcloud-deps.hwsecurity:hwsecurity-fido2:${fidoVersion}"
  212. implementation 'com.novoda:merlin:1.2.1'
  213. implementation 'com.github.nextcloud:PopupBubble:2.0.0'
  214. implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
  215. implementation "com.afollestad.material-dialogs:core:${materialDialogsVersion}"
  216. implementation "com.afollestad.material-dialogs:datetime:${materialDialogsVersion}"
  217. implementation "com.afollestad.material-dialogs:bottomsheets:${materialDialogsVersion}"
  218. implementation "com.afollestad.material-dialogs:lifecycle:${materialDialogsVersion}"
  219. implementation 'com.google.code.gson:gson:2.11.0'
  220. implementation "androidx.media3:media3-exoplayer:$media3_version"
  221. implementation "androidx.media3:media3-ui:$media3_version"
  222. implementation 'com.github.chrisbanes:PhotoView:2.3.0'
  223. implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.28'
  224. implementation "io.noties.markwon:core:$markwonVersion"
  225. implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
  226. implementation "io.noties.markwon:ext-tasklist:$markwonVersion"
  227. implementation 'com.github.nextcloud-deps:ImagePicker:2.1.0.2'
  228. implementation 'io.github.elye:loaderviewlibrary:3.0.0'
  229. implementation 'org.osmdroid:osmdroid-android:6.1.18'
  230. implementation ('fr.dudie:nominatim-api:3.4', {
  231. //noinspection DuplicatePlatformClasses
  232. exclude group: 'org.apache.httpcomponents', module: 'httpclient'
  233. })
  234. implementation 'androidx.core:core-ktx:1.13.1'
  235. testImplementation 'junit:junit:4.13.2'
  236. testImplementation 'org.mockito:mockito-core:5.12.0'
  237. androidTestImplementation 'org.mockito:mockito-android:5.12.0'
  238. testImplementation 'androidx.arch.core:core-testing:2.2.0'
  239. androidTestImplementation "androidx.test:core:1.6.1"
  240. // Espresso core
  241. androidTestImplementation ("androidx.test.espresso:espresso-core:$espressoVersion", {
  242. exclude group: 'com.android.support', module: 'support-annotations'
  243. })
  244. androidTestImplementation "androidx.test.espresso:espresso-contrib:$espressoVersion"
  245. androidTestImplementation "androidx.test.espresso:espresso-web:$espressoVersion"
  246. androidTestImplementation "androidx.test.espresso:espresso-accessibility:$espressoVersion"
  247. androidTestImplementation('com.android.support.test.espresso:espresso-intents:3.0.2')
  248. spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.0'
  249. spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.6.4'
  250. gplayImplementation 'com.google.android.gms:play-services-base:18.4.0'
  251. gplayImplementation "com.google.firebase:firebase-messaging:23.4.1"
  252. implementation 'androidx.activity:activity-ktx:1.9.0'
  253. implementation 'com.github.nextcloud.android-common:ui:0.22.0'
  254. implementation 'com.github.nextcloud-deps:android-talk-webrtc:121.6167.0'
  255. }
  256. tasks.register('installGitHooks', Copy) {
  257. description = "Install git hooks"
  258. from("../scripts/hooks") {
  259. include '*'
  260. }
  261. into '../.git/hooks'
  262. }
  263. spotbugs {
  264. ignoreFailures = true // should continue checking
  265. effort = Effort.MAX
  266. reportLevel = Confidence.valueOf('MEDIUM')
  267. }
  268. tasks.withType(SpotBugsTask).configureEach { task ->
  269. String variantNameCap = task.name.replace("spotbugs", "")
  270. String variantName = variantNameCap.substring(0, 1).toLowerCase() + variantNameCap.substring(1)
  271. dependsOn "compile${variantNameCap}Sources"
  272. excludeFilter = file("${project.rootDir}/spotbugs-filter.xml")
  273. classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/compile${variantNameCap}JavaWithJavac/classes/")
  274. reports {
  275. xml {
  276. required = true
  277. }
  278. html {
  279. required = true
  280. outputLocation = file("$project.buildDir/reports/spotbugs/spotbugs.html")
  281. stylesheet = 'fancy.xsl'
  282. }
  283. }
  284. }
  285. tasks.named("detekt").configure {
  286. reports {
  287. html.required.set(true)
  288. txt.required.set(true)
  289. xml.required.set(false)
  290. sarif.required.set(false)
  291. md.required.set(false)
  292. }
  293. }
  294. detekt {
  295. config.setFrom("../detekt.yml")
  296. source.setFrom("src/")
  297. }
  298. ksp {
  299. arg('room.schemaLocation', "$projectDir/schemas")
  300. }