Skip to content

Conversation

lewisfm
Copy link

@lewisfm lewisfm commented May 18, 2025

This PR contains the changes required to publish the Kotlin bindings to Maven.

  • Adds the POM metadata needed for publishing to Maven Central
  • Sets up Dokka for generating API documentation (docs are required by Maven Central)
  • Sets up code signing via GPG (required by Maven Central)

To actually publish:

  1. Make a Maven Central account https://central.sonatype.org/register/central-portal/
  2. Set up GPG https://central.sonatype.org/publish/requirements/gpg/
  3. Run ./gradlew publish -Psigning.keyId=GPGKEYID to create the jar package.
  4. Upload kotlin/lib/build/distributions/deploy.jar to Maven Central https://central.sonatype.com/publishing
  5. Wait for it to verify and then confirm it

Here's the package I made while testing: https://central.sonatype.com/artifact/io.github.doinkythederp/iroh

Note: For the Kotlin module to be multi-platform, it will need to contain the iroh cdylib built for multiple platforms.

Make your native library available on your classpath, under the path {OS}-{ARCH}/{LIBRARY}, where {OS}-{ARCH} is JNA's canonical prefix for native libraries (e.g. win32-x86, linux-amd64, or darwin). If the resource is within a jar file it will be automatically extracted when loaded.
https://github.com/java-native-access/jna/blob/master/www/GettingStarted.md

resources/
	darwin/
		libiroh_ffi.dylib
	linux-amd64/
		libiroh_ffi.so
	...etc...

@n0bot n0bot bot added this to iroh May 18, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh May 18, 2025
@dignifiedquire
Copy link
Contributor

thanks a lot! I will try and look at this this week

lewisfm and others added 2 commits June 16, 2025 20:53
This should help to improve caching and keeps some volatile generated code out of version control.
@lewisfm
Copy link
Author

lewisfm commented Jun 17, 2025

I imagine the best way to achieve a multi-platform JAR is to update the CI matrix to generate the dylibs as artifacts, then have one final JVM build step which pulls in all of them. Alternatively, it might be possible to use cross, but it seems to be non-trivial to cross-compile for macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

2 participants