build.gradle 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
  2. buildscript {
  3. ext.kotlin_version = '1.9.21'
  4. ext.kotlin_coroutines_version = '1.8.1'
  5. ext.slf4j_version = '1.7.36'
  6. ext.junit_version = '4.13.2'
  7. repositories {
  8. google()
  9. mavenCentral()
  10. flatDir { dirs 'app/libs' }
  11. }
  12. dependencies {
  13. classpath 'com.android.tools.build:gradle:8.5.2'
  14. classpath 'org.owasp:dependency-check-gradle:10.0.4'
  15. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  16. // Huawei agconnect plugin
  17. classpath 'com.huawei.agconnect:agcp-1.9.1.303'
  18. classpath 'com.huawei.agconnect:agconnect-crash-symbol-lib-1.9.1.301'
  19. classpath 'com.huawei.agconnect:agconnect-apms-plugin-1.6.2.300'
  20. classpath 'com.huawei.agconnect:agconnect-core-1.9.1.301@aar'
  21. // NOTE: Do not place your application dependencies here; they belong
  22. // in the individual module build.gradle files
  23. }
  24. }
  25. plugins {
  26. id 'jacoco'
  27. id 'org.sonarqube' version '4.4.1.3373'
  28. }
  29. allprojects {
  30. repositories {
  31. google()
  32. mavenCentral()
  33. maven { url 'https://jitpack.io' }
  34. flatDir { dirs 'libs' }
  35. // Huawei
  36. exclusiveContent {
  37. forRepository {
  38. maven { url 'https://developer.huawei.com/repo/' }
  39. }
  40. filter {
  41. // Only matching dependencies will be installed from this repository.
  42. includeGroup "com.huawei.hms"
  43. includeGroup "com.huawei.android.hms"
  44. includeGroup "com.huawei.hmf"
  45. }
  46. }
  47. }
  48. // OWASP dependency-check-gradle plugin
  49. apply plugin: 'org.owasp.dependencycheck'
  50. dependencyCheck {
  51. skipConfigurations += 'lintClassPath'
  52. suppressionFile 'dependencyCheckSuppressions.xml'
  53. // Fail dependency check if any dependency has a CVE with a score of 3+
  54. failBuildOnCVSS 3
  55. // NVD API config. The key is not very secret, but please don't mis-use it.
  56. nvd {
  57. apiKey = "fc7aab31-d936-4807-b43b-e061c84a12dd"
  58. validForHours = 6
  59. }
  60. }
  61. group = 'ch.threema'
  62. }
  63. wrapper {
  64. distributionType = Wrapper.DistributionType.ALL
  65. }
  66. sonarqube {
  67. properties {
  68. property 'sonar.projectKey', 'android-client'
  69. property 'sonar.projectName', 'Threema for Android'
  70. }
  71. }
  72. jacoco {
  73. toolVersion = '0.8.7'
  74. }
  75. subprojects {
  76. tasks.withType(KotlinCompile).tap {
  77. configureEach {
  78. kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString()
  79. }
  80. }
  81. }
  82. subprojects {
  83. configurations.configureEach {
  84. resolutionStrategy {
  85. eachDependency { details ->
  86. if ('org.jacoco' == details.requested.group) {
  87. details.useVersion "0.8.7"
  88. }
  89. }
  90. }
  91. }
  92. }
  93. // task to gather code coverage from multiple subprojects
  94. // NOTE: the `JacocoReport` tasks do *not* depend on the `test` task by default. Meaning you have to ensure
  95. // that `test` (or other tasks generating code coverage) run before generating the report.
  96. tasks.register("codeCoverageReport", JacocoReport) {
  97. // If a subproject applies the 'jacoco' plugin, add the result it to the report
  98. subprojects { subproject ->
  99. subproject.plugins.withType(JacocoPlugin).configureEach {
  100. subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).configureEach { testTask ->
  101. sourceSets subproject.sourceSets.main
  102. executionData(testTask)
  103. }
  104. }
  105. }
  106. reports {
  107. xml.required = true
  108. }
  109. }