SchildiChat-android/build.gradle

367 lines
14 KiB
Groovy
Raw Normal View History

2018-10-03 17:56:33 +02:00
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
2021-09-15 11:28:58 +02:00
apply from: 'dependencies.gradle'
2021-12-10 21:19:43 +01:00
apply from: 'dependencies_groups.gradle'
2021-09-15 11:28:58 +02:00
2018-10-03 17:56:33 +02:00
repositories {
// Do not use `google()`, it prevents Dependabot from working properly
maven {
url 'https://maven.google.com'
}
2019-03-18 16:53:52 +01:00
maven {
url "https://plugins.gradle.org/m2/"
2019-05-07 14:02:15 +02: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 14:11:04 +02:00
// Do not use `mavenCentral()`, it prevents Dependabot from working properly
maven {
url 'https://repo1.maven.org/maven2'
}
2019-05-07 14:02:15 +02:00
}
2021-09-15 11:28:58 +02:00
2018-10-03 17:56:33 +02:00
dependencies {
2021-09-02 09:36:13 +02:00
// Release notes of Android Gradle Plugin (AGP):
// https://developer.android.com/studio/releases/gradle-plugin
2021-09-15 11:28:58 +02:00
classpath libs.gradle.gradlePlugin
classpath libs.gradle.kotlinPlugin
2021-10-14 18:47:28 +02:00
classpath libs.gradle.hiltPlugin
classpath 'com.google.firebase:firebase-appdistribution-gradle:4.0.0'
classpath 'com.google.gms:google-services:4.3.15'
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.3.0"
classpath 'org.owasp:dependency-check-gradle:8.2.1'
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.8.10"
2022-05-04 15:52:51 +02: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 17:56:33 +02:00
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
2021-10-01 13:28:47 +02:00
plugins {
2022-05-12 16:41:36 +02:00
// ktlint Plugin
id "org.jlleitschuh.gradle.ktlint" version "11.3.1"
2022-05-12 16:41:36 +02:00
// Detekt
id "io.gitlab.arturbosch.detekt" version "1.22.0"
2022-10-03 16:30:44 +02:00
// Ksp
id "com.google.devtools.ksp" version "1.8.10-1.0.9"
2022-05-18 14:19:11 +02:00
// Dependency Analysis
id 'com.autonomousapps.dependency-analysis' version "1.19.0"
2022-09-19 15:30:13 +02:00
// Gradle doctor
id "com.osacky.doctor" version "0.8.1"
2021-10-01 13:28:47 +02: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 17:56:33 +02:00
allprojects {
2021-10-01 13:28:47 +02:00
apply plugin: "org.jlleitschuh.gradle.ktlint"
2022-05-12 16:41:36 +02:00
apply plugin: "io.gitlab.arturbosch.detekt"
2021-10-01 13:28:47 +02:00
2018-10-03 17:56:33 +02:00
repositories {
// Do not use `mavenCentral()`, it prevents Dependabot from working properly
2022-05-06 18:23:58 +02:00
maven {
url 'https://repo1.maven.org/maven2'
content {
groups.mavenCentral.regex.each { includeGroupByRegex it }
groups.mavenCentral.group.each { includeGroup it }
}
}
2022-09-16 23:12:48 +02: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 10:23:57 +02:00
maven {
url 'https://jitpack.io'
2019-07-11 14:03:20 +02:00
content {
2021-12-10 21:35:48 +01:00
groups.jitpack.regex.each { includeGroupByRegex it }
groups.jitpack.group.each { includeGroup it }
2019-07-11 14:03:20 +02:00
}
}
2020-08-12 14:02:00 +02:00
// Jitsi repo
maven {
url "https://github.com/vector-im/jitsi_libre_maven/raw/main/android-sdk-6.2.2"
// Note: to test Jitsi release you can use a local file like this:
// url "file:///Users/bmarty/workspaces/jitsi_libre_maven/android-sdk-6.2.2"
content {
2021-12-10 21:35:48 +01:00
groups.jitsi.regex.each { includeGroupByRegex it }
groups.jitsi.group.each { includeGroup it }
}
2020-08-12 14:02:00 +02:00
}
// Do not use `google()`, it prevents Dependabot from working properly
maven {
url 'https://maven.google.com'
content {
2021-12-10 21:35:48 +01:00
groups.google.regex.each { includeGroupByRegex it }
groups.google.group.each { includeGroup it }
}
}
//noinspection JcenterRepositoryObsolete
// Do not use `jcenter`, it prevents Dependabot from working properly
maven {
url 'https://jcenter.bintray.com'
content {
2021-12-10 21:35:48 +01:00
groups.jcenter.regex.each { includeGroupByRegex it }
groups.jcenter.group.each { includeGroup it }
}
}
2018-10-03 17:56:33 +02:00
}
2019-07-16 19:13:48 +02: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 13:28:47 +02: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 13:28:47 +02: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 13:28:47 +02:00
disabledRules = [
2022-05-12 17:06:52 +02:00
// TODO Re-enable these 4 rules after reformatting project
2022-04-12 11:12:14 +02:00
"indent",
"experimental:argument-list-wrapping",
"max-line-length",
"parameter-list-wrapping",
2021-10-01 13:28:47 +02: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 16:28:27 +02: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 13:28:47 +02:00
]
}
2022-05-12 16:41:36 +02:00
detekt {
// preconfigure defaults
buildUponDefaultConfig = true
// activate all available (even unstable) rules.
allRules = true
2022-05-12 16:41:36 +02:00
// point to your custom config defining rules to run, overwriting default behavior
config = files("$rootDir/tools/detekt/detekt.yml")
}
2018-10-03 17:56:33 +02:00
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2019-03-18 16:53:52 +01:00
def launchTask = getGradle()
.getStartParameter()
.getTaskRequests()
.toString()
.toLowerCase()
if (launchTask.contains("coverage".toLowerCase())) {
apply from: 'coverage.gradle'
}
2019-03-18 16:53:52 +01: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 16:53:52 +01:00
properties {
property "sonar.projectName", "element-android"
property "sonar.projectKey", "vector-im_element-android"
2019-03-18 16:53:52 +01:00
property "sonar.host.url", "https://sonarcloud.io"
2019-03-19 14:38:15 +01:00
property "sonar.projectVersion", project(":vector").android.defaultConfig.versionName
2019-03-18 16:53:52 +01:00
property "sonar.sourceEncoding", "UTF-8"
2020-08-27 17:43:22 +02:00
property "sonar.links.homepage", "https://github.com/vector-im/element-android/"
property "sonar.links.ci", "https://github.com/vector-im/element-android/actions"
2020-08-27 17:43:22 +02:00
property "sonar.links.scm", "https://github.com/vector-im/element-android/"
property "sonar.links.issue", "https://github.com/vector-im/element-android/issues"
2019-03-18 16:53:52 +01: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 16:53:52 +01:00
property "sonar.login", project.hasProperty("SONAR_LOGIN") ? SONAR_LOGIN : "invalid"
}
}
2019-03-19 14:38:15 +01:00
project(":vector") {
sonar {
2019-03-18 16:53:52 +01:00
properties {
2019-03-19 14:38:15 +01:00
property "sonar.sources", project(":vector").android.sourceSets.main.java.srcDirs
2019-03-18 16:53:52 +01:00
// exclude source code from analyses separated by a colon (:)
2020-08-27 17:39:09 +02:00
// Exclude Java source
property "sonar.exclusions", "**/BugReporterMultipartBody.java"
2019-03-18 16:53:52 +01:00
}
}
}
project(":library:external:diff-match-patch") {
sonar {
2020-08-27 15:37:39 +02: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 22:50:54 +02: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 22:50:54 +02:00
}
2022-05-26 14:33:28 +02: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 14:33:28 +02:00
}
}
2022-04-15 22:50:54 +02:00
}
}
tasks.register("recordScreenshots", GradleBuild) {
startParameter.projectProperties.screenshot = ""
tasks = [':vector:recordPaparazziDebug']
}
tasks.register("verifyScreenshots", GradleBuild) {
startParameter.projectProperties.screenshot = ""
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
}
}
}
// 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)
}
}
}
}
}
}
}
}