build.gradle 8.8 KB

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