build.gradle 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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:2.3.0'
  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. ext {
  24. supportLibraryVersion = '25.0.0'
  25. travisBuild = System.getenv("TRAVIS") == "true"
  26. // allows for -Dpre-dex=false to be set
  27. preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
  28. }
  29. repositories {
  30. jcenter()
  31. maven { url "https://jitpack.io" }
  32. flatDir {
  33. dirs 'libs'
  34. }
  35. }
  36. android {
  37. lintOptions {
  38. abortOnError true
  39. lintConfig file("${project.rootDir}/lint.xml")
  40. htmlReport true
  41. htmlOutput file("$project.buildDir/reports/lint/lint.html")
  42. }
  43. dexOptions {
  44. javaMaxHeapSize "4g"
  45. }
  46. compileSdkVersion 24
  47. buildToolsVersion '25.0.0'
  48. defaultConfig {
  49. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  50. // arguments to be passed to functional tests
  51. testInstrumentationRunnerArgument "TEST_USER", "\"$System.env.OCTEST_APP_USERNAME\""
  52. testInstrumentationRunnerArgument "TEST_PASSWORD", "\"$System.env.OCTEST_APP_PASSWORD\""
  53. testInstrumentationRunnerArgument "TEST_SERVER_URL", "\"$System.env.OCTEST_SERVER_BASE_URL\""
  54. multiDexEnabled true
  55. // adapt structure from Eclipse to Gradle/Android Studio expectations;
  56. // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
  57. productFlavors {
  58. generic {
  59. applicationId 'com.nextcloud.client'
  60. }
  61. modified {
  62. // structure is:
  63. // domain tld
  64. // domain name
  65. // .client
  66. applicationId 'com.custom.client'
  67. }
  68. }
  69. configurations {
  70. modifiedCompile
  71. }
  72. }
  73. // adapt structure from Eclipse to Gradle/Android Studio expectations;
  74. // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
  75. dexOptions {
  76. // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
  77. preDexLibraries = preDexEnabled && !travisBuild
  78. }
  79. compileOptions {
  80. sourceCompatibility JavaVersion.VERSION_1_7
  81. targetCompatibility JavaVersion.VERSION_1_7
  82. }
  83. lintOptions {
  84. abortOnError false
  85. }
  86. packagingOptions {
  87. exclude 'META-INF/LICENSE.txt'
  88. }
  89. task checkstyle(type: Checkstyle) {
  90. configFile = file("${rootProject.projectDir}/checkstyle.xml")
  91. configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
  92. source 'src'
  93. include '**/*.java'
  94. exclude '**/gen/**'
  95. classpath = files()
  96. }
  97. task pmd(type: Pmd) {
  98. ruleSetFiles = files("${project.rootDir}/pmd-ruleset.xml")
  99. ignoreFailures = false
  100. ruleSets = []
  101. source 'src'
  102. include '**/*.java'
  103. exclude '**/gen/**'
  104. reports {
  105. xml.enabled = false
  106. html.enabled = true
  107. xml {
  108. destination "$project.buildDir/reports/pmd/pmd.xml"
  109. }
  110. html {
  111. destination "$project.buildDir/reports/pmd/pmd.html"
  112. }
  113. }
  114. }
  115. task findbugs(type: FindBugs) {
  116. ignoreFailures = false
  117. effort = "max"
  118. reportLevel = "high"
  119. classes = files("$project.buildDir/intermediates/classes")
  120. excludeFilter = new File("${project.rootDir}/findbugs-filter.xml")
  121. source 'src'
  122. include '**/*.java'
  123. exclude '**/gen/**'
  124. reports {
  125. xml.enabled = false
  126. html.enabled = true
  127. html {
  128. destination "$project.buildDir/reports/findbugs/findbugs.html"
  129. }
  130. }
  131. classpath = files()
  132. }
  133. check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
  134. }
  135. dependencies {
  136. /// dependencies for app building
  137. compile name: 'touch-image-view'
  138. compile 'com.android.support:multidex:1.0.1'
  139. compile 'com.github.nextcloud:android-library:1.0.11'
  140. compile "com.android.support:support-v4:${supportLibraryVersion}"
  141. compile "com.android.support:design:${supportLibraryVersion}"
  142. compile 'com.jakewharton:disklrucache:2.0.2'
  143. compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
  144. compile "com.android.support:cardview-v7:${supportLibraryVersion}"
  145. compile 'com.getbase:floatingactionbutton:1.10.1'
  146. compile 'com.google.code.findbugs:annotations:2.0.1'
  147. compile group: 'commons-io', name: 'commons-io', version: '2.4'
  148. compile 'com.google.android.gms:play-services:10.2.0'
  149. compile 'com.github.evernote:android-job:v1.1.8'
  150. compile 'com.jakewharton:butterknife:8.4.0'
  151. annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
  152. /// dependencies for local unit tests
  153. testCompile 'junit:junit:4.12'
  154. testCompile 'org.mockito:mockito-core:1.10.19'
  155. /// dependencies for instrumented tests
  156. // JUnit4 Rules
  157. androidTestCompile 'com.android.support.test:rules:0.5'
  158. // Android JUnit Runner
  159. androidTestCompile 'com.android.support.test:runner:0.5'
  160. // Android Annotation Support
  161. androidTestCompile "com.android.support:support-annotations:25.0.0"
  162. // Espresso core
  163. androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
  164. // UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
  165. //androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
  166. // fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
  167. //androidTestCompile "com.android.support:support-annotations:${supportLibraryVersion}"
  168. }
  169. tasks.withType(Test) {
  170. /// increased logging for tests
  171. testLogging {
  172. events "passed", "skipped", "failed"
  173. }
  174. }
  175. apply plugin: 'com.google.gms.google-services'