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

Module Advice for Kotlin Multiplatform

Open handstandsam opened this issue 3 years ago • 2 comments

Feature Request Provide Module Advice for Modules that are "KMP Ready" or "commonMain compatible". I love the current feature that allows us to determine if an Android module could be a JVM module! I was wondering if we could go one step further to determine if it could be a multiplatform module by adding additional constraints.

Describe the solution you'd like

I'd like to get module advice (like you have with this AndroidScore) that would let me know if the module could be multiplatform compatible. If it was, then this means that the module would be compatible with kmp4free https://github.com/handstandsam/kmp4free

A few checks to consider:

  • Are there any java.util.* imports? If so, how many?
  • Are there any dependencies (including transitive) that are not compatible with Kotlin Multiplatform? This is the hard one. I can't think of a way of determining multi-platform compatibility other than having a database that could be programmatically updated. It could be a bundled file in this library (or elsewhere), or could be pulled down every time.

Describe alternatives you've considered

Manually going through JVM modules and seeing what their dependencies are.

Additional context

FYI: This is DIFFERENT from "Kotlin Multiplatform Support" Issue. https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/issues/228 This ticket would identify Android & JVM Modules that are "KMP Ready", but does not deal with scanning projects with a multiplatform structure.

Hopefully we'll get some good initial discussion here on this Twitter thread: https://twitter.com/HandstandSam/status/1552154145917784065

handstandsam avatar Jul 27 '22 04:07 handstandsam

Are there any dependencies (including transitive) that are not compatible with Kotlin Multiplatform? This is the hard one.

You can analyze Gradle Metadata, the replacement to pom.xml files, which are JSON files with the .module extension, to have that information.

LouisCAD avatar Jul 27 '22 11:07 LouisCAD

You can probably have that information via Gradle APIs as well by looking for the dependency attributes, since there will be KMP specific attributes, with keys having values that point to other artifacts that support other platforms. This will be helpful to inform about the compatible Kotlin targets.

LouisCAD avatar Jul 27 '22 11:07 LouisCAD