build.gradle 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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.0-beta4'
  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 = '25.4.0'
  30. googleLibraryVersion = '10.2.4'
  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 {
  39. url 'https://oss.sonatype.org/content/repositories/snapshots/'
  40. }
  41. google()
  42. flatDir {
  43. dirs 'libs'
  44. }
  45. }
  46. android {
  47. lintOptions {
  48. abortOnError false
  49. htmlReport true
  50. htmlOutput file("$project.buildDir/reports/lint/lint.html")
  51. disable 'MissingTranslation'
  52. }
  53. dexOptions {
  54. javaMaxHeapSize "4g"
  55. }
  56. compileSdkVersion 25
  57. buildToolsVersion '25.0.2'
  58. defaultConfig {
  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. // 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. }
  87. configurations {
  88. modifiedCompile
  89. }
  90. }
  91. // adapt structure from Eclipse to Gradle/Android Studio expectations;
  92. // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
  93. dexOptions {
  94. // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
  95. preDexLibraries = preDexEnabled && !travisBuild
  96. }
  97. packagingOptions {
  98. exclude 'META-INF/LICENSE.txt'
  99. exclude 'META-INF/LICENSE'
  100. }
  101. task checkstyle(type: Checkstyle) {
  102. configFile = file("${rootProject.projectDir}/checkstyle.xml")
  103. configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
  104. source 'src'
  105. include '**/*.java'
  106. exclude '**/gen/**'
  107. classpath = files()
  108. }
  109. task pmd(type: Pmd) {
  110. ruleSetFiles = files("${project.rootDir}/pmd-ruleset.xml")
  111. ignoreFailures = false
  112. ruleSets = []
  113. source 'src'
  114. include '**/*.java'
  115. exclude '**/gen/**'
  116. reports {
  117. xml.enabled = false
  118. html.enabled = true
  119. xml {
  120. destination = file("$project.buildDir/reports/pmd/pmd.xml")
  121. }
  122. html {
  123. destination = file("$project.buildDir/reports/pmd/pmd.html")
  124. }
  125. }
  126. }
  127. task findbugs(type: FindBugs) {
  128. ignoreFailures = false
  129. effort = "max"
  130. reportLevel = "high"
  131. classes = files("$project.buildDir/intermediates/classes")
  132. excludeFilter = new File("${project.rootDir}/findbugs-filter.xml")
  133. source 'src'
  134. include '**/*.java'
  135. exclude '**/gen/**'
  136. reports {
  137. xml.enabled = false
  138. html.enabled = true
  139. html {
  140. destination = file("$project.buildDir/reports/findbugs/findbugs.html")
  141. }
  142. }
  143. classpath = files()
  144. }
  145. check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
  146. compileOptions {
  147. sourceCompatibility JavaVersion.VERSION_1_8
  148. targetCompatibility JavaVersion.VERSION_1_8
  149. }
  150. }
  151. dependencies {
  152. /// dependencies for app building
  153. implementation name: 'touch-image-view'
  154. implementation 'com.android.support:multidex:1.0.2'
  155. implementation 'com.github.nextcloud:android-library:1.0.26'
  156. implementation "com.android.support:support-v4:${supportLibraryVersion}"
  157. implementation "com.android.support:design:${supportLibraryVersion}"
  158. implementation 'com.jakewharton:disklrucache:2.0.2'
  159. implementation "com.android.support:appcompat-v7:${supportLibraryVersion}"
  160. implementation "com.android.support:cardview-v7:${supportLibraryVersion}"
  161. implementation "com.android.support:exifinterface:${supportLibraryVersion}"
  162. implementation 'com.github.tobiasKaminsky:android-floating-action-button:1.10.2'
  163. implementation 'com.google.code.findbugs:annotations:2.0.1'
  164. implementation 'commons-io:commons-io:2.5'
  165. implementation 'com.github.evernote:android-job:v1.1.11'
  166. implementation 'com.jakewharton:butterknife:8.5.1'
  167. annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
  168. implementation 'org.greenrobot:eventbus:3.0.0'
  169. implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.2'
  170. implementation 'org.lukhnos:nnio:0.2'
  171. // uncomment for gplay, modified
  172. // implementation "com.google.firebase:firebase-messaging:${googleLibraryVersion}"
  173. // implementation "com.google.android.gms:play-services-base:${googleLibraryVersion}"
  174. // implementation "com.google.android.gms:play-services-gcm:${googleLibraryVersion}"
  175. // implementation "com.google.firebase:firebase-core:${googleLibraryVersion}"
  176. implementation 'org.parceler:parceler-api:1.1.6'
  177. annotationProcessor 'org.parceler:parceler:1.1.6'
  178. implementation 'com.github.bumptech.glide:glide:3.7.0'
  179. implementation 'com.caverock:androidsvg:1.2.1'
  180. implementation "com.android.support:support-annotations:${supportLibraryVersion}"
  181. /// dependencies for local unit tests
  182. testImplementation 'junit:junit:4.12'
  183. testImplementation 'org.mockito:mockito-core:1.10.19'
  184. /// dependencies for instrumented tests
  185. // JUnit4 Rules
  186. androidTestImplementation 'com.android.support.test:rules:1.0.0'
  187. // Android JUnit Runner
  188. androidTestImplementation 'com.android.support.test:runner:1.0.0'
  189. // Espresso core
  190. androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.0'
  191. // UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
  192. //androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
  193. // fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
  194. //androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
  195. implementation 'org.jetbrains:annotations:15.0'
  196. }
  197. configurations.all {
  198. resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
  199. }
  200. tasks.withType(Test) {
  201. /// increased logging for tests
  202. testLogging {
  203. events "passed", "skipped", "failed"
  204. }
  205. }
  206. // uncomment for gplay, modified (must be at the bottom)
  207. //apply plugin: 'com.google.gms.google-services'