swiftlang / swift-java

Apache License 2.0
724 stars 27 forks source link

[WIP] JExtractSwiftPlugin #138

Closed ktoso closed 1 week ago

ktoso commented 2 weeks ago

🚧 early work in progress 🚧

This is first steps to make an jextract-swift plugin.

If we're able to pull this off as a swiftpm plugin we would basically have a way to "make me a jar that exposes this swift module, that would be super simple to consume from Java.

Need to figure out how to actually make this work -- it can't be a build plugin, but preBuild also isn't quite enough.

We may have to make it a command plugin, since we need compilation OUTPUT of the module to then act on the swift interfaces.

ktoso commented 2 weeks ago

Before weekend snapshot:

Screenshot 2024-11-01 at 19 16 14

Basically this means you "just" write some swift sources, add the extract plugin to the given target. Add a small task in gradle to trigger swiftpm and this way gradle/java immediately see the wrappers. Upon changing swift -> gradle triggers swift build again and it's all very seamless 🥳