holgerbrandl / krangl

krangl is a {K}otlin DSL for data w{rangl}ing
MIT License
560 stars 50 forks source link

Importing krangl in a multiplatform project does not work #132

Closed clmnin closed 3 years ago

clmnin commented 3 years ago

Question

How to add krangl as a dependency in a multiplatform project?

Summary

I'm building a multiplatform excel parser for myself and so I'm building an android app and a desktop app.

I used krangl in jupyter notebook to prepare the set of steps to let me do the parsing and now I'm working on integrating these operations into the Android and Desktop app. But when I try importing the lib from a common shared module (commonMain) the IDE fails to import it

Minimal reproducible example

  1. Download the multiplatform todo sample app - Link
  2. Open the build.gradle.kts in common/compose-ui/build.gradle.kts
  3. Add the dependency
    implementation("com.github.holgerbrandl:krangl:0.17")
  4. Try importing the library in TodoMainUi - common/compose-ui/src/commonMain/kotlin/example/todo/common/ui/TodoMainUi.kt
    import krangl.readExcel

But it works in the desktop module

  1. Download the todo app
  2. Add the dependency in the desktop module's build.gradle.kts - desktop/build.gradle.kt
    implementation("com.github.holgerbrandl:krangl:0.17")
  3. Import krangl in desktop Main.kt - desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt
clmnin commented 3 years ago

krangl is not a multiplatform library and so if I try to import it from commonMain it won't work. It works in platform specifc modules like desktopMain and androdMain which can be JVM dependent libraries.