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.
 
 
 
 
 
 

203 lines
6.5 KiB

  1. // Top-level build file where you can add configuration options common to all sub-projects/modules.
  2. import org.mozilla.fenix.gradle.tasks.GithubDetailsTask
  3. buildscript {
  4. // This logic is duplicated in the allprojects block: I don't know how to fix that.
  5. repositories {
  6. maven {
  7. name "Mozilla Nightly"
  8. url "https://nightly.maven.mozilla.org/maven2"
  9. content {
  10. // Improve performance: only check moz maven for mozilla deps.
  11. includeGroupByRegex RepoMatching.mozilla
  12. }
  13. }
  14. maven {
  15. name "Mozilla"
  16. url "https://maven.mozilla.org/maven2"
  17. content {
  18. // Improve performance: only check moz maven for mozilla deps.
  19. includeGroupByRegex RepoMatching.mozilla
  20. }
  21. }
  22. if (project.hasProperty("googleRepo")) {
  23. maven {
  24. name "Google"
  25. url project.property("googleRepo")
  26. }
  27. } else {
  28. google() {
  29. content {
  30. // Improve performance: only check google maven for mozilla deps.
  31. includeGroupByRegex RepoMatching.androidx
  32. includeGroupByRegex RepoMatching.comGoogleAndroid
  33. includeGroupByRegex RepoMatching.comGoogleFirebase
  34. includeGroupByRegex RepoMatching.comAndroid
  35. }
  36. }
  37. }
  38. if (project.hasProperty("jcenterRepo")) {
  39. maven {
  40. name "BintrayJCenter"
  41. url project.property("jcenterRepo")
  42. }
  43. } else {
  44. jcenter() {
  45. content {
  46. // Improve security: don't search deps with known repos.
  47. excludeGroupByRegex RepoMatching.mozilla
  48. excludeGroupByRegex RepoMatching.androidx
  49. excludeGroupByRegex RepoMatching.comGoogleAndroid
  50. excludeGroupByRegex RepoMatching.comGoogleFirebase
  51. excludeGroupByRegex RepoMatching.comAndroid
  52. }
  53. }
  54. }
  55. }
  56. dependencies {
  57. classpath Deps.tools_androidgradle
  58. classpath Deps.tools_kotlingradle
  59. classpath Deps.androidx_safeargs
  60. classpath Deps.allopen
  61. classpath Deps.osslicenses_plugin
  62. classpath "org.mozilla.components:tooling-glean-gradle:${Versions.mozilla_android_components}"
  63. // NOTE: Do not place your application dependencies here; they belong
  64. // in the individual module build.gradle files
  65. }
  66. }
  67. plugins {
  68. id("io.gitlab.arturbosch.detekt").version("1.9.1")
  69. }
  70. allprojects {
  71. // This logic is duplicated in the buildscript block: I don't know how to fix that.
  72. repositories {
  73. maven {
  74. name "Mozilla Nightly"
  75. url "https://nightly.maven.mozilla.org/maven2"
  76. content {
  77. // Improve performance: only check moz maven for mozilla deps.
  78. includeGroupByRegex RepoMatching.mozilla
  79. }
  80. }
  81. maven {
  82. name "Mozilla"
  83. url "https://maven.mozilla.org/maven2"
  84. content {
  85. // Improve performance: only check moz maven for mozilla deps.
  86. includeGroupByRegex RepoMatching.mozilla
  87. }
  88. }
  89. if (project.hasProperty("googleRepo")) {
  90. maven {
  91. name "Google"
  92. url project.property("googleRepo")
  93. }
  94. } else {
  95. google() {
  96. content {
  97. // Improve performance: only check google maven for mozilla deps.
  98. includeGroupByRegex RepoMatching.androidx
  99. includeGroupByRegex RepoMatching.comGoogleAndroid
  100. includeGroupByRegex RepoMatching.comGoogleFirebase
  101. includeGroupByRegex RepoMatching.comAndroid
  102. }
  103. }
  104. }
  105. if (project.hasProperty("jcenterRepo")) {
  106. maven {
  107. name "BintrayJCenter"
  108. url project.property("jcenterRepo")
  109. }
  110. } else {
  111. jcenter() {
  112. content {
  113. // Improve security: don't search deps with known repos.
  114. excludeGroupByRegex RepoMatching.mozilla
  115. excludeGroupByRegex RepoMatching.androidx
  116. excludeGroupByRegex RepoMatching.comGoogleAndroid
  117. excludeGroupByRegex RepoMatching.comGoogleFirebase
  118. excludeGroupByRegex RepoMatching.comAndroid
  119. }
  120. }
  121. }
  122. }
  123. tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
  124. kotlinOptions.jvmTarget = "1.8"
  125. kotlinOptions.allWarningsAsErrors = true
  126. kotlinOptions.freeCompilerArgs += [
  127. "-Xuse-experimental=kotlin.Experimental"
  128. ]
  129. }
  130. }
  131. task clean(type: Delete) {
  132. delete rootProject.buildDir
  133. }
  134. detekt {
  135. // The version number is duplicated, please refer to plugins block for more details
  136. version = "1.9.1"
  137. input = files("$projectDir/app/src")
  138. config = files("$projectDir/config/detekt.yml")
  139. reports {
  140. html {
  141. enabled = true
  142. destination = file("$projectDir/build/reports/detekt.html")
  143. }
  144. xml {
  145. enabled = false
  146. }
  147. }
  148. }
  149. configurations {
  150. ktlint
  151. }
  152. dependencies {
  153. ktlint "com.pinterest:ktlint:0.34.2"
  154. detekt project(":mozilla-detekt-rules")
  155. detekt "io.gitlab.arturbosch.detekt:detekt-cli:${Versions.detekt}"
  156. }
  157. task ktlint(type: JavaExec, group: "verification") {
  158. description = "Check Kotlin code style."
  159. classpath = configurations.ktlint
  160. main = "com.pinterest.ktlint.Main"
  161. args "app/src/**/*.kt"
  162. }
  163. tasks.withType(io.gitlab.arturbosch.detekt.Detekt.class) {
  164. exclude("**/resources/**")
  165. exclude("**/test/**")
  166. exclude("**/tmp/**")
  167. }
  168. tasks.register("listRepositories") {
  169. doLast {
  170. println "Repositories:"
  171. project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
  172. }
  173. }
  174. tasks.register("githubTestDetails", GithubDetailsTask) {
  175. text = "### [Unit Test Results]({reportsUrl}/test/testDebugUnitTest/index.html)"
  176. }
  177. tasks.register("githubLintDetektDetails", GithubDetailsTask) {
  178. text = "### [Detekt Results]({reportsUrl}/detekt.html)"
  179. }
  180. tasks.register("githubLintAndroidDetails", GithubDetailsTask) {
  181. text = "### [Android Lint Results]({reportsUrl}/lint-results-debug.html)"
  182. }