From a8bbf29b426b66b4c5f9c21fbc192310f799f207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Fri, 15 Apr 2022 22:50:54 +0200 Subject: [PATCH 01/16] Remove unused dependencies --- build.gradle | 17 +++++++++++++++++ dependencies.gradle | 2 +- library/attachment-viewer/build.gradle | 6 ++++-- library/core-utils/build.gradle | 3 +-- library/multipicker/build.gradle | 2 +- library/ui-styles/build.gradle | 6 +----- matrix-sdk-android-flow/build.gradle | 5 ----- matrix-sdk-android/build.gradle | 10 +--------- vector/build.gradle | 3 --- 9 files changed, 26 insertions(+), 28 deletions(-) diff --git a/build.gradle b/build.gradle index 1ff1da7427..6cbc11351e 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,7 @@ buildscript { // ktlint Plugin plugins { id "org.jlleitschuh.gradle.ktlint" version "10.2.1" + id 'com.autonomousapps.dependency-analysis' version "1.0.0" } // https://github.com/jeremylong/DependencyCheck @@ -193,3 +194,19 @@ project(":library:diff-match-patch") { // } // } //} + +dependencyAnalysis { + dependencies { + bundle("kotlin-stdlib") { + includeGroup("org.jetbrains.kotlin") + } + bundle("react") { + includeGroup("com.facebook.react") + } + } + issues { + all { + ignoreKtx(true) // default is false + } + } +} diff --git a/dependencies.gradle b/dependencies.gradle index 7666a3bf9f..be1b888502 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -81,7 +81,7 @@ ext.libs = [ 'hiltCompiler' : "com.google.dagger:hilt-compiler:$dagger" ], squareup : [ - 'moshi' : "com.squareup.moshi:moshi-adapters:$moshi", + 'moshi' : "com.squareup.moshi:moshi:$moshi", 'moshiKotlin' : "com.squareup.moshi:moshi-kotlin-codegen:$moshi", 'retrofit' : "com.squareup.retrofit2:retrofit:$retrofit", 'retrofitMoshi' : "com.squareup.retrofit2:converter-moshi:$retrofit" diff --git a/library/attachment-viewer/build.gradle b/library/attachment-viewer/build.gradle index 048710f62c..b51136a993 100644 --- a/library/attachment-viewer/build.gradle +++ b/library/attachment-viewer/build.gradle @@ -55,5 +55,7 @@ dependencies { implementation libs.androidx.appCompat implementation libs.androidx.recyclerview - implementation libs.google.material -} \ No newline at end of file + api("androidx.viewpager2:viewpager2:1.0.0") + implementation("androidx.core:core:1.7.0") + implementation("androidx.transition:transition:1.2.0") +} diff --git a/library/core-utils/build.gradle b/library/core-utils/build.gradle index ad3a948808..1cc518c432 100644 --- a/library/core-utils/build.gradle +++ b/library/core-utils/build.gradle @@ -50,6 +50,5 @@ android { } dependencies { - implementation libs.androidx.appCompat implementation libs.jetbrains.coroutinesAndroid -} \ No newline at end of file +} diff --git a/library/multipicker/build.gradle b/library/multipicker/build.gradle index bb98a2f852..861238c02b 100644 --- a/library/multipicker/build.gradle +++ b/library/multipicker/build.gradle @@ -39,8 +39,8 @@ android { dependencies { implementation libs.androidx.appCompat - implementation libs.androidx.fragmentKtx implementation libs.androidx.exifinterface + implementation libs.androidx.core // Log implementation libs.jakewharton.timber diff --git a/library/ui-styles/build.gradle b/library/ui-styles/build.gradle index 0ac513b252..debfdf8649 100644 --- a/library/ui-styles/build.gradle +++ b/library/ui-styles/build.gradle @@ -54,10 +54,6 @@ android { dependencies { implementation libs.androidx.appCompat implementation libs.google.material - // Pref theme - implementation libs.androidx.preferenceKtx - // PFLockScreen attrs - implementation 'com.github.vector-im:PFLockScreen-Android:1.0.0-beta12' // dialpad dimen implementation 'im.dlg:android-dialer:1.2.5' -} \ No newline at end of file +} diff --git a/matrix-sdk-android-flow/build.gradle b/matrix-sdk-android-flow/build.gradle index ea43ce20c8..fb69af2d82 100644 --- a/matrix-sdk-android-flow/build.gradle +++ b/matrix-sdk-android-flow/build.gradle @@ -31,9 +31,7 @@ android { } dependencies { - implementation project(":matrix-sdk-android") - implementation libs.androidx.appCompat implementation libs.jetbrains.coroutinesCore implementation libs.jetbrains.coroutinesAndroid @@ -41,7 +39,4 @@ dependencies { // Paging implementation libs.androidx.pagingRuntimeKtx - - // Logging - implementation libs.jakewharton.timber } diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle index 0cffa4148e..e9c8804bac 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -109,7 +109,6 @@ dependencies { implementation libs.jetbrains.coroutinesCore implementation libs.jetbrains.coroutinesAndroid - implementation libs.androidx.appCompat implementation libs.androidx.core // Lifecycle @@ -128,12 +127,11 @@ dependencies { implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.3")) implementation 'com.squareup.okhttp3:okhttp' implementation 'com.squareup.okhttp3:logging-interceptor' - implementation 'com.squareup.okhttp3:okhttp-urlconnection' implementation libs.squareup.moshi kapt libs.squareup.moshiKotlin - implementation libs.markwon.core + api "com.atlassian.commonmark:commonmark:0.13.0" // Image implementation libs.androidx.exifinterface @@ -149,10 +147,6 @@ dependencies { // Work implementation libs.androidx.work - // FP - implementation libs.arrow.core - implementation libs.arrow.instances - // olm lib is now hosted in MavenCentral implementation 'org.matrix.android:olm-sdk:3.2.10' @@ -174,8 +168,6 @@ dependencies { implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.46' testImplementation libs.tests.junit - testImplementation 'org.robolectric:robolectric:4.7.3' - //testImplementation 'org.robolectric:shadows-support-v4:3.0' // Note: version sticks to 1.9.2 due to https://github.com/mockk/mockk/issues/281 testImplementation libs.mockk.mockk testImplementation libs.tests.kluent diff --git a/vector/build.gradle b/vector/build.gradle index c7950da28e..237754d2d1 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -6,7 +6,6 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-parcelize' apply plugin: 'kotlin-kapt' apply plugin: 'com.likethesalad.stem' -apply plugin: 'dagger.hilt.android.plugin' kapt { correctErrorTypes = true @@ -373,7 +372,6 @@ dependencies { // FlowBinding implementation libs.github.flowBinding implementation libs.github.flowBindingAppcompat - implementation libs.github.flowBindingMaterial implementation libs.airbnb.epoxy implementation libs.airbnb.epoxyGlide @@ -448,7 +446,6 @@ dependencies { implementation 'com.github.jetradarmobile:android-snowfall:1.2.1' // DI implementation libs.dagger.hilt - kapt libs.dagger.hiltCompiler // Analytics implementation 'com.posthog.android:posthog:1.1.2' From b3cfc88773075b3ef64ca89ed3fa18708eff10b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Fri, 15 Apr 2022 23:36:42 +0200 Subject: [PATCH 02/16] Fix androidTest --- library/attachment-viewer/build.gradle | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/library/attachment-viewer/build.gradle b/library/attachment-viewer/build.gradle index b51136a993..b89d9c6cca 100644 --- a/library/attachment-viewer/build.gradle +++ b/library/attachment-viewer/build.gradle @@ -55,7 +55,5 @@ dependencies { implementation libs.androidx.appCompat implementation libs.androidx.recyclerview - api("androidx.viewpager2:viewpager2:1.0.0") - implementation("androidx.core:core:1.7.0") - implementation("androidx.transition:transition:1.2.0") + implementation libs.google.material } From cdd7db417409bac50ff24db741dcdc80c963219e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Sat, 16 Apr 2022 09:40:15 +0200 Subject: [PATCH 03/16] Fix unused resource references properly --- library/attachment-viewer/build.gradle | 3 ++- .../src/main/res/values/styles_pin_code.xml | 14 +------------- .../ui-styles/src/main/res/values/theme_dark.xml | 11 ----------- .../ui-styles/src/main/res/values/theme_light.xml | 11 ----------- 4 files changed, 3 insertions(+), 36 deletions(-) diff --git a/library/attachment-viewer/build.gradle b/library/attachment-viewer/build.gradle index b89d9c6cca..57e5f30887 100644 --- a/library/attachment-viewer/build.gradle +++ b/library/attachment-viewer/build.gradle @@ -55,5 +55,6 @@ dependencies { implementation libs.androidx.appCompat implementation libs.androidx.recyclerview - implementation libs.google.material + api "androidx.viewpager2:viewpager2:1.0.0" + implementation "androidx.transition:transition:1.2.0" } diff --git a/library/ui-styles/src/main/res/values/styles_pin_code.xml b/library/ui-styles/src/main/res/values/styles_pin_code.xml index 2b6c113359..edec029faf 100644 --- a/library/ui-styles/src/main/res/values/styles_pin_code.xml +++ b/library/ui-styles/src/main/res/values/styles_pin_code.xml @@ -21,18 +21,6 @@ 24dp - - - - @@ -41,4 +29,4 @@ ?vctr_content_primary - \ No newline at end of file + diff --git a/library/ui-styles/src/main/res/values/theme_dark.xml b/library/ui-styles/src/main/res/values/theme_dark.xml index 7177687fdd..185e5b919c 100644 --- a/library/ui-styles/src/main/res/values/theme_dark.xml +++ b/library/ui-styles/src/main/res/values/theme_dark.xml @@ -106,17 +106,6 @@ never - @style/PreferenceThemeOverlay.v14.Material - - @style/PinCodeScreenStyle - @style/PinCodeKeyButtonStyle - @style/PinCodeTitleStyle - @style/PinCodeHintStyle - @style/PinCodeDotsViewStyle - @style/PinCodeDeleteButtonStyle - @style/PinCodeFingerprintButtonStyle - @style/PinCodeNextButtonStyle - @color/android_status_bar_background_dark @color/android_navigation_bar_background_dark diff --git a/library/ui-styles/src/main/res/values/theme_light.xml b/library/ui-styles/src/main/res/values/theme_light.xml index c90c021591..0eb11a139c 100644 --- a/library/ui-styles/src/main/res/values/theme_light.xml +++ b/library/ui-styles/src/main/res/values/theme_light.xml @@ -106,17 +106,6 @@ never - @style/PreferenceThemeOverlay.v14.Material - - @style/PinCodeScreenStyle - @style/PinCodeKeyButtonStyle - @style/PinCodeTitleStyle - @style/PinCodeHintStyle - @style/PinCodeDotsViewStyle - @style/PinCodeDeleteButtonStyle - @style/PinCodeFingerprintButtonStyle - @style/PinCodeNextButtonStyle - @color/android_status_bar_background_dark From 2138ec07992af8f153367daaaf937d8d7847fdf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Sat, 16 Apr 2022 11:14:04 +0200 Subject: [PATCH 04/16] Remove unused resource to make lint happy --- .../ui-styles/src/main/res/drawable/bg_pin_key.xml | 13 ------------- .../src/main/res/values/styles_pin_code.xml | 6 ------ 2 files changed, 19 deletions(-) delete mode 100644 library/ui-styles/src/main/res/drawable/bg_pin_key.xml diff --git a/library/ui-styles/src/main/res/drawable/bg_pin_key.xml b/library/ui-styles/src/main/res/drawable/bg_pin_key.xml deleted file mode 100644 index d4a54577be..0000000000 --- a/library/ui-styles/src/main/res/drawable/bg_pin_key.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/library/ui-styles/src/main/res/values/styles_pin_code.xml b/library/ui-styles/src/main/res/values/styles_pin_code.xml index edec029faf..c69819f7ba 100644 --- a/library/ui-styles/src/main/res/values/styles_pin_code.xml +++ b/library/ui-styles/src/main/res/values/styles_pin_code.xml @@ -5,12 +5,6 @@ ?android:colorBackground - - From 4305b21ba85a785c2947784a1ea46f88a69facf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Sat, 16 Apr 2022 20:36:43 +0200 Subject: [PATCH 05/16] Remove unused resource to make lint happy --- .../main/res/drawable/pin_code_dot_empty.xml | 13 ---------- .../main/res/drawable/pin_code_dot_fill.xml | 12 --------- .../src/main/res/drawable/pin_code_dots.xml | 9 ------- .../src/main/res/values/styles_pin_code.xml | 26 ------------------- 4 files changed, 60 deletions(-) delete mode 100644 library/ui-styles/src/main/res/drawable/pin_code_dot_empty.xml delete mode 100644 library/ui-styles/src/main/res/drawable/pin_code_dot_fill.xml delete mode 100644 library/ui-styles/src/main/res/drawable/pin_code_dots.xml delete mode 100644 library/ui-styles/src/main/res/values/styles_pin_code.xml diff --git a/library/ui-styles/src/main/res/drawable/pin_code_dot_empty.xml b/library/ui-styles/src/main/res/drawable/pin_code_dot_empty.xml deleted file mode 100644 index 1827a7682b..0000000000 --- a/library/ui-styles/src/main/res/drawable/pin_code_dot_empty.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/library/ui-styles/src/main/res/drawable/pin_code_dot_fill.xml b/library/ui-styles/src/main/res/drawable/pin_code_dot_fill.xml deleted file mode 100644 index 799ea30174..0000000000 --- a/library/ui-styles/src/main/res/drawable/pin_code_dot_fill.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/library/ui-styles/src/main/res/drawable/pin_code_dots.xml b/library/ui-styles/src/main/res/drawable/pin_code_dots.xml deleted file mode 100644 index 29e445e511..0000000000 --- a/library/ui-styles/src/main/res/drawable/pin_code_dots.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/library/ui-styles/src/main/res/values/styles_pin_code.xml b/library/ui-styles/src/main/res/values/styles_pin_code.xml deleted file mode 100644 index c69819f7ba..0000000000 --- a/library/ui-styles/src/main/res/values/styles_pin_code.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - From 2c84f234a600eedca62b37e9dd63f994da758401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Sun, 17 Apr 2022 11:09:10 +0200 Subject: [PATCH 06/16] Cleanup --- dependencies.gradle | 5 ++++- library/attachment-viewer/build.gradle | 4 ++-- library/multipicker/build.gradle | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index be1b888502..ec27184d5c 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -45,6 +45,7 @@ ext.libs = [ 'coroutinesTest' : "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutines" ], androidx : [ + 'activity' : "androidx.activity:activity:1.2.4", 'appCompat' : "androidx.appcompat:appcompat:1.4.0", 'core' : "androidx.core:core-ktx:1.7.0", 'recyclerview' : "androidx.recyclerview:recyclerview:1.2.1", @@ -69,7 +70,9 @@ ext.libs = [ 'testRules' : "androidx.test:rules:$androidxTest", 'espressoCore' : "androidx.test.espresso:espresso-core:$espresso", 'espressoContrib' : "androidx.test.espresso:espresso-contrib:$espresso", - 'espressoIntents' : "androidx.test.espresso:espresso-intents:$espresso" + 'espressoIntents' : "androidx.test.espresso:espresso-intents:$espresso", + 'viewpager2' : "androidx.viewpager2:viewpager2:1.0.0", + 'transition' : "androidx.transition:transition:1.2.0", ], google : [ 'material' : "com.google.android.material:material:1.5.0" diff --git a/library/attachment-viewer/build.gradle b/library/attachment-viewer/build.gradle index 57e5f30887..8bbafd3387 100644 --- a/library/attachment-viewer/build.gradle +++ b/library/attachment-viewer/build.gradle @@ -55,6 +55,6 @@ dependencies { implementation libs.androidx.appCompat implementation libs.androidx.recyclerview - api "androidx.viewpager2:viewpager2:1.0.0" - implementation "androidx.transition:transition:1.2.0" + api libs.androidx.viewpager2 + implementation libs.androidx.transition } diff --git a/library/multipicker/build.gradle b/library/multipicker/build.gradle index 861238c02b..2de99d5c20 100644 --- a/library/multipicker/build.gradle +++ b/library/multipicker/build.gradle @@ -38,7 +38,7 @@ android { } dependencies { - implementation libs.androidx.appCompat + api libs.androidx.activity implementation libs.androidx.exifinterface implementation libs.androidx.core From 2bbecd4cc5d3bf245575ce0816a4f4829ac4f9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Sun, 17 Apr 2022 11:35:30 +0200 Subject: [PATCH 07/16] Fix regressions --- library/ui-styles/build.gradle | 4 ++ .../src/main/res/drawable/bg_pin_key.xml | 13 ++++++ .../main/res/drawable/pin_code_dot_empty.xml | 13 ++++++ .../main/res/drawable/pin_code_dot_fill.xml | 12 +++++ .../src/main/res/drawable/pin_code_dots.xml | 9 ++++ .../src/main/res/values/styles_pin_code.xml | 44 +++++++++++++++++++ .../src/main/res/values/theme_dark.xml | 11 +++++ .../src/main/res/values/theme_light.xml | 11 +++++ vector/build.gradle | 2 + 9 files changed, 119 insertions(+) create mode 100644 library/ui-styles/src/main/res/drawable/bg_pin_key.xml create mode 100644 library/ui-styles/src/main/res/drawable/pin_code_dot_empty.xml create mode 100644 library/ui-styles/src/main/res/drawable/pin_code_dot_fill.xml create mode 100644 library/ui-styles/src/main/res/drawable/pin_code_dots.xml create mode 100644 library/ui-styles/src/main/res/values/styles_pin_code.xml diff --git a/library/ui-styles/build.gradle b/library/ui-styles/build.gradle index debfdf8649..31cfdd24c7 100644 --- a/library/ui-styles/build.gradle +++ b/library/ui-styles/build.gradle @@ -54,6 +54,10 @@ android { dependencies { implementation libs.androidx.appCompat implementation libs.google.material + // Pref theme + implementation libs.androidx.preferenceKtx + // PFLockScreen attrs + implementation 'com.github.vector-im:PFLockScreen-Android:1.0.0-beta12' // dialpad dimen implementation 'im.dlg:android-dialer:1.2.5' } diff --git a/library/ui-styles/src/main/res/drawable/bg_pin_key.xml b/library/ui-styles/src/main/res/drawable/bg_pin_key.xml new file mode 100644 index 0000000000..5bf293aab0 --- /dev/null +++ b/library/ui-styles/src/main/res/drawable/bg_pin_key.xml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/library/ui-styles/src/main/res/drawable/pin_code_dot_empty.xml b/library/ui-styles/src/main/res/drawable/pin_code_dot_empty.xml new file mode 100644 index 0000000000..879cac15ca --- /dev/null +++ b/library/ui-styles/src/main/res/drawable/pin_code_dot_empty.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/library/ui-styles/src/main/res/drawable/pin_code_dot_fill.xml b/library/ui-styles/src/main/res/drawable/pin_code_dot_fill.xml new file mode 100644 index 0000000000..83bdac5126 --- /dev/null +++ b/library/ui-styles/src/main/res/drawable/pin_code_dot_fill.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/library/ui-styles/src/main/res/drawable/pin_code_dots.xml b/library/ui-styles/src/main/res/drawable/pin_code_dots.xml new file mode 100644 index 0000000000..c4b1073f85 --- /dev/null +++ b/library/ui-styles/src/main/res/drawable/pin_code_dots.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/library/ui-styles/src/main/res/values/styles_pin_code.xml b/library/ui-styles/src/main/res/values/styles_pin_code.xml new file mode 100644 index 0000000000..cb22863694 --- /dev/null +++ b/library/ui-styles/src/main/res/values/styles_pin_code.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/library/ui-styles/src/main/res/values/theme_dark.xml b/library/ui-styles/src/main/res/values/theme_dark.xml index 185e5b919c..7177687fdd 100644 --- a/library/ui-styles/src/main/res/values/theme_dark.xml +++ b/library/ui-styles/src/main/res/values/theme_dark.xml @@ -106,6 +106,17 @@ never + @style/PreferenceThemeOverlay.v14.Material + + @style/PinCodeScreenStyle + @style/PinCodeKeyButtonStyle + @style/PinCodeTitleStyle + @style/PinCodeHintStyle + @style/PinCodeDotsViewStyle + @style/PinCodeDeleteButtonStyle + @style/PinCodeFingerprintButtonStyle + @style/PinCodeNextButtonStyle + @color/android_status_bar_background_dark @color/android_navigation_bar_background_dark diff --git a/library/ui-styles/src/main/res/values/theme_light.xml b/library/ui-styles/src/main/res/values/theme_light.xml index 0eb11a139c..c90c021591 100644 --- a/library/ui-styles/src/main/res/values/theme_light.xml +++ b/library/ui-styles/src/main/res/values/theme_light.xml @@ -106,6 +106,17 @@ never + @style/PreferenceThemeOverlay.v14.Material + + @style/PinCodeScreenStyle + @style/PinCodeKeyButtonStyle + @style/PinCodeTitleStyle + @style/PinCodeHintStyle + @style/PinCodeDotsViewStyle + @style/PinCodeDeleteButtonStyle + @style/PinCodeFingerprintButtonStyle + @style/PinCodeNextButtonStyle + @color/android_status_bar_background_dark diff --git a/vector/build.gradle b/vector/build.gradle index 237754d2d1..6d318f82b9 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -6,6 +6,7 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-parcelize' apply plugin: 'kotlin-kapt' apply plugin: 'com.likethesalad.stem' +apply plugin: 'dagger.hilt.android.plugin' kapt { correctErrorTypes = true @@ -446,6 +447,7 @@ dependencies { implementation 'com.github.jetradarmobile:android-snowfall:1.2.1' // DI implementation libs.dagger.hilt + kapt libs.dagger.hiltCompiler // Analytics implementation 'com.posthog.android:posthog:1.1.2' From 388e35e828afcea811156f1959763107fd1b04e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Wed, 18 May 2022 14:19:11 +0200 Subject: [PATCH 08/16] Remove even more deps --- build.gradle | 4 +++- library/jsonviewer/build.gradle | 2 +- matrix-sdk-android-flow/build.gradle | 3 --- vector-config/build.gradle | 4 ---- vector/build.gradle | 1 - 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index cf49f37809..79637f9756 100644 --- a/build.gradle +++ b/build.gradle @@ -41,7 +41,9 @@ plugins { id "org.jlleitschuh.gradle.ktlint" version "10.3.0" // Detekt id "io.gitlab.arturbosch.detekt" version "1.20.0" - id 'com.autonomousapps.dependency-analysis' version "1.0.0" + + // Dependency Analysis + id 'com.autonomousapps.dependency-analysis' version "1.2.1" } // https://github.com/jeremylong/DependencyCheck diff --git a/library/jsonviewer/build.gradle b/library/jsonviewer/build.gradle index 2110747feb..e1a3b0c9ee 100644 --- a/library/jsonviewer/build.gradle +++ b/library/jsonviewer/build.gradle @@ -52,6 +52,7 @@ dependencies { implementation libs.androidx.appCompat implementation libs.androidx.core + implementation libs.androidx.recyclerview implementation libs.airbnb.epoxy kapt libs.airbnb.epoxyProcessor @@ -60,7 +61,6 @@ dependencies { // Span utils implementation 'me.gujun.android:span:1.7' - implementation libs.google.material implementation libs.jetbrains.coroutinesCore implementation libs.jetbrains.coroutinesAndroid diff --git a/matrix-sdk-android-flow/build.gradle b/matrix-sdk-android-flow/build.gradle index fb69af2d82..6385e66abb 100644 --- a/matrix-sdk-android-flow/build.gradle +++ b/matrix-sdk-android-flow/build.gradle @@ -36,7 +36,4 @@ dependencies { implementation libs.jetbrains.coroutinesCore implementation libs.jetbrains.coroutinesAndroid implementation libs.androidx.lifecycleLivedata - - // Paging - implementation libs.androidx.pagingRuntimeKtx } diff --git a/vector-config/build.gradle b/vector-config/build.gradle index 4156e74274..95b6a6215d 100644 --- a/vector-config/build.gradle +++ b/vector-config/build.gradle @@ -1,6 +1,5 @@ plugins { id 'com.android.library' - id 'org.jetbrains.kotlin.android' } android { @@ -14,7 +13,4 @@ android { sourceCompatibility versions.sourceCompat targetCompatibility versions.targetCompat } - kotlinOptions { - jvmTarget = "11" - } } diff --git a/vector/build.gradle b/vector/build.gradle index c91b7b50b7..1c0a4718c4 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -370,7 +370,6 @@ dependencies { implementation libs.androidx.lifecycleProcess implementation libs.androidx.lifecycleRuntimeKtx - implementation libs.androidx.datastore implementation libs.androidx.datastorepreferences From 6c569e6f9d1739dee15ceb9ff2859b8cdab18ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Wed, 18 May 2022 18:22:36 +0200 Subject: [PATCH 09/16] Bring back a false positive --- matrix-sdk-android-flow/build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/matrix-sdk-android-flow/build.gradle b/matrix-sdk-android-flow/build.gradle index 6385e66abb..fb69af2d82 100644 --- a/matrix-sdk-android-flow/build.gradle +++ b/matrix-sdk-android-flow/build.gradle @@ -36,4 +36,7 @@ dependencies { implementation libs.jetbrains.coroutinesCore implementation libs.jetbrains.coroutinesAndroid implementation libs.androidx.lifecycleLivedata + + // Paging + implementation libs.androidx.pagingRuntimeKtx } 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 10/16] 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 + } } } } From c093b3476fc2a790fbefb4aaeef68f943f450d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Thu, 19 May 2022 10:57:06 +0200 Subject: [PATCH 11/16] Limit parallel Gradle tasks --- .github/workflows/quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index d7d3ceffcc..8b3d966e9b 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -118,7 +118,7 @@ jobs: - name: Lint analysis run: ./gradlew clean :vector:lint --stacktrace - name: Dependency analysis - run: ./gradlew buildHealth + run: ./gradlew buildHealth --max-workers=1 - name: Upload reports if: always() uses: actions/upload-artifact@v3 From 464735f82995fce3657bb9a5c741591da4158e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Thu, 19 May 2022 11:31:32 +0200 Subject: [PATCH 12/16] Move dependency analysis to its own job --- .github/workflows/quality.yml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 8b3d966e9b..d51d732a3b 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -97,6 +97,25 @@ jobs: comment_id: ${{ steps.fc.outputs.comment-id }} }) +# Gradle dependency analysis using https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin + dependency-analysis: + name: Dependency analysis + runs-on: ubuntu-latest + # Allow all jobs on main and develop. Just one per PR. + concurrency: + group: ${{ github.ref == 'refs/heads/main' && format('ktlint-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('ktlint-develop-{0}', github.sha) || format('ktlint-{0}', github.ref) }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v3 + - name: Dependency analysis + run: ./gradlew buildHealth --max-workers=1 + - 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 main module android-lint: name: Android Linter @@ -117,8 +136,6 @@ jobs: ${{ runner.os }}-gradle- - name: Lint analysis run: ./gradlew clean :vector:lint --stacktrace - - name: Dependency analysis - run: ./gradlew buildHealth --max-workers=1 - name: Upload reports if: always() uses: actions/upload-artifact@v3 @@ -126,12 +143,6 @@ 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: From bc050d303044af1b42c5f5aada9a7ce0bb97fec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Thu, 19 May 2022 12:08:17 +0200 Subject: [PATCH 13/16] Tweak JVM memory settings --- .github/workflows/quality.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index d51d732a3b..84823906c7 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -5,6 +5,12 @@ on: push: branches: [ main, develop ] +# Enrich gradle.properties for CI/CD +env: + CI_GRADLE_ARG_PROPERTIES: > + -Porg.gradle.jvmargs=-Xmx4g + -Porg.gradle.parallel=false + jobs: check: name: Project Check Suite @@ -108,7 +114,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Dependency analysis - run: ./gradlew buildHealth --max-workers=1 + run: ./gradlew buildHealth $CI_GRADLE_ARG_PROPERTIES - name: Upload dependency analysis if: always() uses: actions/upload-artifact@v3 From 429094511897178045023f443a2eb541714f6b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Thu, 19 May 2022 12:09:45 +0200 Subject: [PATCH 14/16] Enable parallelism --- .github/workflows/quality.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 84823906c7..ae6af06d86 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -9,7 +9,6 @@ on: env: CI_GRADLE_ARG_PROPERTIES: > -Porg.gradle.jvmargs=-Xmx4g - -Porg.gradle.parallel=false jobs: check: From 2802a714ab9e8c848ac1f009833b84dddad174f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Thu, 26 May 2022 08:36:12 +0200 Subject: [PATCH 15/16] Fix concurrency group --- .github/workflows/quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index ae6af06d86..014139d0ba 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -108,7 +108,7 @@ jobs: runs-on: ubuntu-latest # Allow all jobs on main and develop. Just one per PR. concurrency: - group: ${{ github.ref == 'refs/heads/main' && format('ktlint-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('ktlint-develop-{0}', github.sha) || format('ktlint-{0}', github.ref) }} + group: ${{ github.ref == 'refs/heads/main' && format('dep-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('dep-develop-{0}', github.sha) || format('dep-{0}', github.ref) }} cancel-in-progress: true steps: - uses: actions/checkout@v3 From fe4abf9d78a878a45772fb07511b6aa405c9db12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olive=CC=81r=20Falvai?= Date: Thu, 26 May 2022 14:33:28 +0200 Subject: [PATCH 16/16] Add another false positive --- build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index 023f7a909c..cdff79ac37 100644 --- a/build.gradle +++ b/build.gradle @@ -267,5 +267,10 @@ dependencyAnalysis { exclude("androidx.paging:paging-runtime-ktx") // False positive } } + project(":vector") { + onUnusedDependencies { + exclude("org.maplibre.gl:android-sdk", "org.maplibre.gl:android-plugin-annotation-v9") // False positives + } + } } }