build.gradle 14 KB

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