You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Dirk-Willem van Gulik <di...@webweaving.org> on 2002/12/23 16:04:43 UTC

ANT and MacOS X .app targets

Has anyone written a MacOS .app target ?

Right now I usually use an empty Foo.app tree; with the Contents/MacOS
default runner; and then simply change the Info.plist to point to the
right jar(s) and class after copying them into Contents/Resources/Java.

But this means a lot of replication of Resources, Java strings and
Manifest info in other places.

I.e. it is now done along the lines of

   <target name="dist-osx" depends="compile">
     <mkdir dir="bin/Foo.app"/>
     <copy todir="bin/Foo.app/">
      	<fileset dir="resources/Empty.app">
      	</fileset>
     </copy>
     <chmod file="bin/Foo.app/Contents/MacOS/Empty" perm="a+rx"/>
    <copy todir="bin/Foo.app/Contents/Resources">
      <fileset dir="resources">
        <include name="*.icns"/>
      </fileset>
     </copy>
    <copy file="resources/Info.plist"
        tofile="bin/Foo.app/Contents/Info.plist"/>
     <jar jarfile="bin/Foo.app/Contents/Resources/Java/Foo.jar"
       <fileset dir="build"/>
     </jar>
   </target>

and then an Info.plist which is generated:

	... usual CF Bundle stuff...
        <key>CFBundleVersion</key>
        <string>$VERSION (c) $YEAR $PROJECT</string>
        <key>CFBundleGetInfoString</key>
        <string>$PROJECT</string>
        <key>CFBundleShortVersionString</key>
        <string>$VERSION</string>
        <key>CFBundleName</key>
        <string>$NAME $PROJECT</string>
        <key>Java</key>
        <dict>
                <key>ClassPath</key>
                <array>
                        <string>$JAVAROOT/Foo.jar</string>
                </array>
                <key>MainClass</key>
                <string>Foo.startup.FooStartup</string>
                <key>Properties</key>
                <dict>
                        <key>com.apple.macos.useScreenMenuBar</key>
                        <string>false</string>
                </dict>

But this relies on a fair number of files and an empty .app template.

I was wondering if anyone with more mac/java experience had gone to the
trouble of making an ant target which fundamentally understands this; and
creates the right files on the fly; and using data from the Manifest
ideally. (So that a double click on the Jar gives the same results).

Any pointers ?

Thanks !

Dw


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ANT and MacOS X .app targets

Posted by Joe Germuska <Jo...@Germuska.com>.
>I was wondering if anyone with more mac/java experience had gone to the
>trouble of making an ant target which fundamentally understands this; and
>creates the right files on the fly; and using data from the Manifest
>ideally. (So that a double click on the Jar gives the same results).

Some folks have an "osxize" Ant task @ 
http://www.neo.com/projects/osxize/osxize.html  Source is available, 
but the license isn't exactly clear.

If I were setting out to do it myself, I think I'd do it a little 
differently, but I'm not expert with either Ant custom tasks or the 
details of OS X application making.  I learned a little when I wanted 
to automate it, and then I found their package.

I sent them a patch right after I started using it, but my project 
fell by the wayside and now I can't even remember what the patch did. 
They haven't responded nor has a new build been released since then. 
(late Spring 2002)

Joe

-- 
--
Joe Germuska              | "Big corporations here now believe we 
will have war.
Joe@Germuska.com          | Believe all would welcome it as relief to 
suspense."
http://blog.germuska.com/ | telegram to President McKinley, 25 March 1898


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>