Meeting notes from the first Swift/Java interoperability call.
Swift Java Community Call Notes
- Konrad
- Mads
- Thomas
- Greg
- Joannis
- Marc
- Finagolfin*
Agenda:
-
Swift Java “JNI only” Package status -- Marc
- Konrad: Working through it, following swiftlang repo creation process, should hopefully have it done soon
-
Android & JNIOnLoad fun? -- Mads
- 28 ang below we could load libart etc.
- above 30? there's official api access
- Mads: would be good to not have different strategies for every platform
- Preferred: OnLoad and store the vm ref
- calling the createJVM probably we don't care about
- We wait on swift-java-jni probably
- concerned about linking
- We currently static link swift-java lib;
- Official way is the
JNIOnLoadon load time of the lib- Marc: only problem is that its not transitively called
- The "get jvms" API does not work on 29, and 30; so we can't use that
- Standard way in SKIP: manually call during app startup, call into a native function and hang onto jvm from there
- ACTION: Wait till we do swift-java-jni, then cooperate on something that should serve most if not all use-cases nicel
-
How can we contribute, is there some guide about patterns to follow? -- Greg
- Focus on interop API; say we wanted to contribute nonescaping closures etc.
- Architecturally explain maybe explain some more.
- ACTION: Konrad to write up some architectural hints to help "how to contribite", mark some issues as “good first issue”
-
(Old) Android example issues -- Thomas
- Sounds like this was about Mads’ old example; the new example should be easier to follow, but please file issues or PR if something’s off about it still.
- Had some issues with the android swift-java example
- Android SDK 6.2 release mixup in SDKs perhaps caused issues?
- Mads: This sounds like the old example, that is expected
- Try the new example: hello-swift-java
-
Packaging and how to link – Mads
- Mads: how do we package things, i.e. do we static link "single big project with all dependencies"
- We need a way to express where our dependencies are for jextract for this
- Marc: everything in SKIP is forced to be dynamic linked; The static linking in theory is interesting
- However in practice the static linking if two libs do that that's bad.
- Currently SKIP mandate all dependencies
- Currently: SwiftPM has no way to force "all static"
- Should we do a feature to "force dynamic libs in this build"
- Not all dependencies CAN be static linked so this is a safer bet; more general
- There's problems about version clashes like if multiple dependencies do depend on sqlite etc.
- e.g. GRDB has top level packages because
GRDB-dynamic
- e.g. GRDB has top level packages because
- ACTION: Konrad, make an issue about the linking discussion
- Mads: how do we package things, i.e. do we static link "single big project with all dependencies"
-
ACTION: Greg, some quick update to the android example how to add dependencies
Status updates:
- Mads:
- jextract+jni: async funcs are now imported as
CompletableFutures(API 24) - jextract+jni: working on nested types in Swift
- jextract+jni: implementing Java "interfaces" as protocols using Swift type
- jextract+jni: async funcs are now imported as
- Konrad:
- Working on calling Java funcs from Swift and automatic import of Java APIs (wrap-java)
- Please try things out and report issues for things that don’t work
Gradle plugins / building:
- Konrad: Discussion about building -linux-arm64-6.2.1.jar etc, vs REALLY fat jars etc
- Really use-case dependent, some people want one or the other; a Gradle plugin could simplify this a bit, because it’s really tricky to get right at first.
- Marc: Skip builds
- AAR, every swift build takes the .so files and bindings and THEN the AARs are put together into an APK
- ABI compatibility discussion
- Lack of ABI kinda troublesome adoption because matching Swift versions would lead to “everyone rebuild for new Swift version”, however short term this may be managable;
- This is kind of new with the arrival of swift-java and jars which contain binary compiled Swift; Server projects didn’t really encounter this up until now.
Next call
We will schedule another call in 2 weeks time, I will share a meeting link and exact date in a new forums thread.