build.gradle 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. // Gradle build file
  2. //
  3. // This project was started in Eclipse and later moved to Android Studio. In the transition, both IDEs were supported.
  4. // Due to this, the files layout is not the usual in new projects created with Android Studio / gradle. This file
  5. // merges declarations usually split in two separates build.gradle file, one for global settings of the project in
  6. // its root folder, another one for the app module in subfolder of root.
  7. buildscript {
  8. repositories {
  9. jcenter()
  10. maven {
  11. url 'https://oss.sonatype.org/content/repositories/snapshots/'
  12. }
  13. google()
  14. }
  15. dependencies {
  16. classpath 'com.android.tools.build:gradle:3.0.1'
  17. classpath 'com.google.gms:google-services:3.0.0'
  18. }
  19. }
  20. apply plugin: 'com.android.application'
  21. apply plugin: 'checkstyle'
  22. apply plugin: 'pmd'
  23. apply plugin: 'findbugs'
  24. configurations.all {
  25. // check for updates every build
  26. resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
  27. }
  28. ext {
  29. supportLibraryVersion = '26.1.0'
  30. googleLibraryVersion = '11.2.2'
  31. travisBuild = System.getenv("TRAVIS") == "true"
  32. // allows for -Dpre-dex=false to be set
  33. preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
  34. }
  35. repositories {
  36. jcenter()
  37. maven { url "https://jitpack.io" }
  38. maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
  39. google()
  40. flatDir {
  41. dirs 'libs'
  42. }
  43. }
  44. android {
  45. lintOptions {
  46. abortOnError false
  47. htmlReport true
  48. htmlOutput file("$project.buildDir/reports/lint/lint.html")
  49. disable 'MissingTranslation'
  50. }
  51. dexOptions {
  52. javaMaxHeapSize "4g"
  53. }
  54. compileSdkVersion 26
  55. buildToolsVersion '26.0.2'
  56. defaultConfig {
  57. minSdkVersion 14
  58. targetSdkVersion 26
  59. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  60. // arguments to be passed to functional tests
  61. testInstrumentationRunnerArgument "TEST_USER", "\"$System.env.OCTEST_APP_USERNAME\""
  62. testInstrumentationRunnerArgument "TEST_PASSWORD", "\"$System.env.OCTEST_APP_PASSWORD\""
  63. testInstrumentationRunnerArgument "TEST_SERVER_URL", "\"$System.env.OCTEST_SERVER_BASE_URL\""
  64. multiDexEnabled true
  65. versionCode = 30010000
  66. versionName = "3.1.0 Alpha"
  67. // adapt structure from Eclipse to Gradle/Android Studio expectations;
  68. // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
  69. flavorDimensions "default"
  70. productFlavors {
  71. // used for f-droid
  72. generic {
  73. applicationId 'com.nextcloud.client'
  74. dimension "default"
  75. }
  76. gplay {
  77. applicationId 'com.nextcloud.client'
  78. dimension "default"
  79. }
  80. versionDev {
  81. applicationId "com.nextcloud.android.beta"
  82. dimension "default"
  83. versionCode 20180215
  84. versionName "20180215"
  85. }
  86. }
  87. }
  88. // adapt structure from Eclipse to Gradle/Android Studio expectations;
  89. // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
  90. dexOptions {
  91. // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
  92. preDexLibraries = preDexEnabled && !travisBuild
  93. }
  94. packagingOptions {
  95. exclude 'META-INF/LICENSE.txt'
  96. exclude 'META-INF/LICENSE'
  97. }
  98. task checkstyle(type: Checkstyle) {
  99. configFile = file("${rootProject.projectDir}/checkstyle.xml")
  100. configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
  101. source 'src'
  102. include '**/*.java'
  103. exclude '**/gen/**'
  104. classpath = files()
  105. }
  106. task pmd(type: Pmd) {
  107. ruleSetFiles = files("${project.rootDir}/pmd-ruleset.xml")
  108. ignoreFailures = false
  109. ruleSets = []
  110. source 'src'
  111. include '**/*.java'
  112. exclude '**/gen/**'
  113. reports {
  114. xml.enabled = false
  115. html.enabled = true
  116. xml {
  117. destination = file("$project.buildDir/reports/pmd/pmd.xml")
  118. }
  119. html {
  120. destination = file("$project.buildDir/reports/pmd/pmd.html")
  121. }
  122. }
  123. }
  124. task findbugs(type: FindBugs) {
  125. ignoreFailures = false
  126. effort = "max"
  127. reportLevel = "high"
  128. classes = files("$project.buildDir/intermediates/classes")
  129. excludeFilter = new File("${project.rootDir}/findbugs-filter.xml")
  130. source 'src'
  131. include '**/*.java'
  132. exclude '**/gen/**'
  133. reports {
  134. xml.enabled = false
  135. html.enabled = true
  136. html {
  137. destination = file("$project.buildDir/reports/findbugs/findbugs.html")
  138. }
  139. }
  140. classpath = files()
  141. }
  142. check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
  143. compileOptions {
  144. sourceCompatibility JavaVersion.VERSION_1_8
  145. targetCompatibility JavaVersion.VERSION_1_8
  146. }
  147. }
  148. dependencies {
  149. // dependencies for app building
  150. implementation 'com.android.support:multidex:1.0.2'
  151. // implementation project('nextcloud-android-library')
  152. implementation 'com.github.nextcloud:android-library:1.0.38'
  153. versionDevImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT' // use always latest master
  154. implementation "com.android.support:support-v4:${supportLibraryVersion}"
  155. implementation "com.android.support:design:${supportLibraryVersion}"
  156. implementation 'com.jakewharton:disklrucache:2.0.2'
  157. implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
  158. implementation "com.android.support:cardview-v7:${supportLibraryVersion}"
  159. implementation "com.android.support:exifinterface:${supportLibraryVersion}"
  160. implementation 'com.github.tobiasKaminsky:android-floating-action-button:1.10.2'
  161. implementation 'com.github.albfernandez:juniversalchardet:v2.0.0'
  162. implementation 'com.google.code.findbugs:annotations:2.0.1'
  163. implementation 'commons-io:commons-io:2.5'
  164. implementation 'com.github.evernote:android-job:v1.2.2'
  165. implementation 'com.jakewharton:butterknife:8.8.1'
  166. annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
  167. implementation 'org.greenrobot:eventbus:3.0.0'
  168. implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.2'
  169. implementation 'org.lukhnos:nnio:0.2'
  170. implementation 'com.madgag.spongycastle:pkix:1.54.0.0'
  171. implementation 'com.google.code.gson:gson:2.8.2'
  172. // uncomment for gplay
  173. // implementation "com.google.firebase:firebase-messaging:${googleLibraryVersion}"
  174. // implementation "com.google.android.gms:play-services-base:${googleLibraryVersion}"
  175. // implementation "com.google.android.gms:play-services-gcm:${googleLibraryVersion}"
  176. // implementation "com.google.firebase:firebase-core:${googleLibraryVersion}"
  177. implementation 'org.parceler:parceler-api:1.1.9'
  178. annotationProcessor 'org.parceler:parceler:1.1.9'
  179. implementation 'com.github.bumptech.glide:glide:3.7.0'
  180. implementation 'com.caverock:androidsvg:1.2.1'
  181. implementation "com.android.support:support-annotations:${supportLibraryVersion}"
  182. implementation 'com.google.code.gson:gson:2.8.2'
  183. // dependencies for local unit tests
  184. testImplementation 'junit:junit:4.12'
  185. testImplementation 'org.mockito:mockito-core:1.10.19'
  186. // dependencies for instrumented tests
  187. // JUnit4 Rules
  188. androidTestImplementation 'com.android.support.test:rules:1.0.1'
  189. // Android JUnit Runner
  190. androidTestImplementation 'com.android.support.test:runner:1.0.1'
  191. // Espresso core
  192. androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
  193. androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.1'
  194. // UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
  195. androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
  196. // fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
  197. //androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
  198. implementation 'org.jetbrains:annotations:15.0'
  199. androidTestCompile 'tools.fastlane:screengrab:1.0.0'
  200. }
  201. configurations.all {
  202. resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
  203. }
  204. tasks.withType(Test) {
  205. // increased logging for tests
  206. testLogging {
  207. events "passed", "skipped", "failed"
  208. }
  209. }
  210. // uncomment for gplay (must be at the bottom)
  211. //apply plugin: 'com.google.gms.google-services'