J2ME Polish
J2ME Polish 2.4 Documentation
Enough Software

Example for the build.xml

<!-- This file controls the build process.                    -->
<!-- The most important target is the j2mepolish-target,      -->
<!-- which controls for what devices the application should   -->
<!-- be created and so on.                                    -->
<!--                                                          -->
<!-- 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="enough-j2mepolish-example" 
	default="j2mepolish">
	
<!-- The wtk.home property should point to the directory      -->
<!-- containing the Wireless Toolkit.                         -->
<property name="wtk.home" value="C:\WTK2.1" />
	
<!-- 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 notest j2mepolish" or just "ant" for 
     calling the default-target -->
<target name="test" >
	<property name="test" value="true" />
</target>
		
<target name="init">
  	<property name="test" value="false" />
</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 -->
		<info
		 name="J2ME Polish"
		 version="1.3.4"
		 description="A sample project"
		 vendorName="Enough Software"
		 infoUrl="http://www.j2mepolish.org"
		 icon="dot.png"
		 jarName="${polish.vendor}-${polish.name}-example.jar" 
		 jarUrl="${polish.jarName}"
		 copyright="Copyright 2004 Enough Software. 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  -->
		<!-- Nokia/3650 and the 6600 phones, otherwise  -->
		<!-- the second deviceRequirements will be used instead. -->
		<deviceRequirements if="test">
			<requirement name="Identifier" 
			 value="Nokia/3650, Nokia/N95 " />
		</deviceRequirements>
		<deviceRequirements unless="test">
			<requirement name="Identifier" 
			 value="Nokia/Series60, Nokia/Series60Midp2, Generic/midp2" />
			<!-- on could use other devices for real builds, e.g. :
			<or>
				<and>
					<requirement name="JavaPackage" 
					 value="nokia-ui" />
					<requirement name="BitsPerPixel" 
					 value="16+" />
				</and>
			</or>
			 -->
		</deviceRequirements>
	    <!-- build settings -->
		<build
		 symbols="ExampleSymbol, AnotherExample"
		 imageLoadStrategy="background"
		 fullscreen="menu"
		 usePolishGui="true"
		 resDir="resources"
		 >
		  <!-- midlets definition -->
		  <midlet class="de.enough.polish.example.MenuMidlet" 
		   name="Example" />
		  <!-- project-wide variables - used for preprocessing  -->
		  <variables>
 			<variable name="update-url" 
			 value="http://www.enough.de/update" />
			<variable name="title" 
			 value="J2ME Polish" />
		  </variables>
		  <!-- obfuscator: don't obfuscate when the test-property is true -->
 		  <obfuscator unless="test" name="ProGuard" />
		  <!-- 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.Vendor == Nokia" />
		  </jad>			
		</build>
	</j2mepolish>
</target>


<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>

	

back to top