You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.gradle 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. import com.github.spotbugs.SpotBugsTask
  2. buildscript {
  3. ext {
  4. kotlin_version = '1.3.50'
  5. }
  6. repositories {
  7. google()
  8. jcenter()
  9. maven {
  10. url 'https://oss.sonatype.org/content/repositories/snapshots/'
  11. }
  12. maven {
  13. url 'https://plugins.gradle.org/m2/'
  14. }
  15. mavenCentral()
  16. }
  17. dependencies {
  18. classpath 'com.android.tools.build:gradle:3.5.0'
  19. classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
  20. classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6'
  21. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  22. classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.1"
  23. }
  24. }
  25. repositories {
  26. google()
  27. jcenter()
  28. }
  29. apply plugin: 'com.android.library'
  30. apply plugin: 'com.github.dcendents.android-maven'
  31. apply plugin: "com.github.spotbugs"
  32. apply plugin: "io.gitlab.arturbosch.detekt"
  33. group = 'com.github.nextcloud'
  34. spotbugs {
  35. toolVersion = '3.1.12'
  36. }
  37. configurations {
  38. ktlint
  39. }
  40. android {
  41. compileSdkVersion 28
  42. buildToolsVersion '28.0.3'
  43. defaultConfig {
  44. minSdkVersion 14
  45. targetSdkVersion 28
  46. versionCode 1
  47. versionName '1.0'
  48. }
  49. buildTypes {
  50. release {
  51. minifyEnabled false
  52. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  53. }
  54. }
  55. compileOptions {
  56. sourceCompatibility JavaVersion.VERSION_1_8
  57. targetCompatibility JavaVersion.VERSION_1_8
  58. }
  59. lintOptions {
  60. // translations are imported from transifex, so no need to check here
  61. disable 'MissingTranslation'
  62. disable 'ExtraTranslation'
  63. disable 'MissingQuantity'
  64. disable 'InconsistentArrays'
  65. disable 'TypographyEllipsis'
  66. disable 'GradleDependency'
  67. disable 'VectorPath'
  68. disable 'IconMissingDensityFolder'
  69. disable 'IconDensities'
  70. abortOnError false
  71. htmlReport true
  72. htmlOutput file("$project.buildDir/reports/lint/lint.html")
  73. }
  74. productFlavors {
  75. }
  76. tasks.register("spotbugsDebug", SpotBugsTask) {
  77. ignoreFailures = false
  78. effort = "max"
  79. reportLevel = "medium"
  80. classes = fileTree("$project.buildDir/intermediates/javac/debug/classes/")
  81. excludeFilter = file("${project.rootDir}/spotbugs-filter.xml")
  82. pluginClasspath = project.configurations.spotbugsPlugins
  83. source = fileTree('src/main/java')
  84. classpath = files()
  85. include '**/*.java'
  86. exclude '**/gen/**'
  87. reports {
  88. xml.enabled = false
  89. html.enabled = true
  90. html {
  91. destination = file("$project.buildDir/reports/spotbugs/spotbugs.html")
  92. }
  93. }
  94. }
  95. }
  96. task ktlint(type: JavaExec, group: "verification") {
  97. description = "Check Kotlin code style."
  98. main = "com.pinterest.ktlint.Main"
  99. classpath = configurations.ktlint
  100. args "--reporter=plain", "--reporter=plain,output=${buildDir}/ktlint.txt,src/**/*.kt"
  101. }
  102. task ktlintFormat(type: JavaExec, group: "formatting") {
  103. description = "Fix Kotlin code style deviations."
  104. main = "com.pinterest.ktlint.Main"
  105. classpath = configurations.ktlint
  106. args "-F", "src/**/*.kt"
  107. }
  108. detekt {
  109. reports {
  110. xml {
  111. enabled = false
  112. }
  113. }
  114. config = files("detekt.yml")
  115. input = files("src/")
  116. }
  117. dependencies {
  118. implementation "androidx.appcompat:appcompat:1.1.0"
  119. implementation 'androidx.annotation:annotation:1.1.0'
  120. implementation 'androidx.core:core:1.1.0'
  121. implementation 'androidx.fragment:fragment:1.1.0'
  122. api 'com.google.code.gson:gson:2.8.5'
  123. implementation 'io.reactivex.rxjava2:rxjava:2.2.12'
  124. implementation 'commons-io:commons-io:2.6'
  125. implementation 'com.squareup.retrofit2:retrofit:2.6.1'
  126. implementation 'com.squareup.okhttp3:okhttp:3.12.5' // 3.13+ requires Lollipop, but our minSdkVersion is 14
  127. spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.9.0'
  128. spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.6'
  129. ktlint "com.pinterest:ktlint:0.34.2"
  130. // Required for local unit tests (JUnit 4 framework)
  131. testImplementation 'junit:junit:4.12'
  132. // required if you want to use Mockito for unit tests
  133. testImplementation 'org.mockito:mockito-core:3.0.0'
  134. }