<?xml version="1.0" encoding="UTF-8" ?>
<project name="BlancoFixedLengthPlugin" default="build" basedir=".">
	<property name="version" value="0.4.2" />

	<property name="product" value="blanco.plugin.fixedlength" />
	<property name="project.zip" value="${product}_${version}-src.zip" />
	<property name="project.plugin30.zip" value="${product}_${version}-eclipse3.0.zip" />
	<property name="project.plugin31.jar" value="${product}_${version}-eclipse3.1.jar" />
	<property name="project.plugin.main.jar" value="blancofixedlengthplugin.jar" />

	<taskdef name="blancoconstants" classname="blanco.constants.task.BlancoConstantsTask">
		<classpath>
			<fileset dir="lib" includes="*.jar" />
			<fileset dir="lib.ant" includes="*.jar" />
		</classpath>
	</taskdef>
	<taskdef name="blancoeclipseplugingen" classname="blanco.eclipseplugingen.task.BlancoEclipsePluginGenTask">
		<classpath>
			<fileset dir="lib" includes="*.jar" />
			<fileset dir="lib.ant" includes="*.jar" />
		</classpath>
	</taskdef>

	<target name="pack">
		<echo>packing project</echo>
		<delete file="${project.zip}" />
		<delete file="bin/blancofixedlengthplugin.jar" />

		<delete dir="javadoc" />
		<delete dir="tmp" />
		<mkdir dir="tmp" />

		<zip destfile="${project.zip}">
			<zipfileset dir="." prefix="blancoFixedLengthPlugin" excludes="${project.plugin30.zip},${project.plugin31.jar},${project.zip},**/*.class" />
		</zip>
	</target>

	<target name="build-plugin">
		<echo>building plugin</echo>

		<echo>事前にコンパイルされていることが必要です</echo>
		<delete file="bin/${project.plugin.main.jar}" />
		<jar destfile="bin/${project.plugin.main.jar}">
			<zipfileset dir="bin" excludes="${project.plugin.jar},${project.plugin.main.jar}" />
			<zipfileset dir="src" prefix="src" />
		</jar>

		<!-- Eclipse 3.0用は ZIPファイルとしてアーカイブ -->
		<delete file="${project.plugin30.zip}" />
		<zip destfile="${project.plugin30.zip}">
			<zipfileset dir="icons" prefix="plugins/${product}_${version}/icons" />
			<zipfileset dir="lib" prefix="plugins/${product}_${version}/lib" includes="blanco*.jar,jxl*.jar" />
			<zipfileset dir="doc" prefix="plugins/${product}_${version}/doc" />
			<zipfileset dir="meta" prefix="plugins/${product}_${version}/meta" />
			<zipfileset file="bin/blancofixedlengthplugin.jar" prefix="plugins/${product}_${version}/lib" />
			<zipfileset dir="bin" prefix="plugins/${product}_${version}/lib" includes="${project.plugin.jar}" />
			<zipfileset dir="." prefix="plugins/${product}_${version}" includes="plugin.xml" />
			<zipfileset dir="." prefix="plugins/${product}_${version}" includes="about.html" />
			<!-- META-INFフォルダを含めてみます -->
			<zipfileset dir="META-INF" prefix="plugins/${product}_${version}/META-INF" />
		</zip>

		<!-- Eclipse 3.1用は JARファイルとしてアーカイブ -->
		<delete file="${project.plugin31.jar}" />
		<jar destfile="${project.plugin31.jar}" manifest="META-INF/MANIFEST.MF">
			<manifest>
				<attribute name="Bundle-Version" value="${version}" />
			</manifest>
			<zipfileset dir="icons" prefix="icons" />
			<zipfileset dir="lib" prefix="lib" includes="blanco*.jar,jxl*.jar" />
			<zipfileset dir="doc" prefix="doc" />
			<zipfileset dir="meta" prefix="meta" />
			<zipfileset file="bin/blancofixedlengthplugin.jar" prefix="lib" />
			<zipfileset dir="bin" prefix="lib" includes="${project.plugin.jar}" />
			<zipfileset dir="." includes="plugin.xml" />
			<zipfileset dir="." includes="about.html" />
		</jar>
	</target>

	<!-- JavaDoc記述 2005.12.15版 -->
	<target name="javadoc">
		<echo>JavaDocを生成します。</echo>
		<delete dir="javadoc" />
		<javadoc destdir="javadoc">
			<fileset dir="src" />
			<fileset dir="blanco/main" />
			<classpath>
				<fileset dir="lib" includes="*.jar" />
				<fileset dir="lib.ant" includes="*.jar" />
			</classpath>
		</javadoc>
	</target>

	<target name="meta">
		<blancoeclipseplugingen metadir="meta/program" tmpdir="tmp" targetdir="blanco" />
		<blancoconstants metadir="meta/program" targetdir="blanco" />
	</target>

	<target name="build" depends="meta,build-plugin,pack">
	</target>

</project>
