build.gradle 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. }
  14. dependencies {
  15. classpath 'com.android.tools.build:gradle:3.0.0-alpha9'
  16. classpath 'com.google.gms:google-services:3.0.0'
  17. }
  18. }
  19. apply plugin: 'com.android.application'
  20. apply plugin: 'checkstyle'
  21. apply plugin: 'pmd'
  22. apply plugin: 'findbugs'
  23. configurations.all {
  24. // check for updates every build
  25. resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
  26. }
  27. ext {
  28. supportLibraryVersion = '25.2.0'
  29. googleLibraryVersion = '10.2.4'
  30. travisBuild = System.getenv("TRAVIS") == "true"
  31. // allows for -Dpre-dex=false to be set
  32. preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
  33. }
  34. repositories {
  35. jcenter()
  36. maven { url "https://jitpack.io" }
  37. maven {
  38. url 'https://oss.sonatype.org/content/repositories/snapshots/'
  39. }
  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 25
  55. buildToolsVersion '25.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. // adapt structure from Eclipse to Gradle/Android Studio expectations;
  64. // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
  65. flavorDimensions "default"
  66. productFlavors {
  67. // used for f-droid
  68. generic {
  69. applicationId 'com.nextcloud.client'
  70. dimension "default"
  71. }
  72. gplay {
  73. applicationId 'com.nextcloud.client'
  74. dimension "default"
  75. }
  76. modified {
  77. // structure is:
  78. // domain tld
  79. // domain name
  80. // .client
  81. applicationId 'com.custom.client'
  82. dimension "default"
  83. }
  84. }
  85. configurations {
  86. modifiedCompile
  87. }
  88. }
  89. // adapt structure from Eclipse to Gradle/Android Studio expectations;
  90. // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
  91. dexOptions {
  92. // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
  93. preDexLibraries = preDexEnabled && !travisBuild
  94. }
  95. packagingOptions {
  96. exclude 'META-INF/LICENSE.txt'
  97. exclude 'META-INF/LICENSE'
  98. }
  99. task checkstyle(type: Checkstyle) {
  100. configFile = file("${rootProject.projectDir}/checkstyle.xml")
  101. configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
  102. source 'src'
  103. include '**/*.java'
  104. exclude '**/gen/**'
  105. classpath = files()
  106. }
  107. task pmd(type: Pmd) {
  108. ruleSetFiles = files("${project.rootDir}/pmd-ruleset.xml")
  109. ignoreFailures = false
  110. ruleSets = []
  111. source 'src'
  112. include '**/*.java'
  113. exclude '**/gen/**'
  114. reports {
  115. xml.enabled = false
  116. html.enabled = true
  117. xml {
  118. destination "$project.buildDir/reports/pmd/pmd.xml"
  119. }
  120. html {
  121. destination "$project.buildDir/reports/pmd/pmd.html"
  122. }
  123. }
  124. }
  125. task findbugs(type: FindBugs) {
  126. ignoreFailures = false
  127. effort = "max"
  128. reportLevel = "high"
  129. classes = files("$project.buildDir/intermediates/classes")
  130. excludeFilter = new File("${project.rootDir}/findbugs-filter.xml")
  131. source 'src'
  132. include '**/*.java'
  133. exclude '**/gen/**'
  134. reports {
  135. xml.enabled = false
  136. html.enabled = true
  137. html {
  138. destination "$project.buildDir/reports/findbugs/findbugs.html"
  139. }
  140. }
  141. classpath = files()
  142. }
  143. check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
  144. compileOptions {
  145. sourceCompatibility JavaVersion.VERSION_1_8
  146. targetCompatibility JavaVersion.VERSION_1_8
  147. }
  148. }
  149. dependencies {
  150. /// dependencies for app building
  151. compile name: 'touch-image-view'
  152. compile 'com.android.support:multidex:1.0.1'
  153. compile 'com.github.nextcloud:android-library:1.0.23'
  154. compile "com.android.support:support-v4:${supportLibraryVersion}"
  155. compile "com.android.support:design:${supportLibraryVersion}"
  156. compile 'com.jakewharton:disklrucache:2.0.2'
  157. compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
  158. compile "com.android.support:cardview-v7:${supportLibraryVersion}"
  159. compile 'com.github.tobiasKaminsky:android-floating-action-button:1.10.2'
  160. compile 'com.google.code.findbugs:annotations:2.0.1'
  161. compile 'commons-io:commons-io:2.5'
  162. compile 'com.github.evernote:android-job:v1.1.11'
  163. compile 'com.jakewharton:butterknife:8.5.1'
  164. annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
  165. compile 'org.greenrobot:eventbus:3.0.0'
  166. compile 'com.googlecode.ez-vcard:ez-vcard:0.10.2'
  167. compile 'org.lukhnos:nnio:0.2'
  168. // uncomment for gplay, modified
  169. // compile "com.google.firebase:firebase-messaging:${googleLibraryVersion}"
  170. // compile "com.google.android.gms:play-services-base:${googleLibraryVersion}"
  171. compile 'org.parceler:parceler-api:1.1.6'
  172. annotationProcessor 'org.parceler:parceler:1.1.6'
  173. compile 'com.github.bumptech.glide:glide:3.7.0'
  174. compile 'com.caverock:androidsvg:1.2.1'
  175. /// dependencies for local unit tests
  176. testCompile 'junit:junit:4.12'
  177. testCompile 'org.mockito:mockito-core:1.10.19'
  178. /// dependencies for instrumented tests
  179. // JUnit4 Rules
  180. androidTestCompile 'com.android.support.test:rules:0.5'
  181. // Android JUnit Runner
  182. androidTestCompile 'com.android.support.test:runner:0.5'
  183. // Android Annotation Support
  184. androidTestCompile "com.android.support:support-annotations:${supportLibraryVersion}"
  185. // Espresso core
  186. androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
  187. // UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
  188. //androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
  189. // fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
  190. //androidTestCompile "com.android.support:support-annotations:${supportLibraryVersion}"
  191. compile 'org.jetbrains:annotations:15.0'
  192. }
  193. configurations.all {
  194. resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
  195. }
  196. tasks.withType(Test) {
  197. /// increased logging for tests
  198. testLogging {
  199. events "passed", "skipped", "failed"
  200. }
  201. }
  202. // uncomment for gplay, modified (must be at the bottom)
  203. //apply plugin: 'com.google.gms.google-services'