dependency-analysis-gradle-plugin icon indicating copy to clipboard operation
dependency-analysis-gradle-plugin copied to clipboard

Support Kotlin multiplatform

Open martinbonnin opened this issue 5 years ago • 4 comments
trafficstars

Running the buildHealth task on apollo-android returns useful information but it looks like the plugin has some difficulties coping with multiplatform projects. For an exemple:

$ ./gradlew clean :apollo-normalized-cache-sqlite:aggregateAdvice

> Task :apollo-normalized-cache-sqlite:aggregateAdvice
Unused dependencies which should be removed:
- null(project(":apollo-api"))

Transitively used dependencies that should be declared directly as indicated:
- null(project(":apollo-api"))
- api("org.jetbrains.kotlin:kotlin-stdlib:1.3.72")
- api(project(":apollo-normalized-cache-api"))
- api("androidx.sqlite:sqlite:2.1.0")
- api("com.squareup.sqldelight:runtime-jvm:1.3.0")
  • the configuration of apollo-api is not recognized and null is displayed instead
  • :apollo-normalized-cache-api is already added as a api dependency on the commonMain sourceSet so I think it shouldn't be reported
  • the module has both JVM and Android targets and it's not clear whether the report is taking into account JVM, Android or both

This can be reproduced with the dependency-analysis branch

martinbonnin avatar Jul 20 '20 17:07 martinbonnin

Resolved with https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/pull/249.

autonomousapps avatar Aug 28 '20 19:08 autonomousapps

Can we reopen this one? With latest main, multiplatform projects are skipped with No main source set. No analysis performed.

Also, multiplatform publication have a "common" publication that is used as a pointer to the individual platform publications and using them triggers false positives, even if using them in non-multiplatform projects:

For an exemple:

   api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")

Will be trigger:

Transitively used dependencies that should be declared directly as indicated:
- api("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.3.9")

Even though it's mostly correct to only include the "common" publication and let gradle decide the implementation.

This can be reproduced with the use-dependency-analysis branch of apollo-android: https://github.com/apollographql/apollo-android/tree/use-dependency-analysis

I can provide a more minimal exemple if it helps.

martinbonnin avatar Oct 12 '20 12:10 martinbonnin

I think it will require a focused effort to support kotlin multiplatform, rather than trying to fix seeming bugs in an ad hoc manner. I will reopen this ticket with that in mind.

autonomousapps avatar Oct 12 '20 17:10 autonomousapps

Hello. Are there any updates on supporting KMM projects? It is a highly anticipated feature by our team. Thank you.

dmitriy1morozov avatar Apr 04 '23 08:04 dmitriy1morozov