build.gradle.modified 7.2 KB

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