diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index a97d532644..014139d0ba 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -5,6 +5,11 @@ on: push: branches: [ main, develop ] +# Enrich gradle.properties for CI/CD +env: + CI_GRADLE_ARG_PROPERTIES: > + -Porg.gradle.jvmargs=-Xmx4g + jobs: check: name: Project Check Suite @@ -97,6 +102,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('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 + - name: Dependency analysis + run: ./gradlew buildHealth $CI_GRADLE_ARG_PROPERTIES + - 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 diff --git a/build.gradle b/build.gradle index 25ff8b91c0..cdff79ac37 100644 --- a/build.gradle +++ b/build.gradle @@ -41,6 +41,9 @@ plugins { id "org.jlleitschuh.gradle.ktlint" version "10.3.0" // Detekt id "io.gitlab.arturbosch.detekt" version "1.20.0" + + // Dependency Analysis + id 'com.autonomousapps.dependency-analysis' version "1.2.1" } // https://github.com/jeremylong/DependencyCheck @@ -219,3 +222,55 @@ project(":library:diff-match-patch") { // } // } //} + +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") { + 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 + } + } + project(":vector") { + onUnusedDependencies { + exclude("org.maplibre.gl:android-sdk", "org.maplibre.gl:android-plugin-annotation-v9") // False positives + } + } + } +} diff --git a/dependencies.gradle b/dependencies.gradle index c594d84f1b..0e514c6bd0 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -48,6 +48,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.1", 'core' : "androidx.core:core-ktx:1.7.0", 'recyclerview' : "androidx.recyclerview:recyclerview:1.2.1", @@ -72,7 +73,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.6.0" @@ -84,7 +87,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..8bbafd3387 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 -} \ No newline at end of file + api libs.androidx.viewpager2 + implementation libs.androidx.transition +} diff --git a/library/core-utils/build.gradle b/library/core-utils/build.gradle index d3afd8d29b..0f7789a2a8 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 } 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/library/multipicker/build.gradle b/library/multipicker/build.gradle index bb98a2f852..2de99d5c20 100644 --- a/library/multipicker/build.gradle +++ b/library/multipicker/build.gradle @@ -38,9 +38,9 @@ android { } dependencies { - implementation libs.androidx.appCompat - implementation libs.androidx.fragmentKtx + api libs.androidx.activity 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..31cfdd24c7 100644 --- a/library/ui-styles/build.gradle +++ b/library/ui-styles/build.gradle @@ -60,4 +60,4 @@ dependencies { 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/library/ui-styles/src/main/res/drawable/bg_pin_key.xml b/library/ui-styles/src/main/res/drawable/bg_pin_key.xml index d4a54577be..5bf293aab0 100644 --- a/library/ui-styles/src/main/res/drawable/bg_pin_key.xml +++ b/library/ui-styles/src/main/res/drawable/bg_pin_key.xml @@ -10,4 +10,4 @@ android:height="70dp" /> - \ No newline at end of file + 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 index 1827a7682b..879cac15ca 100644 --- 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 @@ -10,4 +10,4 @@ - \ 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 index 799ea30174..83bdac5126 100644 --- 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 @@ -9,4 +9,4 @@ - \ 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 index 29e445e511..c4b1073f85 100644 --- a/library/ui-styles/src/main/res/drawable/pin_code_dots.xml +++ b/library/ui-styles/src/main/res/drawable/pin_code_dots.xml @@ -6,4 +6,4 @@ android:drawable="@drawable/pin_code_dot_fill"/> - \ 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 2b6c113359..cb22863694 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 @@ -41,4 +41,4 @@ ?vctr_content_primary - \ 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 4e2c918173..52ee019e7b 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -136,7 +136,6 @@ dependencies { implementation libs.jetbrains.coroutinesCore implementation libs.jetbrains.coroutinesAndroid - implementation libs.androidx.appCompat implementation libs.androidx.core // Lifecycle @@ -155,12 +154,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 @@ -176,10 +174,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.11' @@ -201,8 +195,6 @@ dependencies { implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.49' 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-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 be24fc272d..0dd4ab297a 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 @@ -386,7 +385,6 @@ dependencies { // FlowBinding implementation libs.github.flowBinding implementation libs.github.flowBindingAppcompat - implementation libs.github.flowBindingMaterial implementation libs.airbnb.epoxy implementation libs.airbnb.epoxyGlide