RPTools.net

Discussion and Support

Skip to content

It is currently Wed May 22, 2013 7:01 pm 






Reply to topic  [ 4 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Tue Feb 01, 2011 6:00 pm
Posts: 4
Location: Long Island, NY
 Post subject: Using Ant to build a "proper" MapTool app bundle on OS X
PostPosted: Wed Feb 02, 2011 1:46 pm 
I like my Mac applications to be double-clickable and living my Applications directory, not a bunch of weird files that use *.command oddities to launch. Since MapTool appears to use Ant for its build process, and Ant is shipped with all Macs, here is how you can build a "real" Mac application out of a MapTool download.

This process works on Snow Leopard. Not sure about other OS versions.

1) Download an Ant task specifically built to make Mac apps out of Java code, called JarBundler.

2) Install the bundle somewhere that Ant can use it. On Snow Leopard, this means copying the jarbundler-2.2.0.jar into /usr/share/ant/lib. You probably will need to use sudo to do this:

Code:
sudo cp ~/Downloads/jarbundler-2.2.0/jarbundler-2.2.0.jar /usr/share/ant/lib/

3) Download this collection of supporting files and expand it. It contains:

build.xml - A small Ant script to invoke the jarbundler task with MapTool specific information. (This could be easily moved into the main build file, btw.)
maptool.icns - An ICNS version of the MapTool icon.

4) Download a version of MapTool and expand it. I tested this with version 1.3b75, as that is the version required to use the iPad/iPhone client application MaPnakotic. Could be that other versions need some tweaking.

5) Open a Terminal. Move to the directory of the supporting files. Probably something like:

Code:
cd ~/Downloads/bundleMapTool

7) Figure out the path to the version of MapTool you want to bundle. This is probably something like "~/Downloads/maptool-1.3.b75". We'll call this path $SOURCE for short. (This needds to be the complete path, starting with a slash. No shortcuts, like ~.) Also, we will call the version number $VERSION for short.

6) Run the following command:

Code:
ant -Dmaptool.macbundle.source=$SOURCE -Dmaptool.macbundle.version=$VERSION

...or, for example...
Code:
ant -Dmaptool.macbundle.source=/Users/yourname/Downloads/maptool-1.3.b75 -Dmaptool.macbundle.version=1.3.b75

The end result is a real Mac application:

Image


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 11622
Location: Tampa, FL
 Post subject: Re: Using Ant to build a "proper" MapTool app bundle on OS X
PostPosted: Wed Feb 02, 2011 3:40 pm 
I'm moving this to the Developer Notes forum since this is not something for the typical MapTool user.


Why are you doing this? There are already OSX-based .dmg files available on the Download page of RPTools.net.

Is there some other reason?

Note that I have an ANT task already defined for MapTool, but it hasn't been integrated into the rest of the build process yet. However, if you're interested in doing this yourself, here's what I have:

Code:
<project name="jarbundler" basedir="." default="bundle">
    <taskdef name="jarbundler"
    classname="net.sourceforge.jarbundler.JarBundler" />

    <target name="bundle">
   <property name="version" location="1.3.b82" />
   <property name="dist"    location="dist" />
   <property name="source"  location="maptool" />
   <mkdir dir="${dist}" />

   <jarbundler dir="${dist}"
       name="MapTool"
       shortname="MapTool"
       signature="RPTM"
       icon="maptool-icon.icns"
       jvmversion="1.5+"
       version="${version}"
       bundleid="net.rptools.maptool"
       arguments="run"
       vmoptions="-Xmx768m -Xss4m"
       infostring="RPTools.net MapTool"
       mainclass="net.rptools.maptool.client.LaunchInstructions">

       <!--
       <javaproperty name="apple.laf.useScreenMenuBar" value="true"/>
       -->

       <jarfileset dir="${source}">
      <include name="*.jar" />
      <include name="lib/*.jar" />
       </jarfileset>

       <resourcefileset dir="${source}">
      <!-- Scripts, XML, and License information for 3pp libraries -->
      <exclude name="**/*.jar" />
      <exclude name="*.bat" />
      <exclude name="*.exe" />
      <exclude name="*.pdf" />
      <exclude name="**/javadoc" />
      <exclude name="**/src" />
       </resourcefileset>
   </jarbundler>
    </target>
</project>

This is meant to be used against a directory in which the ZIP version has been unpacked. It makes use of a file called maptool-icons.icns to obtain the icon images. The primary problem with it is that I haven't integrated a parameterized version string yet.

(There is an older version of this code in the common-webstart-targets.xml ANT library of the common.build project. You'll need to check out that project from SourceForge to see it though.)

_________________
Interested in Time Magazine's Best Invention of 2008 Unix-powered laptop? No crashes or lockups. In fact, that series of articles has two such machines. The other is a Dell netbook. :)


Top
 Profile  
 
 Offline
Kobold
 
Joined: Tue Feb 01, 2011 6:00 pm
Posts: 4
Location: Long Island, NY
 Post subject: Re: Using Ant to build a "proper" MapTool app bundle on OS X
PostPosted: Wed Feb 02, 2011 5:26 pm 
Azhrei wrote:
Why are you doing this? There are already OSX-based .dmg files available on the Download page of RPTools.net.

Ah ha! I didn't see .dmg files for the other tools in the set and, for some reason, just assumed they weren't there for MapTool as well. D'oh!


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 11622
Location: Tampa, FL
 Post subject: Re: Using Ant to build a "proper" MapTool app bundle on OS X
PostPosted: Wed Feb 02, 2011 5:30 pm 
Ah, okay.

For the Mac, the easiest approach is actually to use Java Web Start. The Launch page on the main site even lets you choose the memory configuration and you can then save the resulting JNLP file and start the tool again later. Since the files are downloaded and cached, you only need an Internet connection for the first load (just like you'd need it to download a ZIP or DMG file).

And you get the benefit of receiving an updated library automatically if there is one. (Although we're not currently using that facility. We probably will in 1.4 or 1.5 though.)

_________________
Interested in Time Magazine's Best Invention of 2008 Unix-powered laptop? No crashes or lockups. In fact, that series of articles has two such machines. The other is a Dell netbook. :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 4 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman