compose-multiplatform
compose-multiplatform copied to clipboard
Support entitlements configuration for MacOs
The user had an issue when an app binary built and signed on CI didn't run locally:
$ /Applications/MyApp.app/Contents/MacOS/MyApp Error occurred during initialization of VM Could not reserve enough space for code cache (245760K)
The original report: https://kotlinlang.slack.com/archives/C01D6HTPATV/p1678957583077879?thread_ts=1678880842.552899&cid=C01D6HTPATV
Our options:
- Add more info to the docs about entitlements configuration
- Or try to configure them automatically with our gradle plugin
- Or both
https://developer.apple.com/documentation/bundleresources/entitlements
Specifically (for anyone following along from home, not able to follow the slack link, etc), the solution ended up being to add an entitlements file as per https://github.com/iterate-ch/cyberduck/issues/13347
And even more specifically, you need something to the effect of:
Create a file default.entitlements or whatever you want to name it
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>
In your build.gradle.kts file add
compose.desktop {
application {
mainClass = ""
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = ""
packageVersion = version as String
macOS {
bundleID = ""
iconFile.set(project.file(""))
entitlementsFile.set(project.file("default.entitlements")) // <----------- this line
}
}
}
}