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

rnentjes

08/01/2020, 10:33 AM
When I want to create a multiplatform library In 1.4-rc I must specify at least one target. I would like to be able to create a library that only has common code. And any projects that includes this library should be able to use that code in any target. Using IR as a target it seems like this should be possible as any target should be able to use ir code. Anyone know if you can do this and how to do it?
👀 1
j

Javier

08/01/2020, 10:38 AM
What is IR?
r

rnentjes

08/01/2020, 10:45 AM
Internal Representation, new compiled code format in 1.4. See https://blog.jetbrains.com/kotlin/2019/12/what-to-expect-in-kotlin-1-4-and-beyond/
That article seems to hint that what I want is (or will be) possible
b

Big Chungus

08/01/2020, 10:52 AM
You need to declare all targets you want to support (even if you don;t have any target-specific code)
Then separate artifacts will be generated and published from your common sourceSet for each target
r

rnentjes

08/02/2020, 10:38 AM
Yeah, hopefully they will remove that requirement as it's a pain to have to build for all platforms for code that has nothing platform specific.
g

gildor

08/02/2020, 12:42 PM
I think it's the final goal, to allow publish IR based libraries which do not depend on any platform, but it is not possible yet, as I know