A decentralized music tracking and discovery platform built on AT Protocol 🎵 rocksky.app
spotify atproto lastfm musicbrainz scrobbling listenbrainz
0

Configure Feed

Select the types of activity you want to include in your feed.

fix(sdk/kotlin): alias JNA Library import to unblock compileKotlin

The SDK exposes a UniFFI Object named `Library` (the uploaded-music client),
whose generated Kotlin class shares its simple name with `com.sun.jna.Library`
imported by the UniFFI runtime. An unqualified `Library` then resolved to our
Object, breaking `UniffiLib`/`loadIndirect` and failing `:rocksky:compileKotlin`
during `sdk/publish :kotlin`.

Alias the JNA import as `JnaLibrary` (so unqualified `Library` stays our Object)
and qualify the two JNA usages. Bake the same post-patch into gen-bindings.sh so
future UniFFI regens stay fixed.

+26 -3
+3 -3
sdk/kotlin/rocksky/src/main/kotlin/uniffi/rocksky_uniffi/rocksky_uniffi.kt
··· 17 17 // compile the Rust component. The easiest way to ensure this is to bundle the Kotlin 18 18 // helpers directly inline like we're doing here. 19 19 20 - import com.sun.jna.Library 20 + import com.sun.jna.Library as JnaLibrary 21 21 import com.sun.jna.IntegerType 22 22 import com.sun.jna.Native 23 23 import com.sun.jna.Pointer ··· 378 378 return "rocksky_uniffi" 379 379 } 380 380 381 - private inline fun <reified Lib : Library> loadIndirect( 381 + private inline fun <reified Lib : JnaLibrary> loadIndirect( 382 382 componentName: String 383 383 ): Lib { 384 384 return Native.load<Lib>(findLibraryName(componentName), Lib::class.java) ··· 975 975 // A JNA Library to expose the extern-C FFI definitions. 976 976 // This is an implementation detail which will be called internally by the public API. 977 977 978 - internal interface UniffiLib : Library { 978 + internal interface UniffiLib : JnaLibrary { 979 979 companion object { 980 980 internal val INSTANCE: UniffiLib by lazy { 981 981 loadIndirect<UniffiLib>(componentName = "rocksky_uniffi")
+23
sdk/scripts/gen-bindings.sh
··· 53 53 # published jar bundles the native lib, so the default JNA loader is kept as-is. 54 54 gen kotlin "$sdk/kotlin/rocksky/src/main/kotlin" 55 55 56 + # The SDK exposes a UniFFI Object named `Library` (the uploaded-music client), 57 + # whose generated Kotlin class collides with the `com.sun.jna.Library` UniFFI 58 + # imports for its own runtime — an unqualified `Library` then resolves to our 59 + # class and `compileKotlin` fails. Alias the JNA import so unqualified `Library` 60 + # stays our Object, and qualify the two JNA usages. 61 + python3 - "$sdk/kotlin/rocksky/src/main/kotlin/uniffi/rocksky_uniffi/rocksky_uniffi.kt" <<'PY' 62 + import sys 63 + p = sys.argv[1] 64 + s = open(p).read() 65 + subs = [ 66 + ("import com.sun.jna.Library\n", "import com.sun.jna.Library as JnaLibrary\n"), 67 + ("private inline fun <reified Lib : Library> loadIndirect(", 68 + "private inline fun <reified Lib : JnaLibrary> loadIndirect("), 69 + ("internal interface UniffiLib : Library {", "internal interface UniffiLib : JnaLibrary {"), 70 + ] 71 + for old, new in subs: 72 + if old not in s: 73 + sys.exit(f"ABORT: kotlin patch anchor not found — uniffi output changed: {old!r}") 74 + s = s.replace(old, new, 1) 75 + open(p, "w").write(s) 76 + print(" patched kotlin JNA Library import -> JnaLibrary alias") 77 + PY 78 + 56 79 echo "done. ruby/clojure use the capi C ABI (lib only); erlang/elixir/gleam use" 57 80 echo "the NIF — run ./build-native.sh and each package's ./build-core.sh."