<!--
// =================================================================================================
// ADOBE SYSTEMS INCORPORATED
// Copyright 2006-2009 Adobe Systems Incorporated
// All Rights Reserved
//
// NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the terms
// of the Adobe license agreement accompanying it.
// =================================================================================================
-->

<project name="XMPCore Build File" default="build">
	
	<!-- Project Properties -->
	<property name='implementation.title' value='Adobe XMP Core'/>
	<property name='implementation.copyright' value='Copyright 2006-2009 Adobe Systems Incorporated. All rights reserved'/>
	<property name='implementation.version.major' value='5'/>
	<property name='implementation.version.minor' value='1'/>
	<property name='implementation.version.micro' value='3'/>
	<property name='implementation.version.tag' value='SDK'/>
	<property name='implementation.version.engbuild' value='003'/>
	<property name='app.name' value='xmpcore'/>
	<property name='src.dir' value='${basedir}/src'/>
	<property name='intermediate.dir' value='${basedir}/intermediate'/>
	<property name='target.dir' value='${basedir}/target'/>
	<property name="AdobeIPNumber" value="0000856"/>		

	<!-- Sets the build timestamp -->
	<tstamp>
		<format property="BuildDate" pattern="yyyy MMM dd HH:mm:ss-z" locale="en" />
	</tstamp>


	<!--  =================================================================== -->
	<!--  Build                                                               -->
	<!--  =================================================================== -->

	<target name="build" depends="clean, compile, createjars" />

	
	<!-- =================================================================== -->
	<!-- Compile                                                             -->
	<!-- =================================================================== -->

	<target name="compile">
		<echo message="Compiling ..." level="info" />

		<!-- debug -->
		<antcall target="javac">
			<param name="debug" value="true" />
			<param name="path" value="debug" />
		</antcall>

		<!-- release -->
				<antcall target="javac">
			<param name="debug" value="false" />
			<param name="path" value="release" />
		</antcall>
	</target>
	

	<!-- =================================================================== -->
	<!-- Compile Java files                                                  -->
	<!-- =================================================================== -->

	<target name="javac">
		<mkdir dir="${intermediate.dir}/${path}" />
		<javac debug="${debug}" destdir="${intermediate.dir}/${path}">
			<src path="${src.dir}" />
		</javac>
	</target>
	

	<!-- =================================================================== -->
	<!-- Create Jar Libraries                                                 -->
	<!-- =================================================================== -->

	<target name="createjars" depends="compile">
		<echo message="Create Libs ..." level="info" />
		<antcall target="createjar">
			<param name="path" value="debug" />
		</antcall>
		<antcall target="createjar">
			<param name="path" value="release" />
		</antcall>
		<zip destfile="${target.dir}/debug/${app.name}-src.zip">
			<fileset dir="${src.dir}" excludes="**/package.html"/>
		</zip>
	</target>

	<target name="createjar">
		<mkdir dir="${target.dir}/${path}" />
		<condition property="debugStr" value="true">
			<equals arg1="${path}" arg2="debug" />
		</condition>
		<condition property="debugStr" value="false">
			<equals arg1="${path}" arg2="release" />
		</condition>

		<jar destfile="${target.dir}/${path}/${app.name}.jar" update="false">
			<fileset dir="${intermediate.dir}/${path}">
				<patternset refid="jar.classes" />
			</fileset>
		</jar>
		
		<jar update="true" keepcompression="true" compress="false"
			 destfile="${target.dir}/${path}/${app.name}.jar">
			<manifest>
				<attribute name="Implementation-Title"
                           value="${implementation.title}" />
				<attribute name="Implementation-Vendor"
                           value="${implementation.copyright}" />
				<attribute name="Implementation-Major"
                           value="${implementation.version.major}" />
				<attribute name="Implementation-Minor"
                           value="${implementation.version.minor}" />
				<attribute name="Implementation-Micro"
                           value="${implementation.version.micro}" />
				<attribute name="Implementation-Debug"
                           value="${debugStr}" />
				<attribute name="Implementation-EngBuild"
                           value="${implementation.version.engbuild}" />
				<attribute name="BuildDate"
						   value="${BuildDate}" />
				<attribute name="AdobeIP"
                           value="&lt;AdobeIP#${AdobeIPNumber}&gt;" />
			</manifest>
		</jar>
	</target>
	
	
	<!-- =================================================================== -->
	<!-- Clean                                                               -->
	<!-- =================================================================== -->

	<target name="clean">
		<echo message="Clean..." level="info" />
		<delete dir="${intermediate.dir}" />
		<delete dir="${target.dir}" />
	</target>


	<!-- =================================================================== -->
	<!-- Filesets                                                            -->
	<!-- =================================================================== -->

	<!-- contents of the library jar -->
	<patternset id="jar.classes">
		<include name="**/*.class" />
		<include name="**/version.properties" />
	</patternset>
</project>