crotwell / gradle-macappbundle

A Gradle Plugin to create a Mac OSX .app application and dmg based on the project.
Apache License 2.0
94 stars 33 forks source link

jvmArgs for dmg #43

Closed ankits closed 6 years ago

ankits commented 8 years ago

Is there a way I can pass the memory settings for the dmg that is created?

crotwell commented 8 years ago

Not sure I understand, do you mean to hdiutil when it creates the dmg? If so, then no, it sizes the dmg to be big enough to hold the contents of the folder. If you want to add something to the dmg, it is better to add it to the app output dir (build/macApp by default) before the dmg is created.

knes1 commented 7 years ago

I have the same question. Basically, if I were to run the jar file myself and wanted to have 512MB heap available to the app I would run it with:

java -Xmx512M -jar app.jar

So the question is, how to specify the -Xmx512M VM argument when the app is running from the bundle?

crotwell commented 7 years ago

The was about the size of the dmg file, not about memory options.

But you can pass in the -Xmx using the javaExtras in macAppBundle like: macAppBundle { appName = "TestApp" mainClassName = "gui.TestSketch" bundleJRE = true javaExtras.put('-Xmx512m', null) }

knes1 commented 6 years ago

Thanks for the info. Unfortunately this doesn't seem to work for maximum heap size argument, because it seems that this command will generate the following option -Xmx512m=null intead of -Xmx512m which then prevents JVM from running with the following error:

Invalid maximum heap size: -Xmx512=null
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
crotwell commented 6 years ago

Which version of the plugin are you using? I just tested here using this:

macAppBundle {
    appName = "TestApp"
    mainClassName = "gui.TestSketch"
    bundleJRE = true
    javaExtras.put('-Xmx512m', null)
}

and got this in Info.plist:

    <key>JVMOptions</key>
    <array>
      <string>-Xmx512m</string>
    </array>

The =null was a bug in versions prior to 2.1.1, but was fixed here, over 2 years ago. https://github.com/crotwell/gradle-macappbundle/commit/3a127f9a3408a78facc505990756e1635b3db243

knes1 commented 6 years ago

Ahhh - I'm sorry - you are correct! I picked up whatever Google link on mvnrepository.com offered as the latest version - which was 2.1.0. I didn't check correctly if there was a later version out.

Thank you for your help!