crotwell / gradle-macappbundle

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

more user configurable java system properties #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
system properties are defined within 
<key>java</key>
<dict>
...
<Properties> 

currently the macappbundle plugin allows a single property to be set:

apple.laf.useScreenMenuBar

yet macappbundle plugin should allow adding any number of custom properties 
like, either apple specific:
apple.awt.textantialiasing
apple.awt.showGrowBox
(http://developer.apple.com/library/mac/#documentation/Java/Reference/Java_Prope
rtiesRef/Articles/JavaSystemProperties.html)

or java specific like
JFileChooser.appBundleIsTraversable
JFileChooser.packageIsTraversable
...

or actually any custom properties

Original issue reported on code.google.com by poldwusm...@gmail.com on 2 Oct 2012 at 12:13

GoogleCodeExporter commented 9 years ago
Another approach might be to generate the plist as an object, then we could 
modify it before you (lazily) write it out...

generatePlist.doFirst {
  def plist = project.macAppBundle.plist
  plist.java.properties.append("apple.laf.useScreenMenuBar", true)
  plist.java.append("VMOptions", "-Xmx512m")
  plist.append(...)
}

Probably the easiest approach (rather than reinventing this wheel) is to use 
the existing commons-configuration library to write out a plist.

http://commons.apache.org/configuration/userguide/howto_properties.html#Saving

Then the writing out of the plist isn't a set of hardcoded statements in your 
plugin.

Original comment by a...@glebeschool.org.au on 2 Oct 2012 at 1:11

GoogleCodeExporter commented 9 years ago
I have added three groovy Maps and code to handle them to the extension, 
javaProperties, javaExtras and bundleExtras that allow you to put in additional 
key-value pairs. The values can be strings, boolean, numbers, lists or maps, 
which are mapped to corresponding types in the plis. I think this addresses 
your need, but please let me know if not. 

An example of this would be:

    javaProperties.put("xyz", "abc")
    javaExtras.put("jextras", ["a1":"abc", "a2":true, "a3":[ 1, 2, 3]])
    bundleExtras["bbbxyz"] = "bbbabc"

Original comment by crotwell@seis.sc.edu on 3 Oct 2012 at 7:25

GoogleCodeExporter commented 9 years ago
Great. That should be good for most people's needs. We'll give it a try today.

Original comment by a...@glebeschool.org.au on 5 Oct 2012 at 1:34

GoogleCodeExporter commented 9 years ago
works perfectly. thanks!

Original comment by poldwusm...@gmail.com on 9 Oct 2012 at 12:02