https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
k

krtko

03/16/2018, 11:48 PM
A platform module can only import one common module. <Issue resolved> Thanks 🙂
i

ilya.gorbunov

03/17/2018, 12:26 AM
common modules can only depend on other common modules and platform module can depend on common with expectedBy dependency.
k

krtko

03/17/2018, 12:29 AM
But you can only have one
expectedBy
import. I thought it was just for the Expect/Actual set up. Also importing multiple common modules the normal way seems to be working
i

ilya.gorbunov

03/17/2018, 12:31 AM
Each common module should have corresponding platform module, which declares expectedBy dependency on it. Currently it is 1-to-1 relationship (but for each platform)
k

krtko

03/17/2018, 12:33 AM
Can a platform module import multiple common modules (all without any expect/actual classes) just fine?
Alright I think I finally get what you were saying. So a platform module can only import one common module and it can only import it via expectBy
So can you not chain multiple common modules together? It does not look like you can.
Ok known limitation for now. Good to know @ilya.gorbunov Thank you
i

ilya.gorbunov

03/17/2018, 12:53 AM
You can chain common modules together, but each common module must have a platform implementation module (even if there are no
expect
declarations), and platform modules must be chained respectively
k

krtko

03/17/2018, 1:05 AM
When I do Core (imports nothing) Shared (imports Core) App (imports Shared) I get an error saying Shared is missing the Core’s classes
If this is a bug. I can look into it further and open a ticket?
i

ilya.gorbunov

03/17/2018, 1:25 AM
You need to create Core-JVM for Core and add a dependency in App on Core-JVM
k

krtko

03/17/2018, 1:27 AM
Shared has the Core dependencies? Isn’t that the same thing?
Or are you saying something like Core (imports nothing, common) Shared (imports Core, contains expect class, common) AppDependency(imports Core and Shared, JVM) App (expectBy AppDependency, contains actual class, JVM)
i

ilya.gorbunov

03/17/2018, 2:03 AM
say you have
A:common
,
B:common (depends on A:common)
then you need to have
A:platform expectedBy A:common
,
B:platform expectedBy B:common
and
B:platform depends on A:platform
k

krtko

03/17/2018, 2:05 AM
Oh
So every common module would need a “mock” platform module if theres no expectBy
Thanks for making this clear
i

ilya.gorbunov

03/17/2018, 2:07 AM
Starting from 1.2.40 it will be possible not to have A:platform, and declare both expectedBy dependencies in B:platform
k

krtko

03/17/2018, 2:16 AM
Awesome thanks for letting me know. So far the multiplatform set up is pretty neat. My company is building our web app with it. Thank you for your help
4 Views