Thursday, October 18, 2007

Sample Ant File for Eclipse J2ME Polish Projects

<!-- Following content in red needs customizing after the     -->
<!-- project is generated automatically.                      -->
<!--                                                          -->
<!-- This file controls the build process.                    -->
<!-- The most important target is the j2mepolish target,      -->
<!-- which controls for what devices the application should   -->
<!-- be created.                                              -->
<!--                                                          -->
<!-- Important: when you have no Wireless Toolkit installed   -->
<!-- you need to define the "preverify"-attribute             -->
<!-- of the <build>-element of the J2ME Polish task.          -->
<!--                                                          -->
<!-- When you call Ant from the command-line, you can         -->
<!-- call "ant test j2mepolish" to skip the obfuscation       -->
<!-- and to build the example for fewer handsets.             -->
<!-- The default target builds and obfuscates the example.    -->
<!--                                                          -->
<!-- The full documentation can be found at                   -->
<!-- http://www.j2mepolish.org                                -->
<!--                                                          -->
<!-- Have fun!                                                -->
 
<project
 name="lrfz-app-GKey"
 default="j2mepolish">
 
 
<property file="${user.name}.properties" />
<property file="midlet.properties" />
 
<!-- The polish.home property should point to the directory   -->
<!-- containing the J2ME Polish installation.                 -->
 
<property name="polish.home" value="C:\Program Files\J2ME-Polish" />
<property file="${polish.home}/global.properties" />
 
<!-- The wtk.home property should point to the directory      -->
<!-- containing the Wireless Toolkit.                         -->
 

<property name="wtk.home" value="C:\WTK2.5.1" />
 

<!-- The siemens.home, nokia.home and motorola.home-          -->
<!-- properties can be necessary when their emulators         -->
<!-- should be started.                                       -->
<!-- The directory which contains the Siemens-SMTK
 <property name="siemens.home" value="C:\siemens" />
-->
<!-- The directory which contains the Nokia-emulators
 <property name="nokia.home" value="C:\Nokia" />
-->
<!-- The path to the Sony-Ericsson SDK
 <property name="sony-ericsson.home" value="C:\SonyEricsson\J2ME_SDK" />
-->
<!-- The directory which contains the Motorola-emulators
 <property name="motorola.home" value="C:\Program Files\Motorola\SDK v4.3 for J2ME" />
-->
 
<property name="nokia.home" value="C:\S60" />
 
<property name="sony-ericsson.home" value="C:\" />
 
<property name="motorola.home" value="C:\" />
 
 
<property name="siemens.home" value="C:\" />
 
 
<!-- Definition of the J2ME Polish task:                      -->
 
<taskdef name="j2mepolish"
 classname="de.enough.polish.ant.PolishTask"
 classpath="${polish.home}/lib/enough-j2mepolish-build.jar:${polish.home}/lib/jdom.jar"/>
 
 
<!-- build targets, each target can be called via "ant [name]",
  e.g. "ant clean", "ant test j2mepolish" or just "ant" for calling the default target -->
 
<target name="setdeploy"
 description="Call this target first to set the OTA download-URL, e.g. ant setdeploy j2mepolish"
 >
 <property name="deploy-url" value="http://www.company.com/download/" />
</target>
 
<target name="test"
 description="Call this target first to skip the obfuscation step, e.g. ant test j2mepolish"
 >
 <property name="test" value="true" />
 <property name="dir.work" value="build/test" />
</target>
  
<target name="init">
   <property name="test" value="false" />
 <property name="dir.work" value="build/real" />
 <property name="deploy-url" value="" />
</target>
 
<!-- In this target the J2ME Polish task is used.             -->
<!-- It has 3 sections:                                       -->
<!--    1. The info-section defines some general information  -->
<!--    2. The deviceRequirements-section chooses the devices -->
<!--       for which the application is optimized.            -->
<!--    3. The build-section controls the actual build        -->
<!--       process.                                           --> 
<target name="j2mepolish"
  depends="init"
  description="This is the controller for the J2ME build process."
  >
 <j2mepolish>
     <!-- general settings, these settings basically form the JAD-attributes. -->
     <!-- Have a look at the <jad>-section for setting specialised attributes.
          You can also define localized attributes in the resources/messages.txt files -->
  <info
   license="GPL"
   name="GKey"
   version="1.3.4"
   description=""
   vendorName="Kubao Studio"
   infoUrl="http://www.lrfz.com"
   icon="dot.png"
   jarName="${polish.vendor}-${polish.name}-${polish.locale}-GKey.jar"
   jarUrl="${deploy-url}${polish.jarName}"
   copyright="Copyright 2007 Kubao Studio. All rights reserved."
   deleteConfirm="Do you really want to kill me?"
  />
  
  <!-- selection of supported devices -->
  <!-- In the test mode the application is build only for the  -->
  <!-- Generic/midp1 phone, but when the test-property is set to false, -->
  <!-- the second deviceRequirements will be used instead. -->
  <deviceRequirements if="test">
   <requirement name="Identifier" value="${device}" />
  </deviceRequirements>
  <deviceRequirements if="!test and device:defined">
   <requirement name="Identifier" value="${device}" />
  </deviceRequirements>
  <deviceRequirements unless="test">
   <or>
      <requirement name="Identifier" value="Generic/DefaultColorPhone" />
      <requirement name="Identifier" value="Generic/QwertyDevice" />
      <requirement name="Identifier" value="Nokia/6230" />
      <requirement name="Identifier" value="Nokia/E61" />
 
      </or>
  </deviceRequirements>
  
     <!-- build settings -->
  <!--
   -->
  <build
   symbols="ExampleSymbol, AnotherExample"
   fullscreen="menu"
   usePolishGui="true"
   workDir="${dir.work}"
  >
     
   <!-- midlets definition -->
   <midlet class="com.lrfz.app.GKey" name="GKey" />
   
   <!-- project-wide variables - used for preprocessing.  -->
   <!-- You can set localized variables in the resources/messages.txt files as well.  -->
   <variables includeAntProperties="true" >
    <!-- example variables:
    In your Java-code you can use the following snipet to use this variable:
    //#= private static final String UPDATE_URL = "${ update-url }";
    You can change the title of the sample application with the "title"-var.
    -->
    <variable name="update-url" value="http://www.lrfz.com/update" />
    <variable name="title" value="GKey" />

   </variables>
   <!-- Here you can set the dir attribute to "resources2" for an alternative design. -->
   <resources
    dir="resources"
    defaultexcludes="yes"
    excludes="readme.txt"
   >
    <!-- you can add resources based on complex criterias:
    <fileset
     dir="resources/multimedia"
     includes="*.wav"
     if="polish.audio.wav"
    />
    <fileset
     dir="resources/multimedia"
     includes="*.mid"
     if="polish.audio.midi and not polish.audio.wav"
    />
    -->
    <!-- add the localization element for created localized
         versions of your application: -->
    <localization locales="en_US" unless="test" />
    <localization locales="en_US" if="test" />
   </resources>
   
   <!-- obfuscator settings: do not obfuscate when the test-property is true -->
   <obfuscator name="ProGuard" useDefaultPackage="false" unless="test || polish.blackberry" >
    <!--
    You can set additional parameters here, e.g.:
    <parameter name="optimize" value="false" />
    -->
    <keep class="com.lrfz.app.GKey" />
   </obfuscator>
   
   <!-- debug settings: only include debug setting when the test-property is true -->
   <debug if="test" showLogOnError="true" verbose="true" level="error">
    <filter pattern="de.enough.polish.example.*" level="debug" />
    <filter pattern="de.enough.polish.ui.*" level="warn" />
   </debug>
   
   <!-- user defined JAD attributes can also be used: -->
   <jad>
    <attribute name="Nokia-MIDlet-Category" value="Game" if="polish.group.Series40" />
   </jad> 
   
   
  </build>
  
  <!-- execution of emulator(s) -->
  <emulator
   wait="true"
   securityDomain="trusted"
   enableProfiler="false"
   enableMemoryMonitor="false"
   enableNetworkMonitor="false"
   if="test and not debug"
   >
  </emulator>
 
  <emulator
   wait="false"
   securityDomain="trusted"
   enableProfiler="false"
   enableMemoryMonitor="false"
   enableNetworkMonitor="false"
   if="debug">
   <debugger port="8000" />
  </emulator>
  
 </j2mepolish>
</target>
 
<target name="emulator" depends="test,j2mepolish" />
 
<target name="clean"
    description="allows a clean build. You should call [ant clean] whenever you made changes to devices.xml, vendors.xml or groups.xml">
 <delete dir="build" />
 <delete dir="dist" />
</target>
 
</project>

Labels:

0 Comments:

Post a Comment

<< Home