<?xml version="1.0" encoding="UTF-8"?>
<project name="NicoCache_nl" default="jar">
	<property name="nicocache.jar" value="NicoCache_nl.jar"/>
	<property name="extproj-dir" value="../NicoCache_nl-ext"/>
	<property environment="env"/>
	<available file="src" type="dir" property="srcdir-exists"/>
	<available file="${extproj-dir}/deploy.xml" property="extdeploy-exists"/>
	<target name="compile" unless="eclipse.running">
		<javac source="1.7" target="1.7" encoding="MS932"
				srcdir="src" destdir="src"
				includeantruntime="false"
				bootclasspath="${java.home}/lib/rt.jar"
				debug="on" debuglevel="lines,source">
			<compilerarg value="-Xlint:-options"/>
			<include name="dareka/**"/>
			<exclude name="dareka/**/package-info.java"/>
		</javac>
	</target>
	<target name="jar" depends="compile" if="srcdir-exists">
		<move file="${nicocache.jar}" tofile="${nicocache.jar}.old"
			failonerror="false"/>
		<jar destfile="${nicocache.jar}">
			<manifest>
				<attribute name="Class-Path"
					value="sqlite-jdbc.jar igo.jar library.jar"/>
				<attribute name="Main-Class" value="dareka.NLMain"/>
			</manifest>
			<fileset dir="src">
				<include name="dareka/**"/>
				<exclude name="dareka/**/package-info.class"/>
				<include name="native/*.cpp"/>
				<include name="native/*.sln"/>
				<include name="native/*.vcproj"/>
			</fileset>
		</jar>
	</target>
	<target name="archive">
		<zip destfile="development.zip" compress="false">
			<fileset dir=".">
				<include name=".externalToolBuilders/**"/>
				<include name=".settings/**"/>
				<include name=".classpath"/>
				<include name=".project"/>
				<include name="build.xml"/>
			</fileset>
			<fileset dir="src">
				<include name="extensions/*.java"/>
				<include name="extensions/*.cmd"/>
			</fileset>
		</zip>
	</target>
	<target name="deploy" depends="jar" if="env.NICOCACHE_HOME">
		<copy file="${nicocache.jar}" todir="${env.NICOCACHE_HOME}"
			preservelastmodified="true"/>
		<antcall target="deploy-ext" inheritAll="false"/>
	</target>
	<target name="deploy-ext" if="extdeploy-exists">
		<ant dir="${extproj-dir}" antfile="deploy.xml"/>
	</target>
	<target name="clean" if="srcdir-exists">
		<delete>
			<fileset dir="src" includes="**/*.class"/>
			<fileset file="${nicocache.jar}"/>
			<fileset file="development.zip"/>
		</delete>
		<delete dir="documents/javadoc"/>
	</target>
	<target name="extract">
		<unjar src="${nicocache.jar}" dest="src" overwrite="false">
			<patternset>
				<include name="dareka/**"/>
				<include name="native/**"/>
				<exclude name="**/*.class"/>
			</patternset>
		</unjar>
		<delete quiet="true">
			<fileset dir="src" includes="**/*.class"/>
		</delete>
	</target>
	<target name="javadoc">
		<mkdir dir="documents/javadoc"/>
		<javadoc sourcepath="src" destdir="documents/javadoc" encoding="MS932"
			excludepackagenames="extensions"
			doctitle="NicoCache_nl API Reference"
			windowtitle="NicoCache_nl API Reference"
			link="http://docs.oracle.com/javase/jp/7/api/"/>
	</target>
</project>
