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

pajatopmr

03/28/2019, 12:45 PM
This may border on brain-dead-stupid, nevertheless. First, is it even possible to build a common module, deploy it and then use that module as a dependency for multiple independent platform modules, each deployed separately? Second, is this a really, really bad idea? It appeals to me because, assuming it can be made to work without too much pain, it offers multiple small independent modules, each likely to be easy to grok, fast to build, easy to test, and independent of platform quirks (like naming rules for test functions).
a

addamsson

03/28/2019, 12:47 PM
I'm doing this right now
but there is a caveat
p

pajatopmr

03/28/2019, 12:47 PM
I am trying to make this work now and the first hurdle is getting it deployed to maven local
a

addamsson

03/28/2019, 12:47 PM
you can only use common dependencies in common projects afaik
p

pajatopmr

03/28/2019, 12:48 PM
@addamsson do you have a github repo that shows what you have done?
l

LeoColman

03/28/2019, 12:48 PM
Really? You can't depend on a common module if you're building a JVM module, for example?
m

marstran

03/28/2019, 12:48 PM
Hmm, how does a common dependency even work? Does it somehow know where to find the actual artifact for each platform?
Like, you can't really compile a common artifact before you know its platform target, right?
a

addamsson

03/28/2019, 12:51 PM
@LeoColman you can build a jvm artifact from a common module and you can depend on that
wait a sec
p

pajatopmr

03/28/2019, 12:52 PM
Oh, I got it, I think. One deploys the common pieces (metadata?) to be used as a dependency for the common modules that each platform uses. Something along these lines.
a

addamsson

03/28/2019, 12:52 PM
so in this project I build all 3
common, jvm, js
and i have another project which depends on this
here I depend on common modules
p

pajatopmr

03/28/2019, 12:53 PM
@addamsson nice. I’ll check out now.
a

addamsson

03/28/2019, 12:53 PM
in the common module
and in the jvm module I depend on the jvm artifacts: https://github.com/Hexworks/amethyst/blob/master/amethyst.core/build.gradle#L50