Skip to content

Remove JNA, add Linux ARM64 support and GraalVM native-image compatibility#381

Merged
kdroidFilter merged 12 commits intomasterfrom
refactor/build-restructure-nucleus-pattern
Apr 9, 2026
Merged

Remove JNA, add Linux ARM64 support and GraalVM native-image compatibility#381
kdroidFilter merged 12 commits intomasterfrom
refactor/build-restructure-nucleus-pattern

Conversation

@kdroidFilter
Copy link
Copy Markdown
Owner

@kdroidFilter kdroidFilter commented Apr 9, 2026

Summary

This PR is a major overhaul of the native layer:

  • JNA fully removed: All platforms (Windows, Linux, macOS) now use JNI instead of JNA, reducing the packaged library size by ~20x on Linux
  • Linux ARM64 support: Native Linux code is now compiled for both x86_64 and aarch64
  • GraalVM native-image support: Added reachability-metadata.json, native-image.properties, and a NativeLibraryLoader utility for proper resource extraction at runtime
  • Native code restructured: Moved native sources into src/native/{macos,windows,linux}/ with per-platform build scripts
  • Kotlin sources migrated from src/commonMain/ to src/jvmMain/
  • CI refactored: New reusable build-natives.yaml workflow; updated PR check and publish workflows
  • Code quality: Added Detekt + Ktlint configuration
  • Gradle 9.4.1: Upgraded from 8.12

Fixes #376
Fixes #345

Test plan

  • Verify native build on each platform (macOS, Linux x86_64, Linux aarch64, Windows)
  • Verify GraalVM native-image compilation via ./gradlew :demo:nativeCompile
  • Verify demo app runs: ./gradlew :demo:run
  • Verify CI workflows pass on all platforms

kdroidFilter and others added 12 commits April 9, 2026 17:22
- Move native source from maclib/, winlib/, linuxlib/ to src/native/{macos,windows,linux}/
- Remove git submodules, inline native code directly
- Move Kotlin sources from src/commonMain/ to src/jvmMain/
- Add composetray/native/ namespace for native resources (gitignored)
- Add NativeLibraryLoader utility for JNA classpath extraction
- Add GraalVM reachability metadata and native-image.properties
- Create reusable build-natives.yaml CI workflow
- Refactor pr-build-check.yml and publish-on-maven.yml to use it
- Configure demo with Nucleus plugin and GraalVM native-image support
- Add Detekt + Ktlint code quality tools
- Add .editorconfig for style consistency
- Upgrade Gradle to 9.4.1
…ic X11 support, and update reachability metadata.
…hook

Replace JNA-based Windows implementation with pure JNI, following the same
patterns as Mac and Linux bridges. Add WindowsNativeBridge.kt with external
JNI declarations and jni_bridge.c wrapping the tray.h C API. Rewrite
WindowsTrayManager and WindowsOutsideClickWatcher to use JNI calls instead
of JNA structures and callbacks. Remove all JNA dependencies from build
configuration. Rename DLL output from tray.dll to WinTray.dll. Update
GraalVM reachability metadata and CI workflow for JDK requirement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ting

- Replace all wildcard imports with explicit imports across main module
- Break lines exceeding 120 char limit
- Move inline comments to separate lines per ktlint rules
- Rename MacOsWindowManager.kt to MacOSWindowManager.kt for PascalCase
- Rename AppId.kt to AppIdProvider.kt to match top-level declaration
- Exclude demo module from ktlint checks
- Fix POM description formatting in build.gradle.kts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kdroidFilter kdroidFilter changed the title Restructure build system following Nucleus patterns Remove JNA, add Linux ARM64 support and GraalVM native-image compatibility Apr 9, 2026
@kdroidFilter kdroidFilter merged commit 7cc7266 into master Apr 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider publishing libsystray for Linux arm64 On KDE, the tray icon displays an incorrect tooltip text

1 participant