Packaging Integration
kanvasPackage integrates Kanvas into the application's Compose Desktop distributable instead of requiring users to hand-copy runtime files after packaging.
The implementation locates the generated Compose application image, creates a Kanvas runtime directory inside the app image, copies the Java agent and native library, includes licensing notices, and patches launcher configuration.
Source: KanvasPlugin.kt
Why patch the generated app image?
Running through Gradle and shipping an application are different environments.
A development run can point at build-tree artifacts. A packaged application must instead have a stable path to:
kanvas-agent.jar- the platform native library
- runtime configuration
- license / third-party notices
Embedding those files into the application image makes the package self-contained.
The current code intentionally fails when it cannot identify the expected Compose app-image layout. That is safer than silently producing a package that launches without Kanvas.
Why notices travel with runtime binaries
The package step explicitly copies LICENSE and THIRD_PARTY_NOTICES.md alongside runtime artifacts. This keeps binary redistribution information attached to the artifact actually being shipped rather than relying on the source checkout remaining available.