<?xml version="1.0" encoding="UTF-8"?>
<project name="Build All" default="dist" basedir=".">
<property name="debug" value="true" />
<property name="debuglevel" value="lines,vars,source" />
<property name="optimize" value="true" />
<property name="nowarn" value="true" />
<property name="compiler" value="javac1.7" />
<property name="src.gameserver" location="java/l2p/gameserver" />
<property name="src.loginserver" location="java/l2p/loginserver" />
<property name="src.commons" location="java/l2p/commons" />
<property name="src.scripts" location="dist/gameserver/data"/>
<property name="dist" location="dist" />
<property name="lib" location="lib" />
<property name="build" location="build" />
<property name="build.classes" location="${build}/classes" />
<property name="build.dist" location="${build}/dist" />
<property name="build.dist.gameserver" location="${build.dist}/gameserver" />
<property name="build.dist.loginserver" location="${build.dist}/loginserver" />
<property name="build.dist.lib" location="${build.dist}/lib" />
<property name="build.dist.tools" location="${build.dist}/tools" />
<property name="build.version" value="Epilogue" />
<property name="build.team" value="EmuRT" />
<property name="build.teamsite" value="http://emurt.ru" />
<property name="build.licensetype" value="Private Edition" />
<property name="build.coredev" value="JunkyFunky" />
<property name="build.datadev" value="JunkyFunky" />
<path id="classpath">
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</path>
<pathconvert property="jar.list" pathsep=" " refid="classpath">
<mapper type="flatten" />
</pathconvert>
<property name="build.classpath" refid="classpath"/>
<tstamp>
<format property="build.tstamp" pattern="yyyy.MM.dd HH:mm" />
</tstamp>
<target name="clean" description="Remove the output directories.">
<delete dir="${build}" />
</target>
<target name="init" depends="checkRequirements" description="Create the output directories.">
<mkdir dir="${build}" />
<mkdir dir="${build.classes}" />
<mkdir dir="${build.dist}" />
<mkdir dir="${build.dist.gameserver}" />
<mkdir dir="${build.dist.lib}" />
<mkdir dir="${build.dist.loginserver}" />
<mkdir dir="${build.dist.tools}" />
</target>
<!--компилим commons-->
<target name="compile-commons" depends="init">
<delete dir="${build.classes}" />
<mkdir dir="${build.classes}" />
<javac srcdir="${src.commons}"
destdir="${build.classes}"
debuglevel="${debuglevel}"
compiler="${compiler}"
debug="${debug}"
source="1.7"
target="1.7"
includeantruntime="false"
encoding="UTF-8"
nowarn="${nowarn}"
classpath="${build.classpath}">
<compilerarg value="-Xlint:unchecked,rawtypes,-serial" />
</javac>
</target>
<!--собираем commons в jar-->
<target name="commons-jar" depends="compile-commons">
<exec dir="${basedir}" executable="./lib_svn/svnversion" outputproperty="build.revision" failifexecutionfails="false">
<arg line="-n ${src.commons}" />
</exec>
<echo>Current Revision ${build.revision}</echo>
<jar destfile="${build}/commons.jar" level="9">
<fileset dir="${build.classes}" />
<manifest>
<attribute name="Build-By" value="${user.name}" />
<attribute name="Build-Date" value="${build.tstamp}" />
<attribute name="Revision" value="${build.revision}" />
<attribute name="Chronicle" value="${build.version}" />
<attribute name="Team-Name" value="${build.team}" />
<attribute name="Team-Site" value="${build.teamsite}" />
<attribute name="License-Type" value="${build.licensetype}" />
<attribute name="Core-Dev" value="${build.coredev}" />
<attribute name="Data-Dev" value="${build.datadev}" />
</manifest>
</jar>
</target>
<!--компилим gameserver-->
<target name="compile-gameserver" depends="commons-jar">
<delete dir="${build.classes}" />
<mkdir dir="${build.classes}" />
<javac srcdir="${src.gameserver}"
destdir="${build.classes}"
debuglevel="${debuglevel}"
compiler="${compiler}"
optimize="${optimize}"
debug="${debug}"
source="1.7"
target="1.7"
includeantruntime="false"
encoding="UTF-8"
nowarn="${nowarn}"
classpath="${build.classpath}:${build}/commons.jar">
<compilerarg value="-Xlint:unchecked,rawtypes,-serial" />
</javac>
</target>
<!--собираем gameserver в jar-->
<target name="gameserver-jar" depends="compile-gameserver">
<exec dir="${basedir}" executable="./lib_svn/svnversion" outputproperty="build.revision" failifexecutionfails="false">
<arg line="-n ${src.gameserver}" />
</exec>
<echo>Current Revision ${build.revision}</echo>
<concat destfile="${build}/dist/gameserver/config/version.ini">
Build-By=${user.name}
Version=${build.version}
Revision=${build.revision}
Build Date=${build.tstamp}
OS=${os.name}
JDK=${ant.java.version}
</concat>
<jar destfile="${build}/gameserver.jar" level="9">
<fileset dir="${build.classes}" />
<manifest>
<attribute name="Main-Class" value="l2p.gameserver.GameServer" />
<attribute name="Class-Path" value="${jar.list} commons.jar" />
<attribute name="Build-By" value="${user.name}" />
<attribute name="Build-Date" value="${build.tstamp}" />
<attribute name="Build-Os" value="${os.name}" />
<attribute name="Revision" value="${build.revision}" />
<attribute name="Chronicle" value="${build.version}" />
<attribute name="Team-Name" value="${build.team}" />
<attribute name="Team-Site" value="${build.teamsite}" />
<attribute name="License-Type" value="${build.licensetype}" />
<attribute name="Core-Dev" value="${build.coredev}" />
<attribute name="Data-Dev" value="${build.datadev}" />
</manifest>
</jar>
</target>
<target name="gameserver" depends="gameserver-jar">
<mkdir dir="${build.dist}" />
<mkdir dir="${build.dist.gameserver}" />
<mkdir dir="${build.dist.gameserver}/geodata" />
<mkdir dir="${build.dist.gameserver}/log" />
<copy todir="${build.dist}/lib">
<fileset dir="${build}">
<include name="gameserver.jar" />
</fileset>
</copy>
<fixcrlf srcdir="${build.dist.gameserver}" eol="lf" eof="remove" includes="**/*.sh">
</fixcrlf>
<fixcrlf srcdir="${build.dist.gameserver}" eol="crlf" eof="remove" includes="**/*.bat">
</fixcrlf>
<delete dir="${build.classes}" />
<copy todir="${build.dist.gameserver}" preservelastmodified="true">
<fileset dir="${dist}/gameserver">
<include name="**/*.*"/>
<exclude name="/data/scripts/**/*" />
</fileset>
</copy>
<copy todir="${build.dist.loginserver}" preservelastmodified="true">
<fileset dir="${dist}/loginserver">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${build.dist.tools}" preservelastmodified="true">
<fileset dir="${dist}/tools">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<target name="scripts" depends="scripts-jar">
<copy todir="${build.dist}/lib">
<fileset dir="${build}">
<include name="scripts.jar" />
</fileset>
</copy>
</target>
<!--компилим scripts + собираем scripts в jar-->
<target name="compile-scripts" depends="commons-jar" description="Compile the source.">
<copy todir="${lib}">
<fileset dir="${build}">
<include name="gameserver.jar" />
<include name="commons.jar" />
</fileset>
</copy>
<delete dir="${build.classes}" />
<mkdir dir="${build.classes}" />
<javac destdir="${build.classes}"
optimize="${optimize}"
debuglevel="${debuglevel}"
compiler="${compiler}"
debug="${debug}"
source="1.7"
target="1.7"
encoding="UTF-8"
includeantruntime="false"
nowarn="${nowarn}">
<compilerarg value="-Xlint:unchecked,rawtypes,-serial"></compilerarg>
<src path="${src.scripts}"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="scripts-jar" depends="compile-scripts">
<exec dir="${basedir}" executable="./lib_svn/svnversion" outputproperty="build.revision" failifexecutionfails="false">
<arg line="-n ${src.scripts}" />
</exec>
<echo>Current Revision ${build.revision}</echo>
<jar destfile="${build}/scripts.jar" level="9">
<fileset dir="${build.classes}"/>
<manifest>
<attribute name="Main-Class" value="l2p.gameserver.GameServer"/>
<attribute name="Build-By" value="${user.name}" />
<attribute name="Build-Date" value="${build.tstamp}" />
<attribute name="Build-Os" value="${os.name}" />
<attribute name="Revision" value="${build.revision}" />
<attribute name="Chronicle" value="${build.version}" />
<attribute name="Team-Name" value="${build.team}" />
<attribute name="Team-Site" value="${build.teamsite}" />
<attribute name="License-Type" value="${build.licensetype}" />
<attribute name="Core-Dev" value="${build.coredev}" />
<attribute name="Data-Dev" value="${build.datadev}" />
</manifest>
</jar>
</target>
<!--компилим loginserver-->
<target name="compile-loginserver" depends="commons-jar">
<delete dir="${build.classes}" />
<mkdir dir="${build.classes}" />
<javac srcdir="${src.loginserver}"
optimize="${optimize}"
debuglevel="${debuglevel}"
compiler="${compiler}"
destdir="${build.classes}"
debug="${debug}"
source="1.7"
target="1.7"
includeantruntime="false"
encoding="UTF-8"
nowarn="${nowarn}"
classpath="${build.classpath}:${build}/commons.jar">
<compilerarg value="-Xlint:unchecked,rawtypes,-serial" />
</javac>
</target>
<!--собираем loginserver в jar-->
<target name="loginserver-jar" depends="compile-loginserver">
<exec dir="${basedir}" executable="./lib_svn/svnversion" outputproperty="build.revision" failifexecutionfails="false">
<arg line="-n ${src.loginserver}" />
</exec>
<jar destfile="${build}/loginserver.jar" level="9">
<fileset dir="${build.classes}" />
<manifest>
<attribute name="Main-Class" value="l2p.loginserver.LoginServer" />
<attribute name="Class-Path" value="${jar.list} commons.jar" />
<attribute name="Build-By" value="${user.name}" />
<attribute name="Build-Date" value="${build.tstamp}" />
<attribute name="Revision" value="${build.revision}" />
<attribute name="Chronicle" value="${build.version}" />
<attribute name="Team-Name" value="${build.team}" />
<attribute name="Team-Site" value="${build.teamsite}" />
<attribute name="License-Type" value="${build.licensetype}" />
<attribute name="Core-Dev" value="${build.coredev}" />
<attribute name="Data-Dev" value="${build.datadev}" />
</manifest>
</jar>
</target>
<target name="loginserver" depends="loginserver-jar">
<mkdir dir="${build.dist}" />
<mkdir dir="${build.dist.loginserver}" />
<mkdir dir="${build.dist.loginserver}/log" />
<copy todir="${build.dist}/lib">
<fileset dir="${build}">
<include name="loginserver.jar" />
<include name="commons.jar" />
</fileset>
</copy>
<copy todir="${build.dist}/lib">
<fileset dir="${lib}">
<include name="*.jar" />
<exclude name="gameserver.jar" />
</fileset>
</copy>
<fixcrlf srcdir="${build.dist.loginserver}" eol="lf" eof="remove" includes="**/*.sh">
</fixcrlf>
<fixcrlf srcdir="${build.dist.loginserver}" eol="crlf" eof="remove" includes="**/*.bat">
</fixcrlf>
</target>
<target name="checkRequirements" description="Check Requirements.">
<echo message="Check ANT version" />
<fail message="Ant 1.9.1 is required. But your version is ${ant.version} and if you are using Eclipse probably is outdated.">
<condition>
<not>
<antversion atleast="1.9.1" />
</not>
</condition>
</fail>
<echo message="Check JDK version" />
<available classname="java.lang.AutoCloseable" property="JDK7.present" />
<fail unless="JDK7.present" message="Java 1.7 is required. But your version is Java ${ant.java.version} and probably JDK is not installed." />
</target>
<target name="dist" depends="loginserver, gameserver, scripts">
<echo message="Creating Zip archive"/>
<zip destfile="${build}/EmuRT-${build.version}_Rev.${build.revision}_by_${build.coredev}_Licence_${build.licensetype}.zip" basedir="${build.dist}" level="9" />
<echo message="Creating Zip archive done"/>
</target>
</project>