Use Ant to build Mac OS X app

Description

Reading the installers/mac-installer/instruction.html, you could save yourself some grief by having Ant handle the assembly of the application package. Assuming you get the Info.plist file correct, most of the rest is just file copying, but there are three "tricks":

1) You need the basic structure of the app directory. Something like:

<!-- Make the app shell -->
<property name="appdir" value="${app-name}.app"/>
<mkdir dir="${appdir}"/>
<mkdir dir="${appdir}/Contents"/>
<mkdir dir="${appdir}/Contents/MacOS"/>
<mkdir dir="${appdir}/Contents/Resources"/>
<mkdir dir="${appdir}/Contents/Resources/Java"/>

2) You need the application stub. This is usually done something like:

<property name="mac-src" value="/System/Library/Frameworks/JavaVM.framework/Versions/Current/Resources/MacOS"/>
<copy file="${mac-src}/JavaApplicationStub" todir="${appdir}/Contents/MacOS"/>
<!-- Set execution bits -->
<exec executable="chmod">
<arg value="755"/>
<arg value="${appdir}/Contents/MacOS/JavaApplicationStub"/>
</exec>

3) You need to "bless" the resulting directory to turn it into an application package. This can only be done on a Mac:

<!-- The Mac command to "bless" the directory into an app bundle. Will fail on other platforms. -->
<exec executable="/Developer/Tools/SetFile">
<arg value="-a B ${appdir}"/>
</exec>

Environment

Mac OS X

Activity

Show:
James Dempsey
October 22, 2014, 3:34 PM

Note we are moving away from ant now and supporting this in gradle should instead be considered, particularly as gradle can run most ant scripts.

Eitan Adler
November 6, 2016, 2:32 AM

I removed the mac installer in 7f5a6eec7b57066f7e3c5805377cca20124f5988 and we now use gradle instead of ant. This bug is overcome by events.

Cancelled

Assignee

Unassigned

Reporter

Lester Ward

Labels

None

Theme

None

Epic/Theme

None

Pending User Input

None

Components

Affects versions

Priority

Trivial
Configure