Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support entitlements configuration for MacOs #2887

Open
eymar opened this issue Mar 16, 2023 · 2 comments
Open

Support entitlements configuration for MacOs #2887

eymar opened this issue Mar 16, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request gradle Gradle plugin problems

Comments

@eymar
Copy link
Collaborator

eymar commented Mar 16, 2023

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

@eymar eymar added enhancement New feature or request gradle Gradle plugin problems submitted labels Mar 16, 2023
@jimgoog
Copy link
Collaborator

jimgoog commented Mar 16, 2023

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 iterate-ch/cyberduck#13347

@eymar eymar changed the title Support entitlements configuration for Mac Support entitlements configuration for MacOs Mar 16, 2023
@eymar eymar removed the submitted label Mar 16, 2023
@jimgoog
Copy link
Collaborator

jimgoog commented Mar 17, 2023

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
            }
        }
    }
}

AlexeyTsvetkov added a commit that referenced this issue Apr 4, 2023
Also, this change configures entitlements for
local ad hoc signs on Apple Silicon

Fixes #2867
Partial fix of #2887
AlexeyTsvetkov added a commit that referenced this issue Apr 4, 2023
Also, this change configures entitlements for
local ad hoc signs on Apple Silicon

Fixes #2867
Partial fix of #2887
AlexeyTsvetkov added a commit that referenced this issue Apr 4, 2023
Also, this change configures entitlements for
local ad hoc signs on Apple Silicon

Fixes #2867
Partial fix of #2887
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gradle Gradle plugin problems
Projects
None yet
Development

No branches or pull requests

3 participants