miscJar/ant/build.xml
François 1e613814ef Init
2022-01-26 19:00:01 +01:00

580 lines
22 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project name="Dr. F.Merciol Chess" default="compile" basedir="..">
<tstamp>
<format property="TODAY_FR" pattern="yyyyMMdd" locale="fr,FR"/>
</tstamp>
<!-- ======================================== -->
<description>
Java Practice : the chess game, by Dr. F. Merciol (c) 2008
</description>
<property name="work" location="ws"/>
<property name="data" location="data"/>
<property name="log" location="data/log"/>
<property name="java.src" location="src/java"/>
<property name="java.test" location="src/javaTest"/>
<property name="junit.jar" location="import/jar/junit-4.6.jar"/>
<property name="dodwan.jar" location="import/jar/dodwan-1.0.1.jar"/>
<property name="result" location="build"/>
<property name="result.api" location="build/api"/>
<property name="result.class" location="build/class"/>
<property name="result.jar" location="build/jar"/>
<property name="result.miscJar" location="build/jar/misc.jar"/>
<property name="result.distrib" location="distrib"/>
<path id="test.classpath">
<pathelement location="${result.class}"/>
<pathelement path="/usr/share/java/junit4.jar:/usr/share/java/junit.jar:${java.class.path}:${result.miscJar}"/>
<fileset dir="${result.jar}">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- ======================================== -->
<target name="1stCmd" description="Must be done first of all (create link to launch ant in workspace)">
<symlink failonerror="false" link="${work}/build.xml" resource="../ant/build.xml"/>
<symlink failonerror="false" link="${work}/" resource="${data}/"/>
<symlink failonerror="false" link="${work}/" resource="${dodwan.jar}"/>
<symlink failonerror="false" link="${work}/" resource="${result.jar}/Chess.jar"/>
<symlink failonerror="false" link="${work}/" resource="${result.jar}/Chat.jar"/>
</target>
<!-- ======================================== -->
<target name="cleanConfig" description="clean XML file configuration" >
<dirname property="pwd" file="ant" />
<replaceregexp byline="true">
<regexp pattern="(.*)${pwd}(.*)"/>
<substitution expression="\1\.\2"/>
<fileset dir="data/config">
<include name="*.xml"/>
</fileset>
</replaceregexp>
<replaceregexp byline="true">
<regexp pattern="(.*entry key=&#34;.*Location&#34;&#62;)[^&#93;]*(.*)"/>
<substitution expression="\1&#91;x=50,y=50\2"/>
<fileset dir="data/config">
<include name="*.xml"/>
</fileset>
</replaceregexp>
<replaceregexp byline="true">
<regexp pattern=".*entry key=&#34;(Language|Variant|Country)&#34;&#62;.*"/>
<substitution expression=""/>
<fileset dir="data/config">
<include name="*.xml"/>
</fileset>
</replaceregexp>
</target>
<!-- ======================================== -->
<target name="clean" depends="cleanConfig" description="clean up (remove classes and temporaries files)" >
<delete dir="${result.class}"/>
<delete dir="${result.api}"/>
<delete verbose="true">
<fileset defaultexcludes="no" dir="." includes="**/*~"/>
<fileset defaultexcludes="no" dir="." includes="**/#*#"/>
<fileset defaultexcludes="no" dir="." includes="**/.#*"/>
</delete>
</target>
<!-- ======================================== -->
<target name="wipe" depends="clean" description="delete all product file (keep only sources)" >
<delete dir="${log}"/>
<delete file="${work}/build.xml"/>
<delete file="${work}/dodwan-1.0.1.jar"/>
<delete file="${work}/Chess.jar"/>
<delete file="${work}/Chat.jar"/>
<symlink failonerror="false" action="delete" link="${work}/data"/>
<delete dir="${result}"/>
</target>
<!-- ======================================== -->
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<mkdir dir="${result.api}"/>
<mkdir dir="${result.class}"/>
<copy todir="${result.class}/data/config">
<fileset dir="${data}/config">
<include name="Controller*.properties"/>
<include name="Help*.properties"/>
<include name="Protocol*.properties"/>
<include name="Proxy*.properties"/>
<include name="RemoteUpdate*.properties"/>
<include name="Story*.properties"/>
<include name="ToolBar*.properties"/>
<include name="Chess*.properties"/>
<include name="Chess.xml"/>
<include name="BundleManager*.properties"/>
<include name="BundleManager.xml"/>
<include name="Chat*.properties"/>
<include name="Chat.xml"/>
</fileset>
</copy>
<mkdir dir="${log}"/>
<mkdir dir="${result.jar}"/>
<mkdir dir="${result.distrib}"/>
</target>
<!-- ======================================== -->
<target name="compile" depends="init" description="compile the source" >
<javac includeantruntime="false" destdir="${result.class}" deprecation="true" debug="true" verbose="false" encoding="iso-8859-1">
<compilerarg value="-Xlint" />
<src path="${java.src}"/>
<src path="${java.test}"/>
<classpath>
<pathelement location="${result.class}"/>
<pathelement path="${dodwan.jar}:${junit.jar}:${java.class.path}"/>
</classpath>
</javac>
</target>
<!-- ======================================== -->
<target name="junit" depends="compile">
<junit fork="yes" printsummary="no" haltonfailure="no" dir="${work}">
<classpath refid="test.classpath" />
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${result.class}" includes="**/*Test.class" />
<!--fileset dir="${result.class}" includes="**/JChessboardTest.class" /-->
</batchtest>
</junit>
</target>
<!-- ======================================== -->
<target name="junitGUI" depends="compile">
<exec executable="junit">
<env key="CLASSPATH"
value="${result.class}:/usr/share/java/junit.jar:/usr/share/java/junit4.jar:${java.class.path}"/>
</exec>
</target>
<!-- ======================================== -->
<target name="test" depends="compile" description="execute test" >
<java classname="network.chat.LaunchChat" fork="true">
<jvmarg value="-Djava.net.preferIPv4Stack=true"/>
<!--jvmarg value="-Djava.security.policy=grant"/-->
<arg value="hello"/>
<classpath>
<pathelement location="${result.class}"/>
<pathelement path="${junit.jar}:${java.class.path}"/>
</classpath>
</java>
</target>
<!-- ======================================== -->
<target name="doc" depends="compile" description="make Application Programming Interface documentation" >
<javadoc
destdir="${result.api}"
author="true"
version="true"
use="true"
windowtitle="Chess Game source files"
overview="${java.src}/overview.html">
<fileset dir="${java.src}" defaultexcludes="yes">
<!-- include name="com/dummy/test/**" / -->
<exclude name="**/*.html"/>
<exclude name="**/TODO"/>
<exclude name="**/Makefile*"/>
<exclude name="**/Manifest.*"/>
<exclude name="**/*.[dch]*"/>
<exclude name="**/*.txt"/>
<exclude name="**/*Test.java"/>
</fileset>
<doctitle><![CDATA[<h1>Chess Game source files</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; 2008 Dr. F. Merciol. Tous droits r&eacute;serv&eacute;s.</i>]]></bottom>
</javadoc>
</target>
<!-- ======================================== -->
<target name="miscJar" depends="cleanConfig,compile" description="make misc jar" >
<jar destfile="${result.jar}/Misc.jar" filesonly="yes" defaultexcludes="yes">
<manifest>
<attribute name="Built-By" value="Dr. F. Merciol"/>
<attribute name="Created-By" value="Dr. F. Merciol"/>
<attribute name="Main-Class" value="misc.Controller"/>
<attribute name="Class-Path" value="Misc.jar"/>
</manifest>
<fileset dir="${result.class}" >
<include name="misc/*.class" />
</fileset>
<fileset dir="." >
<include name="data/images/button/Abort.png" />
<include name="data/images/button/About.png" />
<include name="data/images/button/BugReport.png" />
<include name="data/images/button/Details.png" />
<include name="data/images/button/Down.png" />
<include name="data/images/button/DownloadOff.png" />
<include name="data/images/button/DownloadOn.png" />
<include name="data/images/button/Empty.png" />
<include name="data/images/button/ForcePack.png" />
<include name="data/images/button/JConsoleOff.png" />
<include name="data/images/button/JConsoleOn.png" />
<include name="data/images/button/Licence.png" />
<include name="data/images/button/LocalRemoveOff.png" />
<include name="data/images/button/LocalRemoveOn.png" />
<include name="data/images/button/Locale.png" />
<include name="data/images/button/Online.png" />
<include name="data/images/button/Open.png" />
<include name="data/images/button/PackBug*.png" />
<include name="data/images/button/Quit.png" />
<include name="data/images/button/Redo.png" />
<include name="data/images/button/RemoteRemoveOff.png" />
<include name="data/images/button/RemoteRemoveOn.png" />
<include name="data/images/button/Save*.png" />
<include name="data/images/button/SetProxy.png" />
<include name="data/images/button/ToolBarProfil.png" />
<include name="data/images/button/Undo.png" />
<include name="data/images/button/Up.png" />
<include name="data/images/button/Update.png" />
<include name="data/images/button/UploadOff.png" />
<include name="data/images/button/UploadOn.png" />
<include name="data/images/button/develop.png" />
<include name="data/images/flags/*.png" />
<include name="data/images/misc.png" />
<include name="data/config/Controller*.properties"/>
<include name="data/config/Help*.properties" />
<include name="data/config/Proxy*.properties" />
<include name="data/config/RemoteUpdate*.properties" />
<include name="data/config/Story*.properties" />
<include name="data/config/ToolBar*.properties" />
<include name="data/config/Misc.xml"/>
<include name="data/texts/*Misc*.html"/>
</fileset>
</jar>
</target>
<target name="signMiscJar" depends="miscJar" description="sign misc jar" >
<signjar jar="${result.jar}/Misc.jar" alias="Dr. F. Merciol" storepass="felixfelix"/>
</target>
<target name="runMiscJar" depends="miscJar" description="execute misc jar" >
<java jar="${result.jar}/Misc.jar" fork="true">
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<!-- ======================================== -->
<target name="bundleJar" depends="compile,miscJar" description="make bundle jar" >
<jar destfile="${result.jar}/Bundle.jar" filesonly="yes" defaultexcludes="yes">
<manifest>
<attribute name="Built-By" value="Dr. F. Merciol"/>
<attribute name="Created-By" value="Dr. F. Merciol"/>
<attribute name="Main-Class" value="tool.LaunchBundleManager"/>
<attribute name="Class-Path" value="Misc.jar"/>
</manifest>
<fileset dir="${result.class}" >
<include name="tool/**/*.class" />
</fileset>
<fileset dir="." >
<include name="data/images/**/*.png" />
<include name="data/config/Controller*.properties" />
<include name="data/config/Help*.properties" />
<include name="data/config/Proxy*.properties" />
<include name="data/config/RemoteUpdate*.properties" />
<include name="data/config/Story*.properties" />
<include name="data/config/ToolBar*.properties" />
<include name="data/config/BundleManager*.properties" />
<include name="data/config/BundleManager.xml" />
</fileset>
</jar>
</target>
<target name="signBundleJar" depends="bundleJar" description="sign bundle jar" >
<signjar jar="${result.jar}/Bundle.jar" alias="Dr. F. Merciol" storepass="felix"/>
</target>
<!-- ======================================== -->
<target name="runBundleJar" depends="bundleJar" description="execute bundle jar" >
<java jar="${result.jar}/Bundle.jar" fork="true">
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<!-- ======================================== -->
<target name="chatJar" depends="compile,miscJar" description="make chat jar" >
<jar destfile="${result.jar}/Chat.jar" filesonly="yes" defaultexcludes="yes">
<manifest>
<attribute name="Built-By" value="Dr. F. Merciol"/>
<attribute name="Created-By" value="Dr. F. Merciol"/>
<attribute name="Main-Class" value="network.chat.LaunchChat"/>
<attribute name="Class-Path" value="Misc.jar"/>
</manifest>
<fileset dir="${result.class}" >
<include name="network/*.class" />
<include name="network/chat/*.class" />
<include name="network/login/*.class" />
</fileset>
<fileset dir="." >
<include name="data/images/**/*.png" />
<include name="data/config/Controller*.properties" />
<include name="data/config/Help*.properties" />
<include name="data/config/Proxy*.properties" />
<include name="data/config/RemoteUpdate*.properties" />
<include name="data/config/Story*.properties" />
<include name="data/config/ToolBar*.properties" />
<include name="data/config/Protocol*.properties" />
<include name="data/config/Login*.properties" />
<include name="data/config/Chat*.properties" />
<include name="data/config/Chat.xml" />
</fileset>
</jar>
</target>
<target name="signChatJar" depends="chatJar" description="sign chat jar" >
<signjar jar="${result.jar}/Chat.jar" alias="Dr. F. Merciol" storepass="felix"/>
</target>
<!-- ======================================== -->
<target name="runChatJar" depends="chatJar" description="execute chat jar" >
<java jar="${result.jar}/Chat.jar" fork="true">
<!--jvmarg value="-Djava.net.preferIPv4Stack=true"/-->
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<!-- ======================================== -->
<target name="launchChat" depends="chessJar" description="execute chess jar" >
<java classname="network.chat.LaunchChat" fork="true">
<jvmarg value="-Ddodwan.root=./DoDWAN"/>
<jvmarg value="-Ddodwan.host=f"/>
<jvmarg value="-Ddodwan.announce_period=1"/>
<!--jvmarg value="-Djava.net.preferIPv4Stack=true"/-->
<classpath>
<pathelement path="${java.class.path}"/>
<pathelement path="${dodwan.jar}"/>
<pathelement path="${result.class}"/>
</classpath>
</java>
</target>
<!-- ======================================== -->
<target name="loginJar" depends="compile,miscJar" description="make login jar" >
<jar destfile="${result.jar}/Login.jar" filesonly="yes" defaultexcludes="yes">
<manifest>
<attribute name="Built-By" value="Dr. F. Merciol"/>
<attribute name="Created-By" value="Dr. F. Merciol"/>
<attribute name="Main-Class" value="network.login.LaunchLogin"/>
<attribute name="Class-Path" value="Misc.jar"/>
</manifest>
<fileset dir="${result.class}" >
<include name="network/*.class" />
<include name="network/login/*.class" />
</fileset>
<fileset dir="." >
<include name="data/images/**/*.png" />
<include name="data/config/Controller*.properties" />
<include name="data/config/Help*.properties" />
<include name="data/config/Proxy*.properties" />
<include name="data/config/RemoteUpdate*.properties" />
<include name="data/config/Story*.properties" />
<include name="data/config/ToolBar*.properties" />
<include name="data/config/Protocol*.properties" />
<include name="data/config/Login*.properties" />
<include name="data/config/Login.xml" />
</fileset>
</jar>
</target>
<target name="signLoginJar" depends="loginJar" description="sign login jar" >
<signjar jar="${result.jar}/Login.jar" alias="Dr. F. Merciol" storepass="felix"/>
</target>
<!-- ======================================== -->
<target name="runLoginJar" depends="loginJar" description="execute login jar" >
<java jar="${result.jar}/Login.jar" fork="true">
<!--jvmarg value="-Djava.net.preferIPv4Stack=true"/-->
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
<!-- ======================================== -->
<target name="launchLogin" depends="chessJar" description="execute chess jar" >
<java classname="network.login.LaunchLogin" fork="true">
<!--jvmarg value="-Djava.net.preferIPv4Stack=true"/-->
<classpath>
<pathelement path="${java.class.path}"/>
<pathelement path="${result.class}"/>
</classpath>
</java>
</target>
<!-- ======================================== -->
<target name="chessJar" depends="compile,miscJar" description="make chess jar" >
<jar destfile="${result.jar}/Chess.jar" filesonly="yes" defaultexcludes="yes">
<manifest>
<attribute name="Built-By" value="Dr. F. Merciol"/>
<attribute name="Created-By" value="Dr. F. Merciol"/>
<attribute name="Main-Class" value="chess.LaunchChess"/>
<attribute name="Class-Path" value="Misc.jar"/>
</manifest>
<fileset dir="${result.class}" >
<include name="network/*.class" />
<include name="network/chat/*.class" />
<include name="network/login/*.class" />
<include name="chess/**/*.class" />
</fileset>
<fileset dir="." >
<include name="data/texts/**/*.html" />
<include name="data/images/**/*.png" />
<include name="data/config/Controller*.properties" />
<include name="data/config/Help*.properties" />
<include name="data/config/Proxy*.properties" />
<include name="data/config/RemoteUpdate*.properties" />
<include name="data/config/Story*.properties" />
<include name="data/config/ToolBar*.properties" />
<include name="data/config/Protocol*.properties" />
<include name="data/config/Login*.properties" />
<include name="data/config/Chat*.properties" />
<include name="data/config/Chess*.properties" />
<include name="data/config/Chess.xml" />
</fileset>
</jar>
</target>
<target name="signChessJar" depends="chessJar" description="sign chess jar" >
<signjar jar="${result.jar}/Chess.jar" alias="Dr. F. Merciol" storepass="felix"/>
</target>
<!-- ======================================== -->
<target name="runChessJar" depends="chessJar" description="execute chess jar" >
<java jar="${result.jar}/Chess.jar" fork="true">
<jvmarg value="-Ddodwan.root=./DoDWAN"/>
<jvmarg value="-Ddodwan.host=f"/>
<jvmarg value="-Ddodwan.announce_period=1"/>
<!--jvmarg value="-Djava.net.preferIPv4Stack=true"/-->
<classpath>
<pathelement path="${dodwan.jar}:${java.class.path}"/>
</classpath>
</java>
</target>
<!-- ======================================== -->
<target name="launchChess" depends="chessJar" description="execute chess jar" >
<java classname="chess.LaunchChess" fork="true">
<jvmarg value="-Ddodwan.root=./DoDWAN"/>
<jvmarg value="-Ddodwan.host=f"/>
<jvmarg value="-Ddodwan.announce_period=1"/>
<arg value="hello"/>
<classpath>
<pathelement path="${java.class.path}"/>
<pathelement path="${dodwan.jar}"/>
<pathelement path="${result.jar}/Chess.jar"/>
</classpath>
</java>
</target>
<!-- ======================================== -->
<target name="launchGame" depends="chessJar" description="execute chess jar" >
<java classname="chess.LaunchGame" fork="true">
<arg value="hello"/>
<classpath>
<pathelement path="${java.class.path}"/>
<pathelement path="${result.jar}/Chess.jar"/>
</classpath>
</java>
</target>
<!-- ======================================== -->
<target name="launchChessboard" depends="chessJar" description="execute chess jar" >
<java classname="chess.LaunchChessboard" fork="true">
<arg value="hello"/>
<classpath>
<pathelement path="${java.class.path}"/>
<pathelement path="${result.jar}/Chess.jar"/>
</classpath>
</java>
</target>
<!-- ======================================== -->
<target name="srcBzip2" depends="srcZip" description="create distribution" >
<tar tarfile="${result.distrib}/merciolChessSrc.tar.bz2" compression="bzip2">
<zipfileset src="${result.distrib}/merciolChessSrc.zip"/>
</tar>
</target>
<!-- ======================================== -->
<target name="srcZip" depends="chessJar,bundleJar,cleanConfig" description="create distribution" >
<zip destfile="${result.distrib}/merciolChessSrc.zip">
<zipfileset prefix="merciolChessSrc/" dir=".">
<include name="ant/build.xml"/>
<include name="build/jar/Bundle.jar"/>
<include name="build/jar/Chess.jar"/>
<include name="data/config/*.properties"/>
<include name="data/config/*.xml"/>
<include name="data/games/*.chess"/>
<include name="data/images/button/*.png"/>
<include name="data/images/chess/*.png"/>
<include name="data/texts/*.html"/>
<include name="import/jar/*.jar"/>
<include name="readme/Readme.*"/>
<include name="src/java/chess/**/*.java"/>
<include name="src/java/network/**/*.java"/>
<include name="src/java/misc/*.java"/>
<include name="src/javaTest/chess/**/*.java"/>
<include name="ws/dodwan/conf/dodwan.defaults"/>
</zipfileset>
<zipfileset prefix="merciolChessSrc/" dir="." filemode="755">
<include name="ws/*.sh"/>
</zipfileset>
</zip>
</target>
<!-- ======================================== -->
<target name="exeBzip2" depends="exeZip" description="create distribution" >
<tar tarfile="${result.distrib}/merciolChessExe.tar.bz2" compression="bzip2">
<zipfileset src="${result.distrib}/merciolChessExe.zip"/>
</tar>
</target>
<!-- ======================================== -->
<target name="exeZip" depends="cleanConfig,bundleJar,loginJar,chessJar,chatJar,miscJar" description="create distribution" >
<zip destfile="${result.distrib}/merciolChessExe.zip">
<zipfileset prefix="merciolChess/" dir="${result.jar}">
<include name="Bundle.jar"/>
<include name="Login.jar"/>
<include name="Chat.jar"/>
<include name="Chess.jar"/>
<include name="Misc.jar"/>
</zipfileset>
<zipfileset prefix="merciolChess/" dir="import/jar/">
<include name="dodwan-1.0.1.jar"/>
</zipfileset>
<zipfileset prefix="merciolChess/" dir="${work}" filemode="755">
<include name="start_dodwand.sh"/>
<include name="start_chess.sh"/>
</zipfileset>
<zipfileset prefix="merciolChess/" dir="${work}">
<include name="dodwan/conf/dodwan.defaults"/>
</zipfileset>
<zipfileset prefix="merciolChess/" dir=".">
<include name="data/config/*.properties"/>
<include name="data/games/*.chess"/>
</zipfileset>
</zip>
</target>
<!-- ======================================== -->
<target name="miscZip" depends="cleanConfig,miscJar" description="create distribution" >
<zip destfile="${result.distrib}/${TODAY_FR}-Misc.zip">
<zipfileset prefix="" dir="${result.jar}">
<include name="Misc.jar"/>
</zipfileset>
</zip>
</target>
<!-- ======================================== -->
</project>