Newer
Older
osmCoverage / build.xml
@yuuhayashi yuuhayashi on 29 Jan 2017 4 KB first
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE configuration>
<project name="osmCoverage" default="all" basedir=".">
	<!--
	ソース以外にビルドに必要なライブラリ
	javalib/hayashi_0225.jar
	javalib/postgresql-9.4.1212.jar
	javalib/hayashi_0225.jar
	../jar-in-jar-loader.zip
	-->
    <property name="src" value="${basedir}/src" />
    <property name="classes" value="${basedir}/classes" />
	<property name="dest" value="${basedir}/bin"></property>
	<property name="javalib" value="lib"></property>
	<property name="appname" value="osmCoverage"></property>
	<property name="version" value=""></property>
	<property name="dblib" value="postgresql-9.4.1212.jar"></property>
	<property name="hayashilib" value="hayashi_0225.jar"></property>


	<!--
	[STEP 1] クリーンナップ
	-->
	<target name="clean" description="前回作成したclassファイルを削除する">
		<delete>
			<fileset dir="${classes}" includes="**/*.class" />
			<fileset dir="${src}" includes="**/*.class" />
			<fileset dir="${dest}" includes="**/*.*" />
		</delete>
	</target>

	<!--
	[STEP 2] コンパイル
	-->
	<target name="compile_src" depends="clean" description="コンパイル src">
	    <javac target="1.8"	source="1.8" optimize="off" debug="on" verbose="false" srcdir="${src}" destdir="${classes}" encoding="UTF-8" includeantruntime="false">
			<include name="**" />
	    	<exclude name="**/*.smap" />

	    	<classpath>
				<pathelement path="${src}"/>
				<fileset dir="${javalib}">
					<include name="${hayashilib}"/>
					<include name="${dblib}"/>
					<inciude name="hsqldb_2.2.9.jar"/>
				</fileset>
			</classpath>
		</javac>
	</target>

	<!--
	[STEP 3] リンク
	-->
    <target name="create_run_jar" depends="compile_src" description="'${appname}.jar'を作成する">
		<tstamp>
			<format property="ts" pattern="yyyy/MM/dd-HH:mm:ss-z"/>
		</tstamp>
        <jar destfile="${basedir}/${appname}.jar">
			<fileset dir="${src}" includes="**/*.png" />
			<fileset dir="${src}" includes="**/*.gif" />
			<fileset dir="${src}" includes="**/*.jpg" />

			<manifest>
				<attribute name="Main-Class" value="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader"/>
				<attribute name="Rsrc-Main-Class" value="Demo"/>
				<attribute name="Class-Path" value="."/>
				<attribute name="Rsrc-Class-Path" value="./ ../ ${javalib}/${hayashilib} ${javalib}/${dblib}"/>
				<attribute name="Implementation-Title"   value="${appname}"/>
				<attribute name="Implementation-Version" value="${appname}"/>
				<attribute name="Implementation-Vendor"  value="hayashi"/>
				<attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}])"/>
			</manifest>
			<!-- zipfileset src="${javalib}/jar-in-jar-loader.zip"/ -->
            <!-- zipfileset dir="${javalib}" includes="${hayashilib}"/ -->
            <!-- zipfileset dir="${javalib}" includes="${dblib}"/ -->
            <!-- zipfileset dir="${javalib}" includes="hsqldb_2.2.9.jar"/ -->
			<inciude name="hsqldb_2.2.9.jar"/>
			<zipfileset dir="${classes}"/>
			<zipfileset dir="${src}"/>
        </jar>
    </target>

	<!--
	[STEP 4] デプロイ
	-->
    <target name="deploy" depends="create_run_jar" description="'${appname}.jar'を作成する">
    	<zip destfile="${appname}.zip">
    	    <fileset dir="${basedir}" includes="${appname}.jar"/>
			<fileset dir="${javalib}">
				<include name="${hayashilib}"/>
				<include name="${dblib}"/>
			</fileset>
    	    <fileset dir="${src}" includes="*.bat"/>
    	    <fileset dir="${src}" includes="*.sh"/>
    	    <fileset dir="${src}" includes="*.properties"/>
    	    <fileset dir="${src}" includes="*.sql"/>
    	</zip>
    	<copy todir="bin">
    	    <fileset dir="${basedir}" includes="${appname}.jar"/>
			<fileset dir="${javalib}">
				<include name="${hayashilib}"/>
				<include name="${dblib}"/>
			</fileset>
    	    <fileset dir="${src}" includes="*.bat"/>
    	    <fileset dir="${src}" includes="*.sh"/>
    	    <fileset dir="${src}" includes="*.properties"/>
    	    <fileset dir="${src}" includes="*.sql"/>
    	</copy>
    </target>

	<target name="all" depends="deploy"></target>
</project>