« Sony Ericsson bitten by Auto Smart-Ass Formatter | Main | “Well, I’m back,” he said. »

Building a TINI application with Xcode

This post explains how I build applications for the TINI using Xcode. It was written for Xcode 2.4.

  • Create a new Java Tool project in Xcode. The description says “This project builds a library or application as a JAR file.”

  • Double-click the main and only target under Targets. The target editor opens. We will need to do the following:

    • add tiniclasses.jar to the search path for Java classes;
    • tell javac to target version 1.1 of the virtual machine;
    • tell Xcode to generate a class hierarchy instead of a Java archive (JAR file).
  • In Search Paths, drag and drop the tiniclasses.jar file (from the TINI SDK) under Java Classes, or select Java Classes, click the + button and select the tiniclasses.jar file in the file dialogue. This adds the TINI classes to the class path.

  • In Java Compiler Settings, change Target VM Version to 1.1 and Source Version to 1.3. The TINI runs a 1.1 virtual machine and a source version of 1.3 seems to be required in order to compile version 1.1 classes.

  • In Java Archive Settings, change Product Type to Class Hierarchy. This will create a folder containing the class files, on which we can subsequently run the TINIConvertor tool, instead of a JAR file.

The final step is to call the TINIConvertor tool through a shel script build phase, in order to build the TINI executable:

  • Right-click on the last build phase in the left pane of the target editor (most likely Copy Files) and select New Build Phase — New Shell Script Build Phase. A Run Script build phase will be added to the end of the build phase list.

  • In the Script text field of the new build phase, paste the following script:

    TINIPATH=$LOCAL_LIBRARY_DIR/TINI/bin
     
    java -classpath "$TINIPATH/tini.jar" TINIConvertor \
        -f "$CLASS_FILE_DIR" -d "$TINIPATH/tini.db" \
        -o "$TARGET_BUILD_DIR/$PRODUCT_NAME.tini"
    

    Replace the value for TINIPATH with the actual path to your copy of the TINI SDK, i.e. the folder that contains tini.jar and tini.db. We use $CLASS_FILE_DIR to locate the class files, $TARGET_BUILD_DIR to locate the build directory and $PRODUCT_NAME to name the executable.

That’s it. Unfortunately, it seems that you have to go through these steps for both the Debug and Release build configurations. You can now build your project and if all goes well, a .tini file should land in your build/Debug or build/Release folder. If not, drop me a note.

TrackBack

TrackBack URL for this entry: https://ithink.ch/blog/tb.cgi/159.

Make sure JavaScript is enabled before using this URL. If you would like to ping my blog but can't, please do send me an e-mail at os3476 at this domain.

Post a comment

Make sure JavaScript is enabled before posting a comment. If you would like to post a comment but can't, please do send me an e-mail at os3476 at this domain.

Do not meddle in the affairs of Coding Ninjas, for they are subtle and quick to anger.