Skip to content

Commit

Permalink
Merge pull request #188 from LachlanMcKee/introduce-project-health-pl…
Browse files Browse the repository at this point in the history
…ugin

Introduced dependency analysis plugin and fixed issues
  • Loading branch information
LachlanMcKee authored Feb 12, 2023
2 parents 3388af9 + 045b7da commit 4e4d569
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 85 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
with:
arguments: |
build
projectHealth
mergeLintSarif
mergeDetektSarif
:plugins:buildPlugins
Expand All @@ -46,7 +47,9 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: reports
path: '**/build/reports'
path: |
**/build/reports/
!**/build/reports/dependency-analysis/
instrumentation-tests:
name: Instrumentation tests
Expand Down
7 changes: 3 additions & 4 deletions binder/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ tasks.withType<Test> {
}

dependencies {
implementation(libs.rxjava2)
api(libs.rxjava2)
implementation(libs.rxkotlin)
implementation(libs.kotlin.stdlib)

testImplementation(libs.junit5)
testImplementation(libs.junit.params)
testImplementation(libs.junit.platform.launcher)
testRuntimeOnly(libs.junit5.engine)
testImplementation(libs.junit5.api)
testImplementation(libs.mockito.kotlin)
}
26 changes: 26 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@ buildscript {

plugins {
id("mvi-core-collect-sarif")
id("com.autonomousapps.dependency-analysis") version libs.versions.dependencyAnalysis.get()
}

dependencyAnalysis {
issues {
all {
onIncorrectConfiguration {
severity("fail")
}
onUnusedDependencies {
severity("fail")
}
}
project(":mvicore-demo:mvicore-demo-app") {
onUnusedDependencies {
severity("fail")
exclude("com.jakewharton.scalpel:scalpel") // Accessed using reflection
}
}
project(":mvicore-android") {
onUnusedDependencies {
severity("fail")
exclude("androidx.test:runner") // Accessed using reflection
}
}
}
}

tasks.register("clean", Delete::class) {
Expand Down
26 changes: 10 additions & 16 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[versions]
kotlinVersion = "1.7.10"
detekt = "1.22.0"
dependencyAnalysis = "1.19.0"

# Android
androidLifecycleVersion = "2.5.1"
Expand All @@ -23,14 +24,11 @@ scalpelVersion = "1.1.2"
glideVersion = "4.13.2"

# Testing
okhttpVersion = "3.14.9"
retrofitVersion = "2.4.0"
gsonVersion = "2.10.1"

# Testing
junitVersion = "4.13.2"
junit5Version = "5.9.2"
junitPlatformLauncherVersion = "1.9.2"
junit5 = "5.9.2"
supportTestVersion = "1.3.0"
mockitoKotlinVersion = "4.1.0"

Expand All @@ -39,7 +37,9 @@ mockitoKotlinVersion = "4.1.0"
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk7", version.ref = "kotlinVersion" }

# Android
androidx-lifecycle-java8 = { module = "androidx.lifecycle:lifecycle-common-java8", version.ref = "androidLifecycleVersion" }
androidx-arch-core-runtime = "androidx.arch.core:core-runtime:2.1.0"
androidx-lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "androidLifecycleVersion" }
androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime", version.ref = "androidLifecycleVersion" }
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidAppCompatVersion" }
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintLayoutVersion" }
google-material = { module = "com.google.android.material:material", version.ref = "androidMaterialVersion" }
Expand All @@ -52,9 +52,6 @@ rxandroid = { module = "io.reactivex.rxjava2:rxandroid", version.ref = "rxAndroi
# DI
dagger-runtime = { module = "com.google.dagger:dagger", version.ref = "daggerVersion" }
dagger-compiler = { module = "com.google.dagger:dagger-compiler", version.ref = "daggerVersion" }
dagger-android-runtime = { module = "com.google.dagger:dagger-android", version.ref = "daggerVersion" }
dagger-android-support = { module = "com.google.dagger:dagger-android-support", version.ref = "daggerVersion" }
dagger-android-processor = { module = "com.google.dagger:dagger-android-processor", version.ref = "daggerVersion" }

# DebugDrawer
debugdrawer-impl = { module = "com.github.lenguyenthanh.debugdrawer:debugdrawer", version.ref = "debugDrawerVersion" }
Expand All @@ -63,7 +60,6 @@ debugdrawer-view-impl = { module = "com.github.lenguyenthanh.debugdrawer:debugdr
debugdrawer-noop = { module = "com.github.lenguyenthanh.debugdrawer:debugdrawer-no-op", version.ref = "debugDrawerVersion" }
debugdrawer-view-noop = { module = "com.github.lenguyenthanh.debugdrawer:debugdrawer-view-no-op", version.ref = "debugDrawerVersion" }
debugdrawer-commons = { module = "com.github.lenguyenthanh.debugdrawer:debugdrawer-commons", version.ref = "debugDrawerVersion" }
debugdrawer-actions = { module = "com.github.lenguyenthanh.debugdrawer:debugdrawer-actions", version.ref = "debugDrawerVersion" }
debugdrawer-scalpel = { module = "com.github.lenguyenthanh.debugdrawer:debugdrawer-scalpel", version.ref = "debugDrawerVersion" }
debugdrawer-timber = { module = "com.github.lenguyenthanh.debugdrawer:debugdrawer-timber", version.ref = "debugDrawerVersion" }
debugdrawer-networkQuality = { module = "com.github.lenguyenthanh.debugdrawer:debugdrawer-network-quality", version.ref = "debugDrawerVersion" }
Expand All @@ -75,21 +71,19 @@ glide-runtime = { module = "com.github.bumptech.glide:glide", version.ref = "gli
glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "glideVersion" }

# Network
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttpVersion" }
retrofit-runtime = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofitVersion" }
retrofit-adapter-rxjava2 = { module = "com.squareup.retrofit2:adapter-rxjava2", version.ref = "retrofitVersion" }
retrofit-converter-simplexml = { module = "com.squareup.retrofit2:converter-simplexml", version.ref = "retrofitVersion" }
gson = { module = "com.google.code.gson:gson", version.ref = "gsonVersion" }

# Testing
junit = { module = "junit:junit", version.ref = "junitVersion" }
junit5 = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit5Version" }
junit-params = { module = "org.junit.jupiter:junit-jupiter-params", version = "junit5Version"}
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junitPlatformLauncherVersion" }
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlinVersion" }
junit4 = "junit:junit:4.13.2"
junit5-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit5" }
junit5-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit5" }
junit5-params = { module = "org.junit.jupiter:junit-jupiter-params", version = "junit5"}
mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockitoKotlinVersion" }
androidx-test-runner = { module = "androidx.test:runner", version.ref = "supportTestVersion" }
androidx-test-rules = { module = "androidx.test:rules", version.ref = "supportTestVersion" }
hamcrest-core = "org.hamcrest:hamcrest-core:1.3"

plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinVersion" }
plugin-detekt = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" }
Expand Down
24 changes: 12 additions & 12 deletions mvicore-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ android {
}

dependencies {
implementation(libs.androidx.appcompat)
implementation(libs.androidx.lifecycle.java8)
implementation(libs.kotlin.stdlib)
api(project(":mvicore"))
api(project(":binder"))
api(libs.androidx.lifecycle.common)
api(libs.rxjava2)

implementation(libs.rxjava2)
implementation(libs.rxkotlin)
implementation(libs.kotlin.stdlib)
implementation(libs.rxandroid)

testImplementation(libs.junit5)
testImplementation(libs.junit.params)
testImplementation(libs.junit.platform.launcher)
testRuntimeOnly(libs.junit5.engine)
testImplementation(libs.junit5.api)
testImplementation(libs.junit5.params)
testImplementation(libs.androidx.arch.core.runtime)
testImplementation(libs.androidx.lifecycle.runtime)

androidTestImplementation(libs.junit)
androidTestImplementation(libs.junit4)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.androidx.test.rules)

implementation(project(":mvicore"))
androidTestImplementation(libs.hamcrest.core)
}
14 changes: 6 additions & 8 deletions mvicore-debugdrawer/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,16 @@ android {
}

dependencies {
implementation(libs.androidx.constraintlayout)
api(project(":mvicore"))
api(libs.debugdrawer.base)
debugApi(libs.debugdrawer.impl)
releaseApi(libs.debugdrawer.noop)

implementation(libs.androidx.constraintlayout)
implementation(libs.rxjava2)
implementation(libs.rxkotlin)

implementation(libs.kotlin.stdlib)

implementation(libs.debugdrawer.base)
debugImplementation(libs.debugdrawer.impl)
debugImplementation(libs.debugdrawer.view.impl)
releaseImplementation(libs.debugdrawer.noop)
releaseImplementation(libs.debugdrawer.view.noop)

implementation(project(":mvicore"))
releaseImplementation(libs.debugdrawer.view.noop)
}
8 changes: 1 addition & 7 deletions mvicore-demo/mvicore-demo-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies {
implementation(project(":mvicore-demo:mvicore-demo-feature1"))
implementation(project(":mvicore-demo:mvicore-demo-feature2"))
implementation(project(":mvicore-plugin:middleware"))
implementation(project(":binder"))

// Kotlin
implementation(libs.kotlin.stdlib)
Expand All @@ -56,18 +57,12 @@ dependencies {

// DI
implementation(libs.dagger.runtime)
implementation(libs.dagger.android.runtime)
implementation(libs.dagger.android.support)
kapt(libs.dagger.compiler)
kapt(libs.dagger.android.processor)

// DebugDrawer
debugImplementation(libs.debugdrawer.impl)
debugImplementation(libs.debugdrawer.view.impl)
releaseImplementation(libs.debugdrawer.noop)
releaseImplementation(libs.debugdrawer.view.noop)
implementation(libs.debugdrawer.commons)
implementation(libs.debugdrawer.actions)
implementation(libs.debugdrawer.scalpel)
implementation(libs.debugdrawer.base)
implementation(libs.debugdrawer.timber)
Expand All @@ -76,7 +71,6 @@ dependencies {
// Utils
implementation(libs.timber)
implementation(libs.scalpel)
implementation(libs.okhttp)
implementation(libs.glide.runtime)
kapt(libs.glide.compiler)
}
9 changes: 3 additions & 6 deletions mvicore-demo/mvicore-demo-catapi/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ android {
}

dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.androidx.appcompat)

implementation(libs.rxjava2)
implementation(libs.rxandroid)
api(libs.rxjava2)
api(libs.retrofit.runtime)

implementation(libs.retrofit.runtime)
implementation(libs.kotlin.stdlib)
implementation(libs.retrofit.adapter.rxjava2)
implementation(libs.retrofit.converter.simplexml)

Expand Down
8 changes: 2 additions & 6 deletions mvicore-demo/mvicore-demo-feature1/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ android {
}

dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.androidx.appcompat)

implementation(libs.rxjava2)
implementation(libs.rxandroid)
api(project(":mvicore"))

implementation(project(":mvicore"))
implementation(libs.kotlin.stdlib)
}
11 changes: 4 additions & 7 deletions mvicore-demo/mvicore-demo-feature2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ android {
}

dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.androidx.appcompat)

implementation(libs.rxjava2)
implementation(libs.rxandroid)
api(libs.rxjava2)
api(project(":mvicore"))
api(project(":mvicore-demo:mvicore-demo-catapi"))

implementation(project(":mvicore"))
implementation(project(":mvicore-android"))
implementation(project(":mvicore-demo:mvicore-demo-catapi"))
implementation(libs.kotlin.stdlib)
}
5 changes: 2 additions & 3 deletions mvicore-diff/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ tasks.withType<Test> {
dependencies {
implementation(libs.kotlin.stdlib)

testImplementation(libs.junit5)
testImplementation(libs.junit.params)
testImplementation(libs.junit.platform.launcher)
testRuntimeOnly(libs.junit5.engine)
testImplementation(libs.junit5.api)
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ModelWatcherTest {
}

@Test
fun `invokes callback with combined diffStrategy using "or"`() {
fun `invokes callback with combined diffStrategy using 'or'`() {
val results = testWatcher<Model, Model>(
listOf(
Model(list = listOf(""), int = 1),
Expand All @@ -120,7 +120,7 @@ class ModelWatcherTest {
}

@Test
fun `invokes callback with combined diffStrategy using "and"`() {
fun `invokes callback with combined diffStrategy using 'and'`() {
val results = testWatcher<Model, Model>(
listOf(
Model(list = listOf(""), int = 1),
Expand Down
3 changes: 2 additions & 1 deletion mvicore-plugin/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ java {
base.archivesBaseName = "mvicore-plugin-common"

dependencies {
implementation(libs.gson)
api(libs.gson)

implementation(libs.kotlin.stdlib)
}
7 changes: 4 additions & 3 deletions mvicore-plugin/idea/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ tasks {
}

dependencies {
implementation(libs.rxjava2)
api(project(":mvicore-plugin:common"))
api(libs.gson)
api(libs.rxjava2)

implementation(libs.rxkotlin)
implementation(libs.gson)
implementation(project(":mvicore-plugin:common"))
implementation(libs.kotlin.stdlib)
}
11 changes: 6 additions & 5 deletions mvicore-plugin/middleware/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ java {
base.archivesBaseName = "mvicore-plugin-middleware"

dependencies {
implementation(libs.rxjava2)
implementation(libs.rxkotlin)
implementation(libs.gson)
implementation(project(":mvicore"))
implementation(project(":mvicore-plugin:common"))
api(project(":binder"))
api(project(":mvicore-plugin:common"))
api(libs.rxjava2)
api(libs.gson)

implementation(libs.kotlin.stdlib)
implementation(libs.rxkotlin)
}
8 changes: 4 additions & 4 deletions mvicore/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ tasks.withType<Test> {

dependencies {
api(project(":binder"))
implementation(libs.rxjava2)
api(libs.rxjava2)
implementation(libs.rxkotlin)
implementation(libs.kotlin.stdlib)

testImplementation(libs.junit5)
testImplementation(libs.junit.params)
testImplementation(libs.junit.platform.launcher)
testRuntimeOnly(libs.junit5.engine)
testImplementation(libs.junit5.api)
testImplementation(libs.junit5.params)
testImplementation(libs.mockito.kotlin)
}

0 comments on commit 4e4d569

Please sign in to comment.