build.gradle 3.2 KB

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