build.gradle 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. buildscript {
  2. ext.kotlin_version = '1.7.20'
  3. ext.kotlin_coroutines_version = '1.6.4'
  4. ext.slf4j_version = '1.7.36'
  5. ext.junit_version = '4.13.2'
  6. repositories {
  7. google()
  8. mavenCentral()
  9. flatDir { dirs 'app/libs' }
  10. }
  11. dependencies {
  12. classpath 'com.android.tools.build:gradle:7.3.1'
  13. classpath 'org.owasp:dependency-check-gradle:6.5.3'
  14. classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
  15. // Huawei agconnect plugin
  16. classpath 'com.huawei.agconnect:agcp-1.6.0.300'
  17. classpath 'com.huawei.agconnect:agconnect-crash-symbol-lib-1.6.0.300'
  18. classpath 'com.huawei.agconnect:agconnect-apms-plugin-1.5.2.302'
  19. classpath 'com.huawei.agconnect:agconnect-core-1.5.0.300@aar'
  20. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  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 '3.0'
  28. }
  29. allprojects {
  30. repositories {
  31. google()
  32. mavenCentral()
  33. maven { url 'https://jitpack.io' }
  34. jcenter() // TODO(ANDR-2023): Remove repository
  35. flatDir { dirs 'libs' }
  36. // Huawei
  37. exclusiveContent {
  38. forRepository {
  39. maven { url 'https://developer.huawei.com/repo/' }
  40. }
  41. filter {
  42. // Only matching dependencies will be installed from this repository.
  43. includeGroup "com.huawei.hms"
  44. includeGroup "com.huawei.android.hms"
  45. includeGroup "com.huawei.hmf"
  46. }
  47. }
  48. }
  49. // OWASP dependency-check-gradle plugin
  50. apply plugin: 'org.owasp.dependencycheck'
  51. dependencyCheck {
  52. skipConfigurations += 'lintClassPath'
  53. suppressionFile 'dependencyCheckSuppressions.xml'
  54. // Fail dependency check if any dependency has a CVE with a score of 3+
  55. failBuildOnCVSS 3
  56. }
  57. group = 'ch.threema'
  58. }
  59. wrapper {
  60. distributionType = Wrapper.DistributionType.ALL
  61. }
  62. sonarqube {
  63. properties {
  64. property 'sonar.projectKey', 'android-client'
  65. property 'sonar.projectName', 'Threema for Android'
  66. }
  67. }
  68. jacoco {
  69. toolVersion = '0.8.7'
  70. }
  71. subprojects {
  72. configurations.all {
  73. resolutionStrategy {
  74. eachDependency { details ->
  75. if ('org.jacoco' == details.requested.group) {
  76. details.useVersion "0.8.7"
  77. }
  78. }
  79. }
  80. }
  81. }
  82. // task to gather code coverage from multiple subprojects
  83. // NOTE: the `JacocoReport` tasks do *not* depend on the `test` task by default. Meaning you have to ensure
  84. // that `test` (or other tasks generating code coverage) run before generating the report.
  85. tasks.register("codeCoverageReport", JacocoReport) {
  86. // If a subproject applies the 'jacoco' plugin, add the result it to the report
  87. subprojects { subproject ->
  88. subproject.plugins.withType(JacocoPlugin).configureEach {
  89. subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).configureEach { testTask ->
  90. sourceSets subproject.sourceSets.main
  91. executionData(testTask)
  92. }
  93. }
  94. }
  95. reports {
  96. xml.enabled true
  97. }
  98. }