I have a KMM project. It has one module `storage`,...
# multiplatform
b
I have a KMM project. It has one module
storage
, which implements a SqlDelight DB, per the SqlDelight Documentation (it’s worth noting that docs specify using
implementation()
for dependencies). I have a second module
feature
which has a dependency on the
storage
module, like so:
Copy code
sourceSets {
    val commonMain by getting {
        dependencies {
            implementation(project(":shared:storage"))
        }
    }
}
In my
feature
module, I can see/import/use classes and objects from the SqlDelight library:
Copy code
import app.cash.sqldelight.EnumColumnAdapter

...
val someValue = EnumColumnAdapter<MyEnum>().encode(someEnumValue)
That seems … not right? SqlDelight is an implementation detail of the
storage
module, and should not be exposed to other modules that have a dependency on
storage
. What am I missing here? I’m a bit of a novice with gradle, so perhaps it’s something obvious.
k
#squarelibraries might be a better channel to ask 🙂
Since
storage
is the module that generates the queries and schemas, that code is added to the module’s source set. So your
feature
module gets access to those non-internal/private APIs, just like any other code.
implementation
just means that APIs from
:shared:storage
won’t be further exposed to other modules that pull in
feature
module.
b
Thanks @Kirill Zhukov, I didn’t know #squarelibraries exists 😄
implementation
just means that APIs from
:shared:storage
won’t be further exposed to other modules that pull in
feature
module.
I guess I thought that same logic would apply … because I use
implementation("app.cash.sqlDelight")
in
:shared:storage
, so none of the sql delight api’s would be further exposed to things (like
:shared:feature
) that pull in the
storage
module.