SchildiChat-android/build.gradle

369 lines
14 KiB
Groovy
Raw Normal View History

2018-10-03 18:56:33 +03:00
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
2021-09-15 12:28:58 +03:00
apply from: 'dependencies.gradle'
2021-12-10 23:19:43 +03:00
apply from: 'dependencies_groups.gradle'
2021-09-15 12:28:58 +03:00
2018-10-03 18:56:33 +03:00
repositories {
// Do not use `google()`, it prevents Dependabot from working properly
maven {
url 'https://maven.google.com'
}
2019-03-18 18:53:52 +03:00
maven {
url "https://plugins.gradle.org/m2/"
2019-05-07 15:02:15 +03:00
}
Bump dagger from 2.41 to 2.42 (#5998) * Bump dagger from 2.41 to 2.42 Bumps `dagger` from 2.41 to 2.42. Updates `hilt-android-gradle-plugin` from 2.41 to 2.42 - [Release notes](https://github.com/google/dagger/releases) - [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/dagger/compare/dagger-2.41...dagger-2.42) Updates `dagger` from 2.41 to 2.42 - [Release notes](https://github.com/google/dagger/releases) - [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/dagger/compare/dagger-2.41...dagger-2.42) Updates `dagger-compiler` from 2.41 to 2.42 - [Release notes](https://github.com/google/dagger/releases) - [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/dagger/compare/dagger-2.41...dagger-2.42) Updates `hilt-android` from 2.41 to 2.42 - [Release notes](https://github.com/google/dagger/releases) - [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/dagger/compare/dagger-2.41...dagger-2.42) Updates `hilt-compiler` from 2.41 to 2.42 - [Release notes](https://github.com/google/dagger/releases) - [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md) - [Commits](https://github.com/google/dagger/compare/dagger-2.41...dagger-2.42) --- updated-dependencies: - dependency-name: com.google.dagger:hilt-android-gradle-plugin dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.google.dagger:dagger dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.google.dagger:dagger-compiler dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.google.dagger:hilt-android dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: com.google.dagger:hilt-compiler dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * maven central url added to element-android/buld.gradle to buildscript configuration Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: NIkita Fedrunov <fedrunov@element.io>
2022-05-10 15:11:04 +03:00
// Do not use `mavenCentral()`, it prevents Dependabot from working properly
maven {
url 'https://repo1.maven.org/maven2'
}
2019-05-07 15:02:15 +03:00
}
2021-09-15 12:28:58 +03:00
2018-10-03 18:56:33 +03:00
dependencies {
2021-09-02 10:36:13 +03:00
// Release notes of Android Gradle Plugin (AGP):
// https://developer.android.com/studio/releases/gradle-plugin
2021-09-15 12:28:58 +03:00
classpath libs.gradle.gradlePlugin
classpath libs.gradle.kotlinPlugin
2021-10-14 19:47:28 +03:00
classpath libs.gradle.hiltPlugin
classpath 'com.google.firebase:firebase-appdistribution-gradle:4.0.0'
classpath 'com.google.gms:google-services:4.3.15'
2023-06-02 15:27:57 +03:00
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.0.0.2929'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.6'
classpath "com.likethesalad.android:stem-plugin:2.9.0"
classpath 'org.owasp:dependency-check-gradle:8.2.1'
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.8.10"
2022-05-04 16:52:51 +03:00
classpath "org.jetbrains.kotlinx:kotlinx-knit:0.4.0"
classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.3'
classpath libs.squareup.paparazziPlugin
2018-10-03 18:56:33 +03:00
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
2021-10-01 14:28:47 +03:00
plugins {
2022-05-12 17:41:36 +03:00
// ktlint Plugin
id "org.jlleitschuh.gradle.ktlint" version "11.3.2"
2022-05-12 17:41:36 +03:00
// Detekt
id "io.gitlab.arturbosch.detekt" version "1.23.7"
2022-10-03 17:30:44 +03:00
// Ksp
id "com.google.devtools.ksp" version "1.9.24-1.0.20"
2022-05-18 15:19:11 +03:00
// Dependency Analysis
id 'com.autonomousapps.dependency-analysis' version "1.20.0"
2022-09-19 16:30:13 +03:00
// Gradle doctor
id "com.osacky.doctor" version "0.8.1"
2021-10-01 14:28:47 +03:00
}
// https://github.com/jeremylong/DependencyCheck
apply plugin: 'org.owasp.dependencycheck'
dependencyCheck {
// See https://jeremylong.github.io/DependencyCheck/general/suppression.html
suppressionFiles = [
"./tools/dependencycheck/suppressions.xml"
]
}
// Gradle doctor configuration
apply from: './tools/gradle/doctor.gradle'
2018-10-03 18:56:33 +03:00
allprojects {
2021-10-01 14:28:47 +03:00
apply plugin: "org.jlleitschuh.gradle.ktlint"
2022-05-12 17:41:36 +03:00
apply plugin: "io.gitlab.arturbosch.detekt"
2021-10-01 14:28:47 +03:00
2018-10-03 18:56:33 +03:00
repositories {
// Do not use `mavenCentral()`, it prevents Dependabot from working properly
2022-05-06 19:23:58 +03:00
maven {
url 'https://repo1.maven.org/maven2'
content {
groups.mavenCentral.regex.each { includeGroupByRegex it }
groups.mavenCentral.group.each { includeGroup it }
}
}
2022-09-17 00:12:48 +03:00
// snapshots repository
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
content {
groups.snapshot.regex.each { includeGroupByRegex it }
groups.snapshot.group.each { includeGroup it }
}
}
2019-05-16 11:23:57 +03:00
maven {
url 'https://jitpack.io'
2019-07-11 15:03:20 +03:00
content {
2021-12-10 23:35:48 +03:00
groups.jitpack.regex.each { includeGroupByRegex it }
groups.jitpack.group.each { includeGroup it }
2019-07-11 15:03:20 +03:00
}
}
2020-08-12 15:02:00 +03:00
// Jitsi repo
maven {
2024-09-18 17:41:30 +03:00
url "https://github.com/element-hq/jitsi_libre_maven/raw/main/mobile-sdk-10.2.0"
// Note: to test Jitsi release you can use a local file like this:
2024-09-18 17:41:30 +03:00
// url "file:///Users/bmarty/workspaces/jitsi_libre_maven/mobile-sdk-10.2.0"
content {
2021-12-10 23:35:48 +03:00
groups.jitsi.regex.each { includeGroupByRegex it }
groups.jitsi.group.each { includeGroup it }
}
2020-08-12 15:02:00 +03:00
}
// Do not use `google()`, it prevents Dependabot from working properly
maven {
url 'https://maven.google.com'
content {
2021-12-10 23:35:48 +03:00
groups.google.regex.each { includeGroupByRegex it }
groups.google.group.each { includeGroup it }
}
}
maven {
url 'https://s01.oss.sonatype.org/content/repositories/snapshots'
content {
groups.mavenSnapshots.regex.each { includeGroupByRegex it }
groups.mavenSnapshots.group.each { includeGroup it }
}
}
2018-10-03 18:56:33 +03:00
}
2019-07-16 20:13:48 +03:00
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
// Warnings are potential errors, so stop ignoring them
// You can override by passing `-PallWarningsAsErrors=false` in the command line
kotlinOptions.allWarningsAsErrors = project.getProperties().getOrDefault("allWarningsAsErrors", "true").toBoolean()
}
2021-10-01 14:28:47 +03:00
// Fix "Java heap space" issue
tasks.withType(org.jlleitschuh.gradle.ktlint.tasks.BaseKtLintCheckTask).configureEach {
it.workerMaxHeapSize.set("2G")
}
// See https://github.com/JLLeitschuh/ktlint-gradle#configuration
ktlint {
// See https://github.com/pinterest/ktlint/releases/
version = "0.45.1"
2021-10-01 14:28:47 +03:00
android = true
ignoreFailures = false
enableExperimentalRules = true
// display the corresponding rule
verbose = true
reporters {
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN)
// To have XML report for Danger
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE)
}
filter {
exclude { element -> element.file.path.contains("$buildDir/generated/") }
}
2021-10-01 14:28:47 +03:00
disabledRules = [
2022-05-12 18:06:52 +03:00
// TODO Re-enable these 4 rules after reformatting project
2022-04-12 12:12:14 +03:00
"indent",
"experimental:argument-list-wrapping",
"max-line-length",
"parameter-list-wrapping",
2021-10-01 14:28:47 +03:00
"spacing-between-declarations-with-comments",
"no-multi-spaces",
"experimental:spacing-between-declarations-with-annotations",
"experimental:annotation",
// - Missing newline after "("
// - Missing newline before ")"
"wrapping",
// - Unnecessary trailing comma before ")"
"experimental:trailing-comma",
// - A block comment in between other elements on the same line is disallowed
"experimental:comment-wrapping",
// - A KDoc comment after any other element on the same line must be separated by a new line
"experimental:kdoc-wrapping",
2022-08-16 17:28:27 +03:00
// Ignore error "Redundant curly braces", since we use it to fix false positives, for instance in "elementLogs.${i}.txt"
"string-template",
2021-10-01 14:28:47 +03:00
]
}
2022-05-12 17:41:36 +03:00
detekt {
// preconfigure defaults
buildUponDefaultConfig = true
// activate all available (even unstable) rules.
allRules = true
2022-05-12 17:41:36 +03:00
// point to your custom config defining rules to run, overwriting default behavior
config = files("$rootDir/tools/detekt/detekt.yml")
}
2018-10-03 18:56:33 +03:00
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2019-03-18 18:53:52 +03:00
def launchTask = getGradle()
.getStartParameter()
.getTaskRequests()
.toString()
.toLowerCase()
if (launchTask.contains("coverage".toLowerCase())) {
apply from: 'coverage.gradle'
}
2019-03-18 18:53:52 +03:00
apply plugin: 'org.sonarqube'
// To run a sonar analysis:
// Run './gradlew sonar -Dsonar.login=<REPLACE_WITH_SONAR_KEY>'
// The SONAR_KEY is stored in passbolt as Token Sonar Cloud Bma
sonar {
2019-03-18 18:53:52 +03:00
properties {
property "sonar.projectName", "element-android"
property "sonar.projectKey", "vector-im_element-android"
2019-03-18 18:53:52 +03:00
property "sonar.host.url", "https://sonarcloud.io"
2019-03-19 16:38:15 +03:00
property "sonar.projectVersion", project(":vector").android.defaultConfig.versionName
2019-03-18 18:53:52 +03:00
property "sonar.sourceEncoding", "UTF-8"
property "sonar.links.homepage", "https://github.com/element-hq/element-android/"
property "sonar.links.ci", "https://github.com/element-hq/element-android/actions"
property "sonar.links.scm", "https://github.com/element-hq/element-android/"
property "sonar.links.issue", "https://github.com/element-hq/element-android/issues"
2019-03-18 18:53:52 +03:00
property "sonar.organization", "new_vector_ltd_organization"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/generateCoverageReport/generateCoverageReport.xml"
2019-03-18 18:53:52 +03:00
property "sonar.login", project.hasProperty("SONAR_LOGIN") ? SONAR_LOGIN : "invalid"
}
}
2019-03-19 16:38:15 +03:00
project(":vector") {
sonar {
2019-03-18 18:53:52 +03:00
properties {
2019-03-19 16:38:15 +03:00
property "sonar.sources", project(":vector").android.sourceSets.main.java.srcDirs
2019-03-18 18:53:52 +03:00
// exclude source code from analyses separated by a colon (:)
2020-08-27 18:39:09 +03:00
// Exclude Java source
property "sonar.exclusions", "**/BugReporterMultipartBody.java"
2019-03-18 18:53:52 +03:00
}
}
}
project(":library:external:diff-match-patch") {
sonar {
2020-08-27 16:37:39 +03:00
skipProject = true
}
}
//project(":matrix-sdk-android") {
// sonar {
// properties {
// property "sonar.sources", project(":matrix-sdk-android").android.sourceSets.main.java.srcDirs
// // exclude source code from analyses separated by a colon (:)
// // property "sonar.exclusions", "**/*.*"
// }
// }
//}
2022-04-15 23:50:54 +03:00
dependencyAnalysis {
dependencies {
bundle("kotlin-stdlib") {
includeGroup("org.jetbrains.kotlin")
}
bundle("react") {
includeGroup("com.facebook.react")
}
}
issues {
all {
ignoreKtx(true)
onUsedTransitiveDependencies {
// Transitively used dependencies that should be declared directly
severity("ignore")
}
onUnusedDependencies {
severity("fail")
}
onUnusedAnnotationProcessors {
severity("fail")
exclude("com.airbnb.android:epoxy-processor", "com.google.dagger:hilt-compiler") // False positives
}
}
project(":library:jsonviewer") {
onUnusedDependencies {
exclude("org.json:json") // Used in unit tests, overwrites the one bundled into Android
}
}
project(":library:ui-styles")
project(":matrix-sdk-android") {
onUnusedDependencies {
exclude("io.reactivex.rxjava2:rxkotlin") // Transitively required for mocking realm as monarchy doesn't expose Rx
}
}
project(":matrix-sdk-android-flow") {
onUnusedDependencies {
exclude("androidx.paging:paging-runtime-ktx") // False positive
}
2022-04-15 23:50:54 +03:00
}
2022-05-26 15:33:28 +03:00
project(":vector") {
onUnusedDependencies {
// False positives
exclude(
"androidx.fragment:fragment-testing",
"com.facebook.soloader:soloader",
"com.vanniktech:emoji-google",
"com.vanniktech:emoji-material",
"org.maplibre.gl:android-plugin-annotation-v9",
"org.maplibre.gl:android-sdk",
)
2022-05-26 15:33:28 +03:00
}
}
2022-04-15 23:50:54 +03:00
}
}
tasks.register("recordScreenshots", GradleBuild) {
startParameter.projectProperties.screenshot = ""
tasks = [':vector:recordPaparazziDebug']
}
tasks.register("verifyScreenshots", GradleBuild) {
startParameter.projectProperties.screenshot = ""
2023-10-02 14:58:51 +03:00
tasks = [':vector:verifyPaparazziDebug']
}
ext.initScreenshotTests = { project ->
def hasScreenshots = project.hasProperty("screenshot")
if (hasScreenshots) {
project.apply plugin: 'app.cash.paparazzi'
}
project.dependencies { testCompileOnly libs.squareup.paparazzi }
project.android.testOptions.unitTests.all {
def screenshotTestCapture = "**/*ScreenshotTest*"
if (hasScreenshots) {
include screenshotTestCapture
} else {
exclude screenshotTestCapture
}
}
}
2023-08-28 16:34:52 +03:00
tasks.withType(Test) {
maxHeapSize = "2g"
}
// Workaround to have KSP generated Kotlin code available in the IDE (for code completion)
// Ref: https://github.com/airbnb/epoxy/releases/tag/5.0.0beta02
subprojects { project ->
afterEvaluate {
if (project.hasProperty("android")) {
android {
if (it instanceof com.android.build.gradle.LibraryExtension) {
libraryVariants.all { variant ->
def outputFolder = new File("build/generated/ksp/${variant.name}/kotlin")
if (outputFolder.exists()) {
variant.addJavaSourceFoldersToModel(outputFolder)
android.sourceSets.getAt(variant.name).java {
srcDir(outputFolder)
}
}
}
} else if (it instanceof com.android.build.gradle.AppExtension) {
applicationVariants.all { variant ->
def outputFolder = new File("build/generated/ksp/${variant.name}/kotlin")
if (outputFolder.exists()) {
variant.addJavaSourceFoldersToModel(outputFolder)
android.sourceSets.getAt(variant.name).java {
srcDir(outputFolder)
}
}
}
}
}
}
}
}