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

andylamax

07/02/2021, 7:56 AM
Hi there, Currently I have been writing a lot of libraries. And the end users of my libraries a primarily not kotlin users. They are mostly Java. So, my API designs are now so highly considerate when developing API with an intention to provide nice interop. Current Status: When I write my API, all of the kotlin test reside in
commonMain
, and just for clarification, I write a couple of Java test in
jvmTest/java
as well to make my self confident that my Java users won't scream at me Question: Is there a way that I can configure my kotlin multiplafrom library and write javascript (or even better, typescript) test in typescript that consume my kotlin lib? something like
jsTest/javascript
or
jsTest/typescript
? Extended Question: Can that be achieved similar to ObjC? C? say
nativeTest/objectiveC
or
nativeTest/C
🚫 2
b

Big Chungus

07/02/2021, 8:02 AM
nope. But you could use github.com/mpetuska/npm-publish to pack your js bit into js module tarball and install it via
file:../path
version in an isolated regular js/ts module that runs tests via jest or mocha as usual
Same approach could be taken for obj-c/swift, pack kotlin code in framework and test it from xcode in isolation
a

andylamax

07/02/2021, 8:04 AM
Thanks, I think this is worthy of a feature request. No?
b

Big Chungus

07/02/2021, 8:04 AM
Too big of a change for something that doesn't have that many use-cases in my opinion
I'd rather they focused on union types or multiple receivers over this 😛
a

andylamax

07/02/2021, 8:06 AM
hahahahahaha, let me try battling with the javascript side. I think a gradle plugin can make this possible
t

Tijl

07/02/2021, 10:23 AM
not using the kotlin multiplatform plugin, but keep in mind gradle has other plugins for JS and for (Objective) C, so you could still do what you describe in a single project, you just have to use some gradle-glue to tie it together. you can even, using
srcDirs
attributes, have the sourcesets live next to each other
3 Views