build.gradle 13 KB

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