build.gradle 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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.20"
  16. id "org.jetbrains.kotlin.kapt"
  17. id 'com.google.devtools.ksp' version '2.0.20-1.0.25'
  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. apply plugin: 'dagger.hilt.android.plugin'
  28. android {
  29. compileSdk 34
  30. namespace 'com.nextcloud.talk'
  31. defaultConfig {
  32. minSdkVersion 24
  33. targetSdkVersion 34
  34. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  35. // mayor.minor.hotfix.increment (for increment: 01-50=Alpha / 51-89=RC / 90-99=stable)
  36. // xx .xxx .xx .xx
  37. versionCode 200010004
  38. versionName "20.1.0 Alpha 04"
  39. flavorDimensions "default"
  40. renderscriptTargetApi 19
  41. renderscriptSupportModeEnabled true
  42. javaCompileOptions.annotationProcessorOptions.arguments['dagger.hilt.disableModulesHaveInstallInCheck'] = 'true'
  43. productFlavors {
  44. // used for f-droid
  45. generic {
  46. applicationId 'com.nextcloud.talk2'
  47. dimension "default"
  48. }
  49. gplay {
  50. applicationId 'com.nextcloud.talk2'
  51. dimension "default"
  52. }
  53. qa {
  54. applicationId "com.nextcloud.talk2.qa"
  55. dimension "default"
  56. versionCode 1
  57. versionName "1"
  58. }
  59. }
  60. // Enabling multidex support.
  61. multiDexEnabled true
  62. vectorDrawables.useSupportLibrary = true
  63. lintOptions {
  64. disable 'InvalidPackage'
  65. disable 'MissingTranslation'
  66. disable 'VectorPath'
  67. disable 'UnusedQuantity'
  68. }
  69. javaCompileOptions {
  70. annotationProcessorOptions {
  71. arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
  72. }
  73. }
  74. testInstrumentationRunnerArgument "TEST_SERVER_URL", "${NC_TEST_SERVER_BASEURL}"
  75. testInstrumentationRunnerArgument "TEST_SERVER_USERNAME", "${NC_TEST_SERVER_USERNAME}"
  76. testInstrumentationRunnerArgument "TEST_SERVER_PASSWORD", "${NC_TEST_SERVER_PASSWORD}"
  77. def localBroadcastPermission = "PRIVATE_BROADCAST"
  78. manifestPlaceholders.broadcastPermission = localBroadcastPermission
  79. buildConfigField "String", "PERMISSION_LOCAL_BROADCAST", "\"${localBroadcastPermission}\""
  80. }
  81. testOptions {
  82. unitTests.all {
  83. useJUnitPlatform()
  84. }
  85. }
  86. buildTypes {
  87. release {
  88. minifyEnabled false
  89. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  90. }
  91. }
  92. packagingOptions {
  93. resources {
  94. excludes += [
  95. 'META-INF/LICENSE.txt',
  96. 'META-INF/LICENSE',
  97. 'META-INF/NOTICE.txt',
  98. 'META-INF/NOTICE',
  99. 'META-INF/DEPENDENCIES',
  100. 'META-INF/rxjava.properties'
  101. ]
  102. }
  103. }
  104. check.dependsOn 'spotbugsGplayDebug', 'lint', 'ktlintCheck', 'detekt'
  105. compileOptions {
  106. sourceCompatibility JavaVersion.VERSION_17
  107. targetCompatibility JavaVersion.VERSION_17
  108. }
  109. buildFeatures {
  110. viewBinding true
  111. buildConfig = true
  112. compose = true
  113. }
  114. composeOptions {
  115. kotlinCompilerExtensionVersion = "1.5.15"
  116. }
  117. lint {
  118. abortOnError false
  119. disable 'MissingTranslation','PrivateResource'
  120. htmlOutput file("$project.buildDir/reports/lint/lint.html")
  121. htmlReport true
  122. }
  123. }
  124. kapt {
  125. correctErrorTypes = true
  126. }
  127. ext {
  128. androidxCameraVersion = "1.3.4"
  129. coilKtVersion = "2.7.0"
  130. daggerVersion = "2.52"
  131. emojiVersion = "1.5.0"
  132. fidoVersion = "4.1.0-patch2"
  133. lifecycleVersion = '2.8.5'
  134. okhttpVersion = "4.12.0"
  135. markwonVersion = "4.6.2"
  136. materialDialogsVersion = "3.3.0"
  137. parcelerVersion = "1.1.13"
  138. prismVersion = "2.0.0"
  139. retrofit2Version = "2.11.0"
  140. roomVersion = "2.6.1"
  141. workVersion = "2.9.1"
  142. espressoVersion = "3.6.1"
  143. androidxTestVersion = "1.5.0"
  144. media3_version = "1.4.1"
  145. coroutines_version = "1.9.0"
  146. mockitoKotlinVersion = "5.4.0"
  147. }
  148. configurations.configureEach {
  149. exclude group: 'com.google.firebase', module: 'firebase-core'
  150. exclude group: 'com.google.firebase', module: 'firebase-analytics'
  151. exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
  152. exclude group: 'org.jetbrains', module: 'annotations-java5' // via prism4j, already using annotations explicitly
  153. }
  154. dependencies {
  155. spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.0'
  156. spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.6.4'
  157. implementation("androidx.compose.runtime:runtime:1.7.2")
  158. implementation 'androidx.preference:preference-ktx:1.2.1'
  159. implementation 'androidx.datastore:datastore-core:1.1.1'
  160. implementation 'androidx.datastore:datastore-preferences:1.1.1'
  161. implementation 'androidx.test.ext:junit-ktx:1.2.1'
  162. detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.7")
  163. implementation fileTree(include: ['*'], dir: 'libs')
  164. implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2"
  165. implementation 'androidx.appcompat:appcompat:1.7.0'
  166. implementation 'com.google.android.material:material:1.12.0'
  167. implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
  168. implementation "com.vanniktech:emoji-google:0.18.0"
  169. implementation "androidx.emoji2:emoji2:${emojiVersion}"
  170. implementation "androidx.emoji2:emoji2-bundled:${emojiVersion}"
  171. implementation "androidx.emoji2:emoji2-views:${emojiVersion}"
  172. implementation "androidx.emoji2:emoji2-views-helper:${emojiVersion}"
  173. implementation 'org.michaelevans.colorart:library:0.0.3'
  174. implementation "androidx.work:work-runtime:${workVersion}"
  175. implementation "androidx.work:work-rxjava2:${workVersion}"
  176. implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
  177. implementation 'com.google.android.flexbox:flexbox:3.0.0'
  178. implementation ('com.github.bitfireAT:dav4jvm:2.1.3', {
  179. exclude group: 'org.ogce', module: 'xpp3' // Android comes with its own XmlPullParser
  180. })
  181. implementation 'org.conscrypt:conscrypt-android:2.5.3'
  182. implementation "androidx.camera:camera-core:${androidxCameraVersion}"
  183. implementation "androidx.camera:camera-camera2:${androidxCameraVersion}"
  184. implementation "androidx.camera:camera-lifecycle:${androidxCameraVersion}"
  185. implementation "androidx.camera:camera-view:${androidxCameraVersion}"
  186. implementation "androidx.exifinterface:exifinterface:1.3.7"
  187. implementation "androidx.lifecycle:lifecycle-runtime-ktx:${lifecycleVersion}"
  188. implementation "androidx.lifecycle:lifecycle-livedata-ktx:${lifecycleVersion}"
  189. implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${lifecycleVersion}"
  190. implementation "androidx.lifecycle:lifecycle-process:${lifecycleVersion}"
  191. implementation "androidx.lifecycle:lifecycle-common:${lifecycleVersion}"
  192. implementation 'androidx.biometric:biometric:1.1.0'
  193. implementation 'androidx.multidex:multidex:2.0.1'
  194. implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
  195. implementation "io.reactivex.rxjava2:rxjava:2.2.21"
  196. implementation "com.squareup.okhttp3:okhttp:${okhttpVersion}"
  197. implementation "com.squareup.okhttp3:okhttp-urlconnection:${okhttpVersion}"
  198. implementation "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}"
  199. implementation 'com.bluelinelabs:logansquare:1.3.7'
  200. implementation 'com.fasterxml.jackson.core:jackson-core:2.14.3'
  201. kapt 'com.bluelinelabs:logansquare-compiler:1.3.7'
  202. implementation "com.squareup.retrofit2:retrofit:${retrofit2Version}"
  203. implementation "com.squareup.retrofit2:adapter-rxjava2:${retrofit2Version}"
  204. implementation 'de.mannodermaus.retrofit2:converter-logansquare:1.4.1'
  205. implementation "com.google.dagger:dagger:${daggerVersion}"
  206. kapt "com.google.dagger:dagger-compiler:${daggerVersion}"
  207. implementation 'com.github.lukaspili.autodagger2:autodagger2:1.1'
  208. kapt 'com.github.lukaspili.autodagger2:autodagger2-compiler:1.1'
  209. compileOnly 'javax.annotation:javax.annotation-api:1.3.2'
  210. // Android only
  211. implementation 'org.greenrobot:eventbus:3.3.1'
  212. implementation 'net.zetetic:android-database-sqlcipher:4.5.4'
  213. implementation "androidx.room:room-runtime:${roomVersion}"
  214. implementation "androidx.room:room-rxjava2:${roomVersion}"
  215. ksp "androidx.room:room-compiler:${roomVersion}"
  216. implementation "androidx.room:room-ktx:${roomVersion}"
  217. implementation "org.parceler:parceler-api:$parcelerVersion"
  218. implementation 'com.github.ddB0515.FlexibleAdapter:flexible-adapter:5.1.1'
  219. implementation 'com.github.ddB0515.FlexibleAdapter:flexible-adapter-ui:5.1.1'
  220. implementation 'org.apache.commons:commons-lang3:3.17.0'
  221. implementation 'com.github.wooplr:Spotlight:1.3'
  222. implementation 'com.google.code.findbugs:jsr305:3.0.2'
  223. implementation 'com.github.nextcloud-deps:ChatKit:0.4.2'
  224. implementation 'joda-time:joda-time:2.13.0'
  225. implementation "io.coil-kt:coil:${coilKtVersion}"
  226. implementation "io.coil-kt:coil-gif:${coilKtVersion}"
  227. implementation "io.coil-kt:coil-svg:${coilKtVersion}"
  228. implementation 'com.github.natario1:Autocomplete:1.1.0'
  229. implementation "com.github.nextcloud-deps.hwsecurity:hwsecurity-fido:${fidoVersion}"
  230. implementation "com.github.nextcloud-deps.hwsecurity:hwsecurity-fido2:${fidoVersion}"
  231. implementation 'com.github.nextcloud:PopupBubble:2.0.0'
  232. implementation "com.afollestad.material-dialogs:core:${materialDialogsVersion}"
  233. implementation "com.afollestad.material-dialogs:datetime:${materialDialogsVersion}"
  234. implementation "com.afollestad.material-dialogs:bottomsheets:${materialDialogsVersion}"
  235. implementation "com.afollestad.material-dialogs:lifecycle:${materialDialogsVersion}"
  236. implementation 'com.google.code.gson:gson:2.11.0'
  237. implementation 'com.squareup.retrofit2:converter-gson:2.11.0'
  238. implementation "androidx.media3:media3-exoplayer:$media3_version"
  239. implementation "androidx.media3:media3-ui:$media3_version"
  240. implementation 'com.github.chrisbanes:PhotoView:2.3.0'
  241. implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.29'
  242. implementation "io.noties.markwon:core:$markwonVersion"
  243. implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
  244. implementation "io.noties.markwon:ext-tasklist:$markwonVersion"
  245. implementation 'com.github.nextcloud-deps:ImagePicker:2.1.0.2'
  246. implementation 'io.github.elye:loaderviewlibrary:3.0.0'
  247. implementation 'org.osmdroid:osmdroid-android:6.1.20'
  248. implementation ('fr.dudie:nominatim-api:3.4', {
  249. //noinspection DuplicatePlatformClasses
  250. exclude group: 'org.apache.httpcomponents', module: 'httpclient'
  251. })
  252. implementation 'androidx.core:core-ktx:1.13.1'
  253. implementation 'androidx.activity:activity-ktx:1.9.2'
  254. implementation 'com.github.nextcloud.android-common:ui:0.23.0'
  255. implementation 'com.github.nextcloud-deps:android-talk-webrtc:121.6167.0'
  256. gplayImplementation 'com.google.android.gms:play-services-base:18.5.0'
  257. gplayImplementation "com.google.firebase:firebase-messaging:24.0.1"
  258. //compose
  259. implementation(platform("androidx.compose:compose-bom:2024.09.01"))
  260. implementation("androidx.compose.ui:ui")
  261. implementation 'androidx.compose.material3:material3:1.3.0'
  262. implementation("androidx.compose.ui:ui-tooling-preview")
  263. implementation 'androidx.activity:activity-compose:1.9.2'
  264. implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.5'
  265. debugImplementation("androidx.compose.ui:ui-tooling")
  266. //tests
  267. androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.7.2")
  268. debugImplementation("androidx.compose.ui:ui-test-manifest")
  269. testImplementation 'junit:junit:4.13.2'
  270. testImplementation 'org.mockito:mockito-core:5.13.0'
  271. testImplementation 'androidx.arch.core:core-testing:2.2.0'
  272. androidTestImplementation "androidx.test:core:1.6.1"
  273. androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0"
  274. androidTestImplementation 'androidx.test:core-ktx:1.6.1'
  275. androidTestImplementation 'org.mockito:mockito-android:5.13.0'
  276. androidTestImplementation "androidx.work:work-testing:${workVersion}"
  277. // Espresso core
  278. androidTestImplementation ("androidx.test.espresso:espresso-core:$espressoVersion", {
  279. exclude group: 'com.android.support', module: 'support-annotations'
  280. })
  281. androidTestImplementation "androidx.test.espresso:espresso-contrib:$espressoVersion"
  282. androidTestImplementation "androidx.test.espresso:espresso-web:$espressoVersion"
  283. androidTestImplementation "androidx.test.espresso:espresso-accessibility:$espressoVersion"
  284. androidTestImplementation "androidx.test.espresso:espresso-intents:$espressoVersion"
  285. androidTestImplementation('com.android.support.test.espresso:espresso-intents:3.0.2')
  286. spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.0'
  287. spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.6.4'
  288. implementation 'androidx.activity:activity-ktx:1.9.2'
  289. implementation 'com.github.nextcloud.android-common:ui:0.23.0'
  290. implementation 'com.github.nextcloud-deps:android-talk-webrtc:121.6167.0'
  291. implementation("io.coil-kt:coil-compose:2.7.0")
  292. implementation "com.google.dagger:hilt-android:$hilt_version"
  293. kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
  294. implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.5")
  295. androidTestImplementation(platform("androidx.compose:compose-bom:2024.09.01"))
  296. androidTestImplementation("androidx.compose.ui:ui-test-junit4")
  297. testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
  298. testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
  299. testImplementation 'org.junit.vintage:junit-vintage-engine:5.11.0'
  300. }
  301. tasks.register('installGitHooks', Copy) {
  302. description = "Install git hooks"
  303. from("../scripts/hooks") {
  304. include '*'
  305. }
  306. into '../.git/hooks'
  307. }
  308. spotbugs {
  309. ignoreFailures = true // should continue checking
  310. effort = Effort.MAX
  311. reportLevel = Confidence.valueOf('MEDIUM')
  312. }
  313. tasks.withType(SpotBugsTask).configureEach { task ->
  314. String variantNameCap = task.name.replace("spotbugs", "")
  315. String variantName = variantNameCap.substring(0, 1).toLowerCase() + variantNameCap.substring(1)
  316. dependsOn "compile${variantNameCap}Sources"
  317. excludeFilter = file("${project.rootDir}/spotbugs-filter.xml")
  318. classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/compile${variantNameCap}JavaWithJavac/classes/")
  319. reports {
  320. xml {
  321. required = true
  322. }
  323. html {
  324. required = true
  325. outputLocation = file("$project.buildDir/reports/spotbugs/spotbugs.html")
  326. stylesheet = 'fancy.xsl'
  327. }
  328. }
  329. }
  330. tasks.named("detekt").configure {
  331. reports {
  332. html.required.set(true)
  333. txt.required.set(true)
  334. xml.required.set(false)
  335. sarif.required.set(false)
  336. md.required.set(false)
  337. }
  338. }
  339. detekt {
  340. config.setFrom("../detekt.yml")
  341. source.setFrom("src/")
  342. }
  343. ksp {
  344. arg('room.schemaLocation', "$projectDir/schemas")
  345. }