From 86663ec073870a2125e3f266761c5a9ed3ffc132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Wed, 18 May 2022 18:47:52 +0200 Subject: [PATCH] Fine tune dependency analysis, add CI workflow --- .github/workflows/quality.yml | 8 ++++++++ build.gradle | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index a97d532644..d7d3ceffcc 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -117,6 +117,8 @@ jobs: ${{ runner.os }}-gradle- - name: Lint analysis run: ./gradlew clean :vector:lint --stacktrace + - name: Dependency analysis + run: ./gradlew buildHealth - name: Upload reports if: always() uses: actions/upload-artifact@v3 @@ -124,6 +126,12 @@ jobs: name: lint-report path: | vector/build/reports/*.* + - name: Upload dependency analysis + if: always() + uses: actions/upload-artifact@v3 + with: + name: dependency-analysis + path: build/reports/dependency-analysis/build-health-report.txt # Lint for Gplay and Fdroid release APK apk-lint: diff --git a/build.gradle b/build.gradle index 79637f9756..fe71865ef1 100644 --- a/build.gradle +++ b/build.gradle @@ -234,7 +234,38 @@ dependencyAnalysis { } issues { all { - ignoreKtx(true) // default is false + 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") { + onUnusedDependencies { + exclude("com.github.vector-im:PFLockScreen-Android") // False positive + } + } + 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 + } } } }