build.gradle 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
  2. buildscript {
  3. ext.kotlin_version = '1.8.10'
  4. ext.kotlin_coroutines_version = '1.6.4'
  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.0.2' // abi splits are broken in 8.1.2
  14. classpath 'org.owasp:dependency-check-gradle:6.5.3'
  15. classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
  16. // Huawei agconnect plugin
  17. classpath 'com.huawei.agconnect:agcp-1.9.1.301'
  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. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  22. // NOTE: Do not place your application dependencies here; they belong
  23. // in the individual module build.gradle files
  24. }
  25. }
  26. plugins {
  27. id 'jacoco'
  28. id 'org.sonarqube' version '4.4.1.3373'
  29. }
  30. allprojects {
  31. repositories {
  32. google()
  33. mavenCentral()
  34. maven { url 'https://jitpack.io' }
  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. tasks.withType(KotlinCompile).tap {
  73. configureEach {
  74. kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString()
  75. }
  76. }
  77. }
  78. subprojects {
  79. configurations.configureEach {
  80. resolutionStrategy {
  81. eachDependency { details ->
  82. if ('org.jacoco' == details.requested.group) {
  83. details.useVersion "0.8.7"
  84. }
  85. }
  86. }
  87. }
  88. }
  89. // task to gather code coverage from multiple subprojects
  90. // NOTE: the `JacocoReport` tasks do *not* depend on the `test` task by default. Meaning you have to ensure
  91. // that `test` (or other tasks generating code coverage) run before generating the report.
  92. tasks.register("codeCoverageReport", JacocoReport) {
  93. // If a subproject applies the 'jacoco' plugin, add the result it to the report
  94. subprojects { subproject ->
  95. subproject.plugins.withType(JacocoPlugin).configureEach {
  96. subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).configureEach { testTask ->
  97. sourceSets subproject.sourceSets.main
  98. executionData(testTask)
  99. }
  100. }
  101. }
  102. reports {
  103. xml.required = true
  104. }
  105. }