<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="j2mepolish" name="Imity">
	
	<!-- import user specific properties                          -->
	<property file="${user.name}.properties" />
	
	<!-- The device which is used for the emulator.               -->
	<!-- You can call Ant from the command line with another      -->
	<!-- device like this: ant -Ddevice=Generic/midp2 emulator    -->
	<!-- Identifiers: Nokia/N70, Sony-Ericsson/K750, Nokia/midp2, Generic/multi-->
	<!--<property  name="device" value="Nokia/Series60E2" />-->
	<!--<property  name="device" value="Generic/multi" />-->
    <property  name="device" value="Sony-Ericsson/K750" />
	
	<property environment="env"/>
	<property name="wtk.home" value="${env.WTK_HOME}/" />
	<!-- The polish.home property should point to the directory   -->
	<!-- containing the J2ME Polish installation.                 -->
	<property name="polish.home" value="${env.POLISH_HOME}" />
	
	<!-- 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" location="C:\siemens" />
	-->
	<!-- The directory which contains the Nokia-emulators -->
	<!--<property name="nokia.home" location="C:\Nokia" />-->
	<!-- The path to the Sony-Ericsson SDK -->
	
	<!--<property name="sony-ericsson.home" location="C:\SonyEricsson\J2ME_SDK" />-->
	
	<!-- The directory which contains the Motorola-emulators
		<property name="motorola.home" location="C:\Program Files\Motorola\SDK v4.3 for J2ME" />
	-->
		
	<!-- Definition of the J2ME Polish task:                      -->
	<!-- rkk: Workaround for Polish 2.x (RC3).
              Polish 1.x: enough-j2mepolish-build.jar in $POLISH_HOME/import
              Polish 2.x: enough-j2mepolish-build.jar in $POLISH_HOME/lib
              @Todo: Put $POLISH_LIB_DIR in imity.build.env.sh and check for directory "lib"
    -->
	<taskdef name="j2mepolish" 
		classname="de.enough.polish.ant.PolishTask" 
		classpath="${polish.home}/lib/enough-j2mepolish-build.jar:${polish.home}/import/jdom.jar"
	/>
	<!-- 	
		classpath="${polish.home}/import/enough-j2mepolish-build.jar:${polish.home}/import/jdom.jar:${polish.home}/import/proguard.jar:${polish.home}/import/yguard-lib.jar:${wtk.home}/wtklib/kenv.zip"
    -->
	<!-- 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="allDevices">
		<property name="allDevices" value="true"/>
	</target>

	<target name="test">
		<property name="test" value="true"/>
		<property name="dir.work" value="build/test"/>
	</target>
	<target name="deploy">
		<property name="deploy-url" value="http://dev.imity.com:8082/get/"/>
	</target>
			
	<target name="init">
	  	<property name="test" value="false"/>
		<property name="allDevices" value="false"/>
		<property name="deploy-url" value=""/>
		<property name="dir.work" value="build/real"/>
	</target>
	    
	<target depends="init" name="j2mepolish">
		<j2mepolish>
		    <!-- general settings -->
		    <!--
			<info 
				license="GPL" 
				name="RoadRunner" 
				vendorName="Enough Software" 
				version="1.0.1"
				copyright="Copyright 2005 Enough Software. All rights reserved." 
				deleteConfirm="Do you really want to remove Roadrunner?" 
				description="A frogger clone." 
				icon="dot.png"
				infoUrl="http://www.enough.de" 
				jarName="${polish.vendor}-${polish.name}-${polish.locale}-roadrunner.jar" 
				jarUrl="${deploy-url}${polish.jarName}" 
		    />-->
		    <info
			name="xImity"
			version="0.1.1"
			description="xImity"
			vendorName="80pct.org"
			infoUrl="http://imity.com"
			icon="icon1616x.png"
			jarName="${polish.vendor}.${polish.name}-${polish.locale}-Imity.jar" 
			jarUrl="${deploy-url}${polish.jarName}"
			copyright="Copyright 2006 NeoFish. All rights reserved."
			deleteConfirm="Exit xImity?" 
			permissions="javax.microedition.io.Connector.http, javax.microedition.io.Connector.bluetooth.client, javax.microedition.io.Connector.bluetooth.server"

		/>

			<!-- office devices -->
			<deviceRequirements unless="test">
				<!--<requirement name="Identifier" value="Generic/Multi, Nokia/Series60, Nokia/Series60E2, Sony-Ericsson/K700, Sony-Ericsson/K750, Samsung/SGH-E800"/>-->
				<!--<requirement name="Identifier" value="Nokia/Series60, Nokia/Series60E2, Sony-Ericsson/K750"/>-->
				<!--<requirement name="Identifier" value="Nokia/N70, Sony-Ericsson/K750, Generic/multi" />-->
				<!-- <requirement name="Identifier" value="Siemens/S65,Nokia/N80, Nokia/N90, Nokia/N70, Nokia/N73, Sony-Ericsson/K750, Generic/multi" /> -->
				<requirement name="Identifier" value="Nokia/N70, Nokia/N73, Generic/multi" />

			</deviceRequirements>


			<deviceRequirements if="allDevices">
				<!-- build to all supported devices -->
				<requirement name="Identifier" value="
					
					Sony-Ericsson/D750, Sony-Ericsson/K608, Sony-Ericsson/K610, Sony-Ericsson/K790, Sony-Ericsson/K800,
					Sony-Ericsson/M600, Sony-Ericsson/W550, Sony-Ericsson/W600, Sony-Ericsson/W700,
					Sony-Ericsson/W810, Sony-Ericsson/W900, Sony-Ericsson/W950,
					Sony-Ericsson/W900i,
					Sony-Ericsson/Z520, Sony-Ericsson/Z530,
					Sony-Ericsson/k600, Sony-Ericsson/K750,Sony-Ericsson/W800,
					Nokia/6600 Nokia/6630, Nokia/6680, Nokia/7610, Nokia/6230, Nokia/6230i,
					Nokia/3230, Nokia/6670, Nokia6260, Nokia/N70,
					Nokia/6111, Nokia/6125, Nokia/6131, Nokia/6233, Nokia/6234,
					Nokia/6265, Nokia/6270, Nokia/6280, Nokia/6620, Nokia/6630,
					Nokia/6680, Nokia/6681, Nokia/7370, Nokia/8800,
					Nokia/E60, Nokia/E70, Nokia/N71, Nokia/N72, Nokia/N73,
					Nokia/N80, Nokia/N90, Nokia/N91, Nokia/N92, Nokia/N93,
					HTC/Himalaya, Qtek/XDAII, Siemens/S65, Siemens/SK65,
					Siemens/SX11, Sendo/X, BenQ/P30, SonyEricsson/K608,
					Sony-Ericsson/D750,  
					Sony-Ericsson/K800i,  
					Motorola/FOMA_M1000, Motorola/SLVR, Motorola/V8,
					Motorola/V360
					
					" />

					<!--  Sony-Ericsson/V600, Sony-Ericsson/P900, Sony-Ericsson/P910,-->
			</deviceRequirements>
			<deviceRequirements if="test">
				<!-- if test only build for the test device -->
				<requirement name="Identifier" value="${device}"/>
			</deviceRequirements>
			
		    <!-- build settings -->
			<build	fullscreen="menu"
					usePolishGui="true"
					sourceDir="src"
					workDir="${dir.work}"
                    preverify="${env.POLISH_PREVERIFY}"
				>
				<!-- midlets definition -->
				<midlet class="com.imity.ImityMidlet" name="Imity"/>
				<!-- project-wide variables - used for preprocessing  -->
				<variables>
                    <variable name="polish.usePolishTitle" value="true" />
					<variable name="polish.TiledLayer.useBackBuffer" value="true"/>
					<variable name="polish.TiledLayer.TransparentTileColor" value="0x00FF00"/>
					<variable name="polish.MenuBar.useExtendedMenuBar" value="true"/>
                    <variable name="polish.useScrollBar" value="true" />
                    <variable name="polish.TextField.supressClearCommand" value="true" />
                    <variable name="polish.TextField.supressDeleteCommand" value="true" />
                    <variable name="polish.TextField.suppressCommands" value="true"/>
                    <variable name="config.ConnectToLocalhost" value="yes" if="test"/>

				</variables>
				<manifestFilter if="polish.vendor == Samsung">
					Manifest-Version, MIDlet-Name, MIDlet-Version, 
					MIDlet-Vendor, MIDlet-1*,MIDlet-Icon?, MIDlet-Data-Size?, 
					MIDlet-Description?, MIDlet-Info-URL?,
					MicroEdition-Profile?, MicroEdition-Configuration?
				</manifestFilter>
				<jad>
					<filter if="polish.vendor == Samsung">
						MIDlet-Name, MIDlet-Version, MIDlet-Vendor,  
						MIDlet-1*,MIDlet-Icon?, MIDlet-Data-Size?, MIDlet-Description?,
						MIDlet-Info-URL?, MicroEdition-Profile?, MicroEdition-Configuration?
					</filter>
				</jad>
				<!-- obfuscator settings: do not obfuscate when the test-property is true -->
				<!--<obfuscator name="ProGuard" useDefaultPackage="true" unless="test">-->
				<obfuscator name="ProGuard" useDefaultPackage="true">
                    <keep class="com.imity.DataTextField" />
                    <keep class="com.imity.ISpimeSelectForm" />
                </obfuscator>
				<!-- debug settings: only include debug setting when the test-property is true -->
				<debug level="error" showLogOnError="true" verbose="true" if="test">
					<filter level="debug" pattern="com.imity.*"/>
					<filter level="info" pattern="de.enough.polish.ui.*"/>
					<filter level="debug" pattern="de.enough.polish.ui.game.*"/>
				</debug>
				<resources
					dir="resources"
					defaultexcludes="yes"
					excludes="readme.txt, *.definition"
				>
					<localization defaultLocale="en_US" dynamic="true" locales="en_US" />
				</resources>
			</build>
			<!-- launch emulator		-->
			<emulator if="test" />
	
		</j2mepolish>
	</target>
	
	<target 
		name="emulator"
		depends="test,j2mepolish"
		description="invokes the emulator"
	>
	</target>
	
	<target description="allows a clean build. You should call [ant clean] whenever you made changes to devices.xml, vendors.xml or groups.xml" name="clean">
		<delete dir="build"/>
		<delete dir="dist"/>
	</target>

	<target  
		name="cleanbuild"
		description="allows a clean build. You should call [ant cleanbuild] whenever you made changes to devices.xml, vendors.xml or groups.xml"
		depends="clean, j2mepolish"
	/>


  <!-- targets that require ussp-push for easy deployment :) -->

	<target name="office"
  		description="Deploy to office"
		depends="cleanbuild, shim, nyholm, classy, mj" >
	</target>

	<target name="shim" 
  		description="Deploy to shims k750i"
		depends="j2mepolish">
		<exec dir="dist" executable="ussp-push">
  			<arg line="00:12:EE:8D:24:F8@5"/>
  			<arg line="Sony-Ericsson.K750-en_US-Imity.jar"/>
  			<arg line="Imity.jar"/>
		</exec>
	</target>

	<target name="mj" 
  		description="Deploy to MJ Nokia N70"
		depends="j2mepolish">
		<exec dir="dist" executable="ussp-push">
  			<arg line="00:17:4B:11:07:CC@9"/>
  			<arg line="Nokia.N70-en_US-Imity.jar"/>
  			<arg line="Imity.jar"/>
		</exec>
	</target>

	<target name="classy" 
  		description="Deploy to classys k750i"
		depends="j2mepolish">
		<exec dir="dist" executable="ussp-push">
  			<arg line="00:12:EE:8D:37:03@5"/>
  			<arg line="Sony-Ericsson.K750-en_US-Imity.jar"/>
  			<arg line="Imity.jar"/>
		</exec>
	</target>

	<target name="nyholm" 
  		description="Deploy to nyholms k750i"
		depends="j2mepolish">
		<exec dir="dist" executable="ussp-push">
  			<arg line="00:0E:07:B6:46:AB@6"/>
  			<arg line="Sony-Ericsson.K750-en_US-Imity.jar"/>
  			<arg line="Imity.jar"/>
		</exec>
	</target>
    
	<target name="nyholm2" 
  		description="Deploy to nyholms N80"
		depends="j2mepolish">
		<exec dir="dist" executable="ussp-push">
  			<arg line="00:12:D1:98:FB:2C@9"/>
  			<arg line="Nokia.N90-en_US-Imity.jar"/>
  			<arg line="Imity.jar"/>
		</exec>
	</target>


    <target name="s65" 
  		description="Deploy to s65"
		depends="j2mepolish">
		<exec dir="dist" executable="ussp-push">
  			<arg line="00:01:E3:45:A3:C2@4"/>
  			<arg line="Siemens.S65-en_US-Imity.jar"/>
  			<arg line="Imity.jar"/>
		</exec>
	</target>


</project>
