Merge pull request #5780 from ofalvai/dependency-cleanup

Remove unused dependencies
This commit is contained in:
Benoit Marty 2022-05-30 15:41:10 +02:00 committed by GitHub
commit 0806e7358a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 97 additions and 34 deletions

View File

@ -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

View File

@ -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
}
}
}
}

View File

@ -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"

View File

@ -55,5 +55,6 @@ dependencies {
implementation libs.androidx.appCompat
implementation libs.androidx.recyclerview
implementation libs.google.material
}
api libs.androidx.viewpager2
implementation libs.androidx.transition
}

View File

@ -50,6 +50,5 @@ android {
}
dependencies {
implementation libs.androidx.appCompat
implementation libs.jetbrains.coroutinesAndroid
}

View File

@ -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

View File

@ -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

View File

@ -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'
}
}

View File

@ -10,4 +10,4 @@
android:height="70dp" />
</shape>
</item>
</ripple>
</ripple>

View File

@ -10,4 +10,4 @@
<size
android:width="24dp"
android:height="24dp"/>
</shape>
</shape>

View File

@ -9,4 +9,4 @@
<size
android:width="24dp"
android:height="24dp"/>
</shape>
</shape>

View File

@ -6,4 +6,4 @@
android:drawable="@drawable/pin_code_dot_fill"/>
<item
android:drawable="@drawable/pin_code_dot_empty"/>
</selector>
</selector>

View File

@ -41,4 +41,4 @@
<item name="android:textColor">?vctr_content_primary</item>
</style>
</resources>
</resources>

View File

@ -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
}

View File

@ -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

View File

@ -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"
}
}

View File

@ -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