<?xml version="1.0" encoding="UTF-8"?>
<project name="com.raytheon.uf.edex.common.core.feature" default="build.update.jar" basedir=".">

	<target name="init">
		<property name="feature.temp.folder" value="${basedir}/feature.temp.folder"/>
		<property name="feature.destination" value="${basedir}"/>
		<property name="p2.build.repo" value="file:${buildDirectory}/buildRepo"/>
		<condition property="p2.publish.parts" value="true"		>
			<istrue value="${p2.gathering}"/>
		</condition>
	</target>

	<target name="all.plugins" depends="init">
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.status" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.python" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.jms" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.util" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.comm" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.serialization" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.colormap" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.serialization.comm" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.datastorage" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.auth" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.localization" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.plugin.nwsauth" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.dissemination" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.awipstools" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.management" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.cache" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.menus" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.message" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.datastorage.remote" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.alertmonitor" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.alertviz" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.time" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.dataquery" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.dataplugin" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.dataplugin.level" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.geospatial" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.pointdata" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.sounding" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.edex.core" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.edex.database" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.site" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.datastorage.hdf5" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.topo" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.pypies" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.hlstopo" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.derivparam" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.edex.management" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
		<ant antfile="build.xml" dir="../com.raytheon.uf.common.climo" target="${target}">
			<property name="arch" value="x86"/>
			<property name="ws" value="gtk"/>
			<property name="os" value="linux"/>
		</ant>
	</target>
	<target name="all.features" depends="init">
	</target>
	<target name="update.feature" depends="init">
	</target>

	<target name="all.children" depends="init,all.features,all.plugins,update.feature">
	</target>

	<target name="children" if="include.children">
		<antcall target="all.children"/>
	</target>

	<target name="build.jars" depends="init" description="Build all the jars for the feature: com.raytheon.uf.edex.common.core.feature.">
		<antcall target="all.children">
			<param name="target" value="build.jars"/>
		</antcall>
	</target>

	<target name="build.sources" depends="init">
		<antcall target="all.children">
			<param name="target" value="build.sources"/>
		</antcall>
	</target>

	<target name="build.zips" depends="init">
		<antcall target="all.children">
			<param name="target" value="build.zips"/>
		</antcall>
	</target>

	<target name="build.update.jar" depends="init" description="Build the feature jar of: com.raytheon.uf.edex.common.core.feature for an update site.">
		<antcall target="all.children">
			<param name="target" value="build.update.jar"/>
		</antcall>
		<property name="feature.base" value="${feature.temp.folder}"/>
		<delete dir="${feature.temp.folder}"/>
		<mkdir dir="${feature.temp.folder}"/>
		<mkdir dir="${feature.temp.folder}/features/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140"/>
		<antcall target="gather.bin.parts" inheritAll="false">
			<param name="os" value="*"/>
			<param name="feature.base" value="${feature.temp.folder}"/>
			<param name="updateJar.omitRootfiles" value="true"/>
			<param name="ws" value="*"/>
			<param name="arch" value="*"/>
			<param name="nl" value="*"/>
		</antcall>
		<jar destfile="${feature.destination}/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140.jar" basedir="${feature.temp.folder}/features/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140"/>
		<delete dir="${feature.temp.folder}"/>
	</target>

	<target name="publish.bin.parts" depends="init" if="p2.publish.parts">
		<mkdir dir="${feature.temp.folder}/features/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140"/>
		<copy todir="${feature.temp.folder}/features/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140" failonerror="true" overwrite="true">
			<fileset dir="${basedir}">
				<include name="feature.xml"/>
			</fileset>
		</copy>
		<eclipse.idReplacer featureFilePath="${feature.temp.folder}/features/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140/feature.xml"  selfVersion="1.0.0.201206071140" featureIds="" pluginIds="com.raytheon.uf.common.alertviz:0.0.0,1.0.0.201206071140,com.raytheon.uf.common.awipstools:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.climo:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.cache:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.dataquery:0.0.0,1.0.0.201206071140,com.raytheon.uf.common.datastorage.hdf5:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.datastorage:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.datastorage.remote:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.dataplugin.level:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.derivparam:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.dissemination:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.geospatial:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.menus:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.time:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.dataplugin:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.message:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.util:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.status:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.serialization:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.serialization.comm:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.auth:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.comm:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.localization:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.pointdata:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.pypies:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.python:0.0.0,1.12.1174.201206071140,com.raytheon.uf.edex.core:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.site:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.sounding:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.topo:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.management:0.0.0,1.0.0.201206071140,com.raytheon.uf.edex.management:0.0.0,1.0.0.201206071140,com.raytheon.uf.common.colormap:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.alertmonitor:0.0.0,1.12.1174.201206071140,com.raytheon.uf.edex.database:0.0.0,1.0.0.201206071140,com.raytheon.uf.common.hlstopo:0.0.0,1.0.0.201206071140,com.raytheon.uf.common.jms:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.plugin.nwsauth:0.0.0,1.12.1174.201206071140,"/>
		<eclipse.gatherFeature 
		   metadataRepository="${p2.build.repo}"
		   artifactRepository="${p2.build.repo}"
		   buildResultFolder="${feature.temp.folder}/features/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140"
		   baseDirectory="${basedir}"
		/>
	</target>

	<target name="gather.bin.parts" depends="init" if="feature.base">
		<mkdir dir="${feature.base}/features/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140"/>
		<antcall target="children">
			<param name="target" value="gather.bin.parts"/>
			<param name="destination.temp.folder" value="${feature.base}/plugins"/>
		</antcall>
		<copy todir="${feature.base}/features/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140" failonerror="true" overwrite="false">
			<fileset dir="${basedir}">
				<include name="feature.xml"/>
			</fileset>
		</copy>
		<eclipse.idReplacer featureFilePath="${feature.base}/features/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140/feature.xml"  selfVersion="1.0.0.201206071140" featureIds="" pluginIds="com.raytheon.uf.common.alertviz:0.0.0,1.0.0.201206071140,com.raytheon.uf.common.awipstools:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.climo:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.cache:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.dataquery:0.0.0,1.0.0.201206071140,com.raytheon.uf.common.datastorage.hdf5:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.datastorage:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.datastorage.remote:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.dataplugin.level:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.derivparam:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.dissemination:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.geospatial:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.menus:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.time:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.dataplugin:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.message:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.util:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.status:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.serialization:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.serialization.comm:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.auth:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.comm:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.localization:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.pointdata:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.pypies:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.python:0.0.0,1.12.1174.201206071140,com.raytheon.uf.edex.core:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.site:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.sounding:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.topo:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.management:0.0.0,1.0.0.201206071140,com.raytheon.uf.edex.management:0.0.0,1.0.0.201206071140,com.raytheon.uf.common.colormap:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.alertmonitor:0.0.0,1.12.1174.201206071140,com.raytheon.uf.edex.database:0.0.0,1.0.0.201206071140,com.raytheon.uf.common.hlstopo:0.0.0,1.0.0.201206071140,com.raytheon.uf.common.jms:0.0.0,1.12.1174.201206071140,com.raytheon.uf.common.plugin.nwsauth:0.0.0,1.12.1174.201206071140,"/>
		<antcall target="rootFiles">
			<param name="rootTarget" value="rootFiles${os}_${ws}_${arch}"/>
		</antcall>
	</target>
	<target name="rootFiles" unless="updateJar.omitRootfiles">
		<antcall target="${rootTarget}"/>
	</target>

	<target name="rootFileslinux_gtk_x86">
	</target>
	<target name="rootFilesgroup_group_group">
		<antcall target="rootFileslinux_gtk_x86"/>
	</target>

	<target name="zip.distribution" depends="init" description="Create a zip containing all the plug-ins and features for the feature: com.raytheon.uf.edex.common.core.feature.">
		<delete dir="${feature.temp.folder}"/>
		<mkdir dir="${feature.temp.folder}"/>
		<antcall target="gather.bin.parts">
			<param name="feature.base" value="${feature.temp.folder}"/>
			<param name="os" value="*"/>
			<param name="arch" value="*"/>
			<param name="ws" value="*"/>
			<param name="nl" value="*"/>
			<param name="include.children" value="true"/>
		</antcall>
		<zip destfile="${feature.destination}/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140.bin.dist.zip" basedir="${feature.temp.folder}" filesonly="false" whenempty="skip" update="false"/>
		<delete dir="${feature.temp.folder}"/>
	</target>

	<target name="zip.sources" depends="init">
		<delete dir="${feature.temp.folder}"/>
		<mkdir dir="${feature.temp.folder}"/>
		<antcall target="all.children">
			<param name="target" value="gather.sources"/>
			<param name="destination.temp.folder" value="${feature.temp.folder}/plugins/com.raytheon.uf.edex.common.core.feature.source_1.0.0.201206071140/src"/>
			<param name="include.children" value="true"/>
		</antcall>
		<zip destfile="${feature.destination}/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140.src.zip" basedir="${feature.temp.folder}" filesonly="true" whenempty="skip" update="false"/>
		<delete dir="${feature.temp.folder}"/>
	</target>

	<target name="zip.logs" depends="init">
		<delete dir="${feature.temp.folder}"/>
		<mkdir dir="${feature.temp.folder}"/>
		<condition property="logExtension.param" value="logExtension" else="logExtension.param"		>
			<isset property="logExtension"/>
		</condition>
		<antcall target="all.children" inheritAll="false">
			<param name="target" value="gather.logs"/>
			<param name="destination.temp.folder" value="${feature.temp.folder}/plugins"/>
			<param name="include.children" value="true"/>
			<param name="${logExtension.param}" value="${logExtension}"/>
		</antcall>
		<zip destfile="${feature.destination}/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140.log.zip" basedir="${feature.temp.folder}" filesonly="true" whenempty="skip" update="false"/>
		<delete dir="${feature.temp.folder}"/>
	</target>

	<target name="clean" depends="init" description="Clean the feature: com.raytheon.uf.edex.common.core.feature of all the zips, jars and logs created.">
		<delete file="${feature.destination}/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140.jar"/>
		<delete file="${feature.destination}/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140.bin.dist.zip"/>
		<delete file="${feature.destination}/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140.log.zip"/>
		<delete file="${feature.destination}/com.raytheon.uf.edex.common.core.feature_1.0.0.201206071140.src.zip"/>
		<delete dir="${feature.temp.folder}"/>
		<antcall target="all.children">
			<param name="target" value="clean"/>
		</antcall>
	</target>

	<target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
		<eclipse.convertPath fileSystemPath="/var/git/COMMON/edexOsgi/com.raytheon.uf.edex.common.core.feature/" property="resourcePath"/>
		<eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/>
		<antcall target="all.children">
			<param name="target" value="refresh"/>
		</antcall>
	</target>
	<target name="gather.sources">
		<antcall target="children">
			<param name="target" value="gather.sources"/>
			<param name="destination.temp.folder" value="${feature.temp.folder}/plugins/com.raytheon.uf.edex.common.core.feature.source_1.0.0.201206071140/src"/>
		</antcall>
	</target>

	<target name="gather.logs" depends="init">
		<mkdir dir="${feature.temp.folder}/plugins"/>
		<property name="destination.temp.folder" value="${feature.temp.folder}/plugins"/>
		<condition property="logExtension.param" value="logExtension" else="logExtension.param"		>
			<isset property="logExtension"/>
		</condition>
		<antcall target="all.children" inheritAll="false">
			<param name="target" value="gather.logs"/>
			<param name="${logExtension.param}" value="${logExtension}"/>
			<param name="destination.temp.folder" value="${feature.temp.folder}/plugins"/>
		</antcall>
	</target>

</project>