build.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="L2J_Server_BETA" default="dist" basedir=".">
  3. <description>
  4. This script will build the L2J Server.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  16. 02111-1307, USA.
  17. http://www.gnu.org/copyleft/gpl.html
  18. </description>
  19. <property name="src" location="java" />
  20. <property name="lib" location="lib" />
  21. <property name="build" location="build" />
  22. <property name="build.classes" location="${build}/classes" />
  23. <property name="build.dist" location="${build}/dist" />
  24. <property name="build.dist.doc" location="${build.dist}/doc" />
  25. <property name="build.dist.game" location="${build.dist}/game" />
  26. <property name="build.dist.libs" location="${build.dist}/libs" />
  27. <property name="build.dist.login" location="${build.dist}/login" />
  28. <property name="build.dist.tools" location="${build.dist}/tools" />
  29. <path id="classpath">
  30. <fileset dir="${lib}">
  31. <include name="*.jar" />
  32. </fileset>
  33. </path>
  34. <pathconvert property="manifest.libs" pathsep=" ">
  35. <path refid="classpath" />
  36. <mapper>
  37. <chainedmapper>
  38. <flattenmapper />
  39. <globmapper from="*.jar" to="../libs/*.jar" />
  40. </chainedmapper>
  41. </mapper>
  42. </pathconvert>
  43. <target name="init" depends="clean,checkRequirements,getChangelogDateVersion" description="Create the output directories.">
  44. <mkdir dir="${build}" />
  45. <mkdir dir="${build.classes}" />
  46. </target>
  47. <target name="compile" depends="init" description="Compile the source.">
  48. <javac srcdir="${src}" classpathref="classpath" destdir="${build.classes}" compiler="javac1.7" debug="true" debuglevel="lines,vars,source" includeantruntime="false" source="1.7" target="1.7" />
  49. </target>
  50. <target name="jar" depends="compile" description="Create the jar files">
  51. <jar destfile="${build.dist.login}/l2jlogin.jar">
  52. <fileset dir="${build.classes}">
  53. <exclude name="**/dbinstaller/**" />
  54. <exclude name="**/gameserver/**" />
  55. </fileset>
  56. <manifest>
  57. <attribute name="Built-By" value="${user.name}" />
  58. <attribute name="Built-Date" value="${build.tstamp}" />
  59. <attribute name="Class-Path" value="${manifest.libs}" />
  60. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  61. <attribute name="Implementation-Version" value="${l2j.version}" />
  62. <attribute name="Main-Class" value="com.l2jserver.loginserver.L2LoginServer" />
  63. </manifest>
  64. </jar>
  65. <jar destfile="${build.dist.game}/l2jserver.jar">
  66. <fileset dir="${build.classes}">
  67. <exclude name="**/dbinstaller/**" />
  68. <exclude name="**/loginserver/**" />
  69. <exclude name="**/accountmanager/**" />
  70. <exclude name="**/gsregistering/**" />
  71. </fileset>
  72. <manifest>
  73. <attribute name="Built-By" value="${user.name}" />
  74. <attribute name="Built-Date" value="${build.tstamp}" />
  75. <attribute name="Class-Path" value="${manifest.libs}" />
  76. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  77. <attribute name="Implementation-Version" value="${l2j.version}" />
  78. <attribute name="Main-Class" value="com.l2jserver.gameserver.GameServer" />
  79. </manifest>
  80. </jar>
  81. <jar destfile="${build.dist.tools}/dbinst_cs.jar">
  82. <fileset dir="${build.classes}">
  83. <include name="**/dbinstaller/**" />
  84. <include name="**/images/**" />
  85. <include name="**/util/swing/**" />
  86. <exclude name="**/LauncherGS*" />
  87. <exclude name="**/LauncherLS*" />
  88. </fileset>
  89. <manifest>
  90. <attribute name="Built-By" value="${user.name}" />
  91. <attribute name="Built-Date" value="${build.tstamp}" />
  92. <attribute name="Class-Path" value="${manifest.libs}" />
  93. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  94. <attribute name="Implementation-Version" value="${l2j.version}" />
  95. <attribute name="Main-Class" value="com.l2jserver.tools.dbinstaller.LauncherCS" />
  96. </manifest>
  97. </jar>
  98. <jar destfile="${build.dist.tools}/dbinst_gs.jar">
  99. <fileset dir="${build.classes}">
  100. <include name="**/dbinstaller/**" />
  101. <include name="**/images/**" />
  102. <include name="**/util/swing/**" />
  103. <exclude name="**/LauncherCS*" />
  104. <exclude name="**/LauncherLS*" />
  105. </fileset>
  106. <manifest>
  107. <attribute name="Built-By" value="${user.name}" />
  108. <attribute name="Built-Date" value="${build.tstamp}" />
  109. <attribute name="Class-Path" value="${manifest.libs}" />
  110. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  111. <attribute name="Implementation-Version" value="${l2j.version}" />
  112. <attribute name="Main-Class" value="com.l2jserver.tools.dbinstaller.LauncherGS" />
  113. </manifest>
  114. </jar>
  115. <jar destfile="${build.dist.tools}/dbinst_ls.jar">
  116. <fileset dir="${build.classes}">
  117. <include name="**/dbinstaller/**" />
  118. <include name="**/images/**" />
  119. <include name="**/util/swing/**" />
  120. <exclude name="**/LauncherCS*" />
  121. <exclude name="**/LauncherGS*" />
  122. </fileset>
  123. <manifest>
  124. <attribute name="Built-By" value="${user.name}" />
  125. <attribute name="Built-Date" value="${build.tstamp}" />
  126. <attribute name="Class-Path" value="${manifest.libs}" />
  127. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  128. <attribute name="Implementation-Version" value="${l2j.version}" />
  129. <attribute name="Main-Class" value="com.l2jserver.tools.dbinstaller.LauncherLS" />
  130. </manifest>
  131. </jar>
  132. </target>
  133. <target name="dist" depends="jar">
  134. <copy todir="${build.dist}">
  135. <fileset dir="dist" />
  136. </copy>
  137. <concat destfile="${build.dist.doc}/L2J_Server_CHANGELOG.txt">${l2j.changelog}</concat>
  138. <copy todir="${build.dist.game}">
  139. <fileset dir="misc" />
  140. </copy>
  141. <concat destfile="${build.dist.game}/config/l2j-version.properties">version=${l2j.version}${line.separator}builddate=${build.tstamp}</concat>
  142. <copy todir="${build.dist.libs}">
  143. <fileset dir="lib" />
  144. </copy>
  145. <copy todir="${build.dist.login}">
  146. <fileset dir="misc" />
  147. </copy>
  148. <fixcrlf srcdir="${build.dist.game}" eol="crlf" eof="remove" includes="**/*.bat" />
  149. <fixcrlf srcdir="${build.dist.game}" eol="lf" eof="remove" includes="**/*.sh" />
  150. <fixcrlf srcdir="${build.dist.login}" eol="crlf" eof="remove" includes="**/*.bat" />
  151. <fixcrlf srcdir="${build.dist.login}" eol="lf" eof="remove" includes="**/*.sh" />
  152. <zip destfile="${build}/L2J_Server_BETA.zip" basedir="${build.dist}" />
  153. </target>
  154. <target name="clean" description="Remove the output directories">
  155. <delete dir="${build}" />
  156. </target>
  157. <target name="checkRequirements" description="Check Requirements">
  158. <fail message="Ant 1.8.2 is required. But your version is ${ant.version}">
  159. <condition>
  160. <not>
  161. <antversion atleast="1.8.2" />
  162. </not>
  163. </condition>
  164. </fail>
  165. <available classname="java.lang.AutoCloseable" property="JDK7.present" />
  166. <fail unless="JDK7.present" message="Java 1.7 is required. But your version is Java ${ant.java.version} and probably JDK is not installed." />
  167. </target>
  168. <target name="getChangelogDateVersion" description="Get Changelog, Date, Version">
  169. <exec dir="." executable="svn" outputproperty="l2j.changelog">
  170. <arg value="log" />
  171. <arg value="--stop-on-copy" />
  172. </exec>
  173. <tstamp>
  174. <format property="build.tstamp" pattern="dd/MM/yyyy HH:mm" />
  175. </tstamp>
  176. <exec dir="." executable="svnversion" outputproperty="l2j.version" />
  177. </target>
  178. </project>