build.gradle 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. /*
  2. * Nextcloud Talk application
  3. *
  4. * @author Mario Danic
  5. * @author Andy Scherzinger
  6. * @author Marcel Hibbe
  7. * Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
  8. * Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
  9. * Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation, either version 3 of the License, or
  14. * at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. */
  24. import com.github.spotbugs.snom.SpotBugsTask
  25. apply plugin: 'com.android.application'
  26. apply plugin: 'kotlin-android'
  27. apply plugin: 'kotlin-kapt'
  28. apply plugin: 'kotlin-android-extensions'
  29. apply plugin: 'com.github.spotbugs'
  30. apply plugin: 'io.gitlab.arturbosch.detekt'
  31. configurations {
  32. ktlint
  33. }
  34. for (TaskExecutionRequest tr : getGradle().getStartParameter().getTaskRequests()) {
  35. for (String arg : tr.args) {
  36. // any gplay, but only exact "build", as e.g. buildGeneric shall not apply gplay.grade
  37. if (arg.contains("Gplay") || arg.contains("lint") || arg == "build") {
  38. apply from: 'gplay.gradle'
  39. System.console().println("Applying gplay.gradle")
  40. }
  41. }
  42. }
  43. android {
  44. compileSdkVersion 29
  45. buildToolsVersion '30.0.3'
  46. defaultConfig {
  47. minSdkVersion 21
  48. targetSdkVersion 29
  49. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  50. // mayor.minor.hotfix.increment (for increment: 01-50=Alpha / 51-89=RC / 90-99=stable)
  51. // xx .xxx .xx .xx
  52. versionCode 120030002
  53. versionName "12.3.0 Alpha 02"
  54. flavorDimensions "default"
  55. renderscriptTargetApi 19
  56. renderscriptSupportModeEnabled true
  57. productFlavors {
  58. // used for f-droid
  59. generic {
  60. applicationId 'com.nextcloud.talk2'
  61. dimension "default"
  62. }
  63. gplay {
  64. applicationId 'com.nextcloud.talk2'
  65. dimension "default"
  66. }
  67. qa {
  68. applicationId "com.nextcloud.talk2.qa"
  69. dimension "default"
  70. versionCode 1
  71. versionName "1"
  72. }
  73. }
  74. // Enabling multidex support.
  75. multiDexEnabled true
  76. vectorDrawables.useSupportLibrary = true
  77. lintOptions {
  78. disable 'InvalidPackage'
  79. disable 'MissingTranslation'
  80. disable 'VectorPath'
  81. }
  82. javaCompileOptions {
  83. annotationProcessorOptions {
  84. arguments = [
  85. parcelerStacktrace: "true"
  86. ]
  87. }
  88. }
  89. }
  90. dexOptions {
  91. javaMaxHeapSize "4g"
  92. }
  93. buildTypes {
  94. release {
  95. minifyEnabled false
  96. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  97. }
  98. }
  99. packagingOptions {
  100. exclude 'META-INF/LICENSE.txt'
  101. exclude 'META-INF/LICENSE'
  102. exclude 'META-INF/NOTICE.txt'
  103. exclude 'META-INF/NOTICE'
  104. exclude 'META-INF/DEPENDENCIES'
  105. exclude 'META-INF/rxjava.properties'
  106. }
  107. android.applicationVariants.all { variant ->
  108. String variantName = variant.name
  109. String capVariantName = variantName.substring(0, 1).toUpperCase() + variantName.substring(1)
  110. tasks.register("spotbugs${capVariantName}Report", SpotBugsTask) {
  111. ignoreFailures = true // should continue checking
  112. effort = "max"
  113. reportLevel = "medium"
  114. classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/classes/")
  115. excludeFilter = file("${project.rootDir}/spotbugs-filter.xml")
  116. reports {
  117. xml.enabled = false
  118. html {
  119. enabled = true
  120. destination = file("$project.buildDir/reports/spotbugs/spotbugs.html")
  121. }
  122. }
  123. }
  124. }
  125. check.dependsOn 'spotbugsGplayDebugReport', 'lint', 'ktlint', 'detekt'
  126. compileOptions {
  127. sourceCompatibility JavaVersion.VERSION_1_8
  128. targetCompatibility JavaVersion.VERSION_1_8
  129. }
  130. lintOptions {
  131. abortOnError false
  132. htmlReport true
  133. htmlOutput file("$project.buildDir/reports/lint/lint.html")
  134. disable 'MissingTranslation'
  135. }
  136. buildFeatures {
  137. viewBinding true
  138. }
  139. }
  140. ext {
  141. butterknifeVersion = "10.2.3"
  142. coilKtVersion = "1.3.2"
  143. daggerVersion = "2.38.1"
  144. okhttpVersion = "4.9.1"
  145. materialDialogsVersion = "3.3.0"
  146. parcelerVersion = "1.1.13"
  147. powermockVersion = "2.0.9"
  148. retrofit2Version = "2.9.0"
  149. workVersion = "2.5.0"
  150. markwonVersion = "4.6.2"
  151. }
  152. configurations.all {
  153. exclude group: 'com.google.firebase', module: 'firebase-core'
  154. exclude group: 'com.google.firebase', module: 'firebase-analytics'
  155. exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
  156. }
  157. dependencies {
  158. implementation fileTree(include: ['*'], dir: 'libs')
  159. implementation 'androidx.appcompat:appcompat:1.3.1'
  160. implementation 'com.google.android.material:material:1.4.0'
  161. implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
  162. implementation 'com.github.vanniktech:Emoji:0.6.0' // 0.7.0 has display issue - don't update to 0.7.0
  163. implementation group: 'androidx.emoji', name: 'emoji-bundled', version: '1.1.0'
  164. implementation 'org.michaelevans.colorart:library:0.0.3'
  165. implementation "androidx.work:work-runtime:${workVersion}"
  166. implementation "androidx.work:work-rxjava2:${workVersion}"
  167. implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
  168. implementation 'androidx.exifinterface:exifinterface:1.3.3'
  169. androidTestImplementation "androidx.work:work-testing:${workVersion}"
  170. implementation 'com.google.android:flexbox:2.0.1'
  171. implementation ('com.gitlab.bitfireAT:dav4jvm:2.1.2', {
  172. exclude group: 'org.ogce', module: 'xpp3' // Android comes with its own XmlPullParser
  173. })
  174. ktlint "com.pinterest:ktlint:0.42.1"
  175. implementation 'org.conscrypt:conscrypt-android:2.5.2'
  176. implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
  177. implementation 'androidx.biometric:biometric:1.0.1'
  178. implementation "androidx.lifecycle:lifecycle-extensions:2.1.0"
  179. implementation 'androidx.multidex:multidex:2.0.1'
  180. implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
  181. implementation "io.reactivex.rxjava2:rxjava:2.2.21"
  182. implementation 'com.bluelinelabs:conductor:3.1.1'
  183. implementation "com.squareup.okhttp3:okhttp:${okhttpVersion}"
  184. implementation "com.squareup.okhttp3:okhttp-urlconnection:${okhttpVersion}"
  185. implementation "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}"
  186. implementation 'com.bluelinelabs:logansquare:1.3.7'
  187. implementation 'com.fasterxml.jackson.core:jackson-core:2.12.4'
  188. kapt 'com.bluelinelabs:logansquare-compiler:1.3.7'
  189. implementation "com.squareup.retrofit2:retrofit:${retrofit2Version}"
  190. implementation "com.squareup.retrofit2:adapter-rxjava2:${retrofit2Version}"
  191. implementation 'com.github.aurae.retrofit2:converter-logansquare:1.4.1'
  192. implementation "com.google.dagger:dagger:${daggerVersion}"
  193. kapt "com.google.dagger:dagger-compiler:${daggerVersion}"
  194. implementation 'com.github.lukaspili.autodagger2:autodagger2:1.1'
  195. kapt 'com.github.lukaspili.autodagger2:autodagger2-compiler:1.1'
  196. compileOnly 'javax.annotation:javax.annotation-api:1.3.2'
  197. // Android only
  198. implementation 'org.greenrobot:eventbus:3.2.0'
  199. implementation 'io.requery:requery:1.6.1'
  200. implementation 'io.requery:requery-android:1.6.1'
  201. implementation 'net.zetetic:android-database-sqlcipher:3.5.9'
  202. kapt 'io.requery:requery-processor:1.6.1'
  203. implementation "org.parceler:parceler-api:$parcelerVersion"
  204. kapt "org.parceler:parceler:$parcelerVersion"
  205. implementation 'net.orange-box.storebox:storebox-lib:1.4.0'
  206. implementation "com.jakewharton:butterknife:${butterknifeVersion}"
  207. kapt "com.jakewharton:butterknife-compiler:${butterknifeVersion}"
  208. implementation 'eu.davidea:flexible-adapter:5.1.0'
  209. implementation 'eu.davidea:flexible-adapter-ui:1.0.0'
  210. implementation 'org.webrtc:google-webrtc:1.0.32006'
  211. implementation 'com.yarolegovich:lovely-dialog:1.1.1'
  212. implementation 'com.yarolegovich:mp:1.1.6'
  213. implementation 'me.zhanghai.android.effortlesspermissions:library:1.1.0'
  214. implementation 'org.apache.commons:commons-lang3:3.12.0'
  215. implementation 'com.github.wooplr:Spotlight:1.3'
  216. implementation 'com.google.code.findbugs:jsr305:3.0.2'
  217. implementation('com.github.nextcloud:ChatKit:c6a6176729', {
  218. exclude group: 'com.facebook.fresco'
  219. })
  220. implementation 'com.github.nextcloud.fresco:fresco:v111'
  221. implementation 'com.github.nextcloud.fresco:animated-webp:v111'
  222. implementation 'com.github.nextcloud.fresco:webpsupport:v111'
  223. implementation 'com.github.nextcloud.fresco:animated-gif:v111'
  224. implementation 'com.github.nextcloud.fresco:imagepipeline-okhttp3:v111'
  225. implementation 'joda-time:joda-time:2.10.10'
  226. implementation "io.coil-kt:coil:${coilKtVersion}"
  227. implementation "io.coil-kt:coil-gif:${coilKtVersion}"
  228. implementation "io.coil-kt:coil-svg:${coilKtVersion}"
  229. implementation 'com.github.natario1:Autocomplete:v1.1.0'
  230. implementation 'com.github.cotechde.hwsecurity:hwsecurity-fido:2.4.5'
  231. implementation 'com.novoda:merlin:1.2.1'
  232. implementation 'com.github.Kennyc1012:BottomSheet:2.4.1'
  233. implementation 'com.github.nextcloud:PopupBubble:1.0.6'
  234. implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
  235. implementation "com.afollestad.material-dialogs:core:${materialDialogsVersion}"
  236. implementation "com.afollestad.material-dialogs:datetime:${materialDialogsVersion}"
  237. implementation "com.afollestad.material-dialogs:bottomsheets:${materialDialogsVersion}"
  238. implementation "com.afollestad.material-dialogs:lifecycle:${materialDialogsVersion}"
  239. implementation 'com.google.code.gson:gson:2.8.7'
  240. implementation 'com.google.android.exoplayer:exoplayer:2.15.0'
  241. implementation 'com.github.chrisbanes:PhotoView:2.3.0'
  242. implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.23'
  243. implementation "io.noties.markwon:core:$markwonVersion"
  244. //implementation 'com.github.dhaval2404:imagepicker:1.8'
  245. implementation 'com.github.tobiaskaminsky:ImagePicker:extraFile-SNAPSHOT'
  246. implementation 'com.elyeproj.libraries:loaderviewlibrary:2.0.0'
  247. implementation 'org.osmdroid:osmdroid-android:6.1.10'
  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.6.0'
  253. testImplementation 'junit:junit:4.13.2'
  254. testImplementation 'org.mockito:mockito-core:3.11.2'
  255. testImplementation "org.powermock:powermock-core:${powermockVersion}"
  256. testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
  257. testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}"
  258. androidTestImplementation ('androidx.test.espresso:espresso-core:3.4.0', {
  259. exclude group: 'com.android.support', module: 'support-annotations'
  260. })
  261. spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.11.0'
  262. spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.7'
  263. }
  264. task ktlint(type: JavaExec, group: "verification") {
  265. description = "Check Kotlin code style."
  266. main = "com.pinterest.ktlint.Main"
  267. classpath = configurations.ktlint
  268. args "--reporter=plain", "--reporter=plain,output=${buildDir}/ktlint.txt,src/**/*.kt"
  269. }
  270. task ktlintFormat(type: JavaExec, group: "formatting") {
  271. description = "Fix Kotlin code style deviations."
  272. main = "com.pinterest.ktlint.Main"
  273. classpath = configurations.ktlint
  274. args "-F", "src/**/*.kt"
  275. }
  276. detekt {
  277. reports {
  278. xml {
  279. enabled = false
  280. }
  281. }
  282. config = files("../detekt.yml")
  283. input = files("src/")
  284. }
  285. tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
  286. kotlinOptions {
  287. jvmTarget = "1.8"
  288. }
  289. }