build.gradle 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  58. // arguments to be passed to functional tests
  59. testInstrumentationRunnerArgument "TEST_USER", "\"$System.env.OCTEST_APP_USERNAME\""
  60. testInstrumentationRunnerArgument "TEST_PASSWORD", "\"$System.env.OCTEST_APP_PASSWORD\""
  61. testInstrumentationRunnerArgument "TEST_SERVER_URL", "\"$System.env.OCTEST_SERVER_BASE_URL\""
  62. multiDexEnabled true
  63. versionCode = 20000099
  64. versionName = "2.0.0"
  65. // adapt structure from Eclipse to Gradle/Android Studio expectations;
  66. // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
  67. flavorDimensions "default"
  68. productFlavors {
  69. // used for f-droid
  70. generic {
  71. applicationId 'com.nextcloud.client'
  72. dimension "default"
  73. }
  74. gplay {
  75. applicationId 'com.nextcloud.client'
  76. dimension "default"
  77. }
  78. modified {
  79. // structure is:
  80. // domain tld
  81. // domain name
  82. // .client
  83. applicationId 'com.custom.client'
  84. dimension "default"
  85. }
  86. versionDev {
  87. applicationId "com.nextcloud.android.beta"
  88. dimension "default"
  89. versionCode 20171230
  90. versionName "20171230"
  91. }
  92. }
  93. configurations {
  94. modifiedCompile
  95. }
  96. }
  97. // adapt structure from Eclipse to Gradle/Android Studio expectations;
  98. // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
  99. dexOptions {
  100. // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
  101. preDexLibraries = preDexEnabled && !travisBuild
  102. }
  103. packagingOptions {
  104. exclude 'META-INF/LICENSE.txt'
  105. exclude 'META-INF/LICENSE'
  106. }
  107. task checkstyle(type: Checkstyle) {
  108. configFile = file("${rootProject.projectDir}/checkstyle.xml")
  109. configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
  110. source 'src'
  111. include '**/*.java'
  112. exclude '**/gen/**'
  113. classpath = files()
  114. }
  115. task pmd(type: Pmd) {
  116. ruleSetFiles = files("${project.rootDir}/pmd-ruleset.xml")
  117. ignoreFailures = false
  118. ruleSets = []
  119. source 'src'
  120. include '**/*.java'
  121. exclude '**/gen/**'
  122. reports {
  123. xml.enabled = false
  124. html.enabled = true
  125. xml {
  126. destination = file("$project.buildDir/reports/pmd/pmd.xml")
  127. }
  128. html {
  129. destination = file("$project.buildDir/reports/pmd/pmd.html")
  130. }
  131. }
  132. }
  133. task findbugs(type: FindBugs) {
  134. ignoreFailures = false
  135. effort = "max"
  136. reportLevel = "high"
  137. classes = files("$project.buildDir/intermediates/classes")
  138. excludeFilter = new File("${project.rootDir}/findbugs-filter.xml")
  139. source 'src'
  140. include '**/*.java'
  141. exclude '**/gen/**'
  142. reports {
  143. xml.enabled = false
  144. html.enabled = true
  145. html {
  146. destination = file("$project.buildDir/reports/findbugs/findbugs.html")
  147. }
  148. }
  149. classpath = files()
  150. }
  151. check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
  152. compileOptions {
  153. sourceCompatibility JavaVersion.VERSION_1_8
  154. targetCompatibility JavaVersion.VERSION_1_8
  155. }
  156. }
  157. dependencies {
  158. /// dependencies for app building
  159. implementation 'com.android.support:multidex:1.0.2'
  160. implementation 'com.github.nextcloud:android-library:1.0.33'
  161. versionDevImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT' // use always latest master
  162. implementation "com.android.support:support-v4:${supportLibraryVersion}"
  163. implementation "com.android.support:design:${supportLibraryVersion}"
  164. implementation 'com.jakewharton:disklrucache:2.0.2'
  165. implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
  166. implementation "com.android.support:cardview-v7:${supportLibraryVersion}"
  167. implementation "com.android.support:exifinterface:${supportLibraryVersion}"
  168. implementation 'com.github.tobiasKaminsky:android-floating-action-button:1.10.2'
  169. implementation 'com.github.albfernandez:juniversalchardet:v2.0.0'
  170. implementation 'com.google.code.findbugs:annotations:2.0.1'
  171. implementation 'commons-io:commons-io:2.5'
  172. implementation 'com.github.evernote:android-job:v1.2.0'
  173. implementation 'com.jakewharton:butterknife:8.5.1'
  174. annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
  175. implementation 'org.greenrobot:eventbus:3.0.0'
  176. implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.2'
  177. implementation 'org.lukhnos:nnio:0.2'
  178. // uncomment for gplay, modified
  179. // implementation "com.google.firebase:firebase-messaging:${googleLibraryVersion}"
  180. // implementation "com.google.android.gms:play-services-base:${googleLibraryVersion}"
  181. // implementation "com.google.android.gms:play-services-gcm:${googleLibraryVersion}"
  182. // implementation "com.google.firebase:firebase-core:${googleLibraryVersion}"
  183. implementation 'org.parceler:parceler-api:1.1.6'
  184. annotationProcessor 'org.parceler:parceler:1.1.6'
  185. implementation 'com.github.bumptech.glide:glide:3.7.0'
  186. implementation 'com.caverock:androidsvg:1.2.1'
  187. implementation "com.android.support:support-annotations:${supportLibraryVersion}"
  188. /// dependencies for local unit tests
  189. testImplementation 'junit:junit:4.12'
  190. testImplementation 'org.mockito:mockito-core:1.10.19'
  191. /// dependencies for instrumented tests
  192. // JUnit4 Rules
  193. androidTestImplementation 'com.android.support.test:rules:1.0.1'
  194. // Android JUnit Runner
  195. androidTestImplementation 'com.android.support.test:runner:1.0.1'
  196. // Espresso core
  197. androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
  198. androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.1'
  199. // UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
  200. //androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
  201. // fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
  202. //androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
  203. implementation 'org.jetbrains:annotations:15.0'
  204. androidTestCompile 'tools.fastlane:screengrab:1.0.0'
  205. }
  206. configurations.all {
  207. resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
  208. }
  209. tasks.withType(Test) {
  210. /// increased logging for tests
  211. testLogging {
  212. events "passed", "skipped", "failed"
  213. }
  214. }
  215. // uncomment for gplay, modified (must be at the bottom)
  216. //apply plugin: 'com.google.gms.google-services'