I would like to make a multiplatform project with ...
# multiplatform
d
I would like to make a multiplatform project with only jvm targets. However, the common source set can't access the JRE classes. I tried adding them as a dependency like so:
Copy code
implementation(fileTree("$directoryJre/lib/ext"))
which makes them show up in the gradle view of intellij, but it does not work. The same goes for other java dependencies I add in the common source set. It would be useful to be able to configure a multiplatform project as jvm-only, allowing java dependencies as well as the JRE to be accessed from the common source. I have a few use cases where the ability to use expect/actual declarations would be invaluable, and I'm sure that there would be more: • I have a project that I would like to implement as an external process or injected dll • Any project targeting one of a set of libraries per build, for example, minecraft server plugins that support multiple server platforms (bukkit, nukkit, sponge, glowstone) If something like this is already possible using some workaround, please do let me know.
k
Declare a base jvm target, then have downstream targets depend on that. Have a similar setup in stately for native side https://github.com/touchlab/Stately/blob/master/build.gradle#L89
d
That makes sense, how do I make it a jvm-targeting source set, meaning I can have java dependencies?
And could I have expect declarations in that source set?
k
Don't know either answer
d
Okay, thanks, will try some stuff
i
Depending on JDK in the common code shared between multiple JVM targets is not supported yet. You have to resort to expect declarations where it is possible.
d
Not supported yet - so it's on the table?
r