build.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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}/gameserver" />
  26. <property name="build.dist.images" location="${build.dist}/images" />
  27. <property name="build.dist.languages" location="${build.dist}/languages" />
  28. <property name="build.dist.libs" location="${build.dist}/libs" />
  29. <property name="build.dist.login" location="${build.dist}/login" />
  30. <property name="build.dist.tools" location="${build.dist}/tools" />
  31. <path id="classpath">
  32. <fileset dir="${lib}">
  33. <include name="*.jar" />
  34. </fileset>
  35. </path>
  36. <pathconvert property="manifest.libs" pathsep=" ">
  37. <path refid="classpath" />
  38. <mapper>
  39. <chainedmapper>
  40. <flattenmapper />
  41. <globmapper from="*.jar" to="../libs/*.jar" />
  42. </chainedmapper>
  43. </mapper>
  44. </pathconvert>
  45. <target name="init" depends="clean, checkAntVersion, checkJavaVersion" description="Create the output directories.">
  46. <mkdir dir="${build}" />
  47. <mkdir dir="${build.classes}" />
  48. </target>
  49. <target name="compile" depends="version" description="Compile the source.">
  50. <javac destdir="${build.classes}" compiler="javac1.7" debug="true" debuglevel="lines,vars,source" includeantruntime="false" source="1.7" target="1.7">
  51. <src path="${src}" />
  52. <classpath refid="classpath" />
  53. </javac>
  54. </target>
  55. <target name="jar" depends="compile" description="Create the jar files">
  56. <jar destfile="${build.dist.login}/l2jlogin.jar">
  57. <fileset dir="${build.classes}">
  58. <exclude name="**/dbinstaller/**" />
  59. <exclude name="**/gameserver/**" />
  60. </fileset>
  61. <manifest>
  62. <attribute name="Class-Path" value="${manifest.libs}" />
  63. <attribute name="Built-By" value="${user.name}" />
  64. <attribute name="Built-Date" value="${build.tstamp}" />
  65. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  66. <attribute name="Implementation-Version" value="${l2j.revision}" />
  67. <attribute name="Main-Class" value="com.l2jserver.loginserver.L2LoginServer" />
  68. </manifest>
  69. </jar>
  70. <jar destfile="${build.dist.game}/l2jserver.jar">
  71. <fileset dir="${build.classes}">
  72. <exclude name="**/dbinstaller/**" />
  73. <exclude name="**/loginserver/**" />
  74. <exclude name="**/accountmanager/**" />
  75. <exclude name="**/gsregistering/**" />
  76. </fileset>
  77. <manifest>
  78. <attribute name="Class-Path" value="${manifest.libs}" />
  79. <attribute name="Built-By" value="${user.name}" />
  80. <attribute name="Built-Date" value="${build.tstamp}" />
  81. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  82. <attribute name="Implementation-Version" value="${l2j.revision}" />
  83. <attribute name="Main-Class" value="com.l2jserver.gameserver.GameServer" />
  84. </manifest>
  85. </jar>
  86. <!-- Tools -->
  87. <jar destfile="${build.dist.tools}/dbinst_cs.jar">
  88. <fileset dir="${build.classes}">
  89. <include name="**/dbinstaller/**" />
  90. <include name="**/images/**" />
  91. <include name="**/util/swing/**" />
  92. <exclude name="**/LauncherGS*" />
  93. <exclude name="**/LauncherLS*" />
  94. </fileset>
  95. <manifest>
  96. <attribute name="Class-Path" value="${manifest.libs}" />
  97. <attribute name="Built-By" value="${user.name}" />
  98. <attribute name="Built-Date" value="${build.tstamp}" />
  99. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  100. <attribute name="Implementation-Version" value="${l2j.revision}" />
  101. <attribute name="Main-Class" value="com.l2jserver.dbinstaller.LauncherCS" />
  102. </manifest>
  103. </jar>
  104. <jar destfile="${build.dist.tools}/dbinst_gs.jar">
  105. <fileset dir="${build.classes}">
  106. <include name="**/dbinstaller/**" />
  107. <include name="**/images/**" />
  108. <include name="**/util/swing/**" />
  109. <exclude name="**/LauncherCS*" />
  110. <exclude name="**/LauncherLS*" />
  111. </fileset>
  112. <manifest>
  113. <attribute name="Class-Path" value="${manifest.libs}" />
  114. <attribute name="Built-By" value="${user.name}" />
  115. <attribute name="Built-Date" value="${build.tstamp}" />
  116. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  117. <attribute name="Implementation-Version" value="${l2j.revision}" />
  118. <attribute name="Main-Class" value="com.l2jserver.dbinstaller.LauncherGS" />
  119. </manifest>
  120. </jar>
  121. <jar destfile="${build.dist.tools}/dbinst_ls.jar">
  122. <fileset dir="${build.classes}">
  123. <include name="**/dbinstaller/**" />
  124. <include name="**/images/**" />
  125. <include name="**/util/swing/**" />
  126. <exclude name="**/LauncherCS*" />
  127. <exclude name="**/LauncherGS*" />
  128. </fileset>
  129. <manifest>
  130. <attribute name="Class-Path" value="${manifest.libs}" />
  131. <attribute name="Built-By" value="${user.name}" />
  132. <attribute name="Built-Date" value="${build.tstamp}" />
  133. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  134. <attribute name="Implementation-Version" value="${l2j.revision}" />
  135. <attribute name="Main-Class" value="com.l2jserver.dbinstaller.LauncherLS" />
  136. </manifest>
  137. </jar>
  138. </target>
  139. <target name="jarsrc" depends="jar">
  140. <jar destfile="${build.dist.doc}/l2jserver-src.jar">
  141. <fileset dir="${src}">
  142. <exclude name="/config/**" />
  143. <exclude name="**.cfg" />
  144. </fileset>
  145. </jar>
  146. </target>
  147. <target name="dist" depends="jarsrc">
  148. <copy todir="${build.dist.doc}">
  149. <fileset dir="doc">
  150. <include name="*.html" />
  151. <include name="*.txt" />
  152. </fileset>
  153. </copy>
  154. <copy todir="${build.dist.game}">
  155. <fileset dir="dist">
  156. <include name="GameServer_loop.sh" />
  157. <include name="L2JConfig.*" />
  158. <include name="startGameServer.*" />
  159. </fileset>
  160. <fileset dir="${src}">
  161. <include name="console.cfg" />
  162. <include name="log.cfg" />
  163. </fileset>
  164. </copy>
  165. <copy todir="${build.dist.game}/config">
  166. <fileset dir="${src}/config">
  167. <include name="*.properties" />
  168. <include name="*.xml" />
  169. <include name="*.xsd" />
  170. <include name="*.txt" />
  171. <exclude name="loginserver.properties" />
  172. <exclude name="email.properties" />
  173. </fileset>
  174. </copy>
  175. <copy todir="${build.dist.game}/data">
  176. <fileset dir="data">
  177. <include name="*.csv" />
  178. <include name="*.txt" />
  179. </fileset>
  180. </copy>
  181. <copy todir="${build.dist.game}/data/geodata">
  182. <fileset dir="data/geodata">
  183. <include name="*.l2j" />
  184. <include name="*.txt" />
  185. </fileset>
  186. </copy>
  187. <copy todir="${build.dist.game}/data/pathnode">
  188. <fileset dir="data/pathnode">
  189. <include name="*.pn" />
  190. <include name="*.txt" />
  191. </fileset>
  192. </copy>
  193. <copy todir="${build.dist.images}">
  194. <fileset dir="images" />
  195. </copy>
  196. <copy todir="${build.dist.languages}">
  197. <fileset dir="languages" />
  198. </copy>
  199. <copy todir="${build.dist.libs}">
  200. <fileset dir="lib">
  201. <include name="*.jar" />
  202. </fileset>
  203. </copy>
  204. <copy todir="${build.dist.login}">
  205. <fileset dir="dist">
  206. <include name="GSRegister.exe" />
  207. <include name="L2JConfig.*" />
  208. <include name="LoginServer_loop.sh" />
  209. <include name="RegisterGameServer.*" />
  210. <include name="startLoginServer.*" />
  211. <include name="startSQLAccountManager.*" />
  212. </fileset>
  213. <fileset dir="${src}">
  214. <include name="banned_ip.cfg" />
  215. <include name="console.cfg" />
  216. <include name="log.cfg" />
  217. </fileset>
  218. </copy>
  219. <copy todir="${build.dist.login}/config">
  220. <fileset dir="${src}/config">
  221. <include name="email.properties" />
  222. <include name="loginserver.properties" />
  223. <include name="mmo.properties" />
  224. <include name="telnet.properties" />
  225. </fileset>
  226. </copy>
  227. <fixcrlf srcdir="${build.dist.game}" eol="crlf" eof="remove" includes="**/*.bat" />
  228. <fixcrlf srcdir="${build.dist.game}" eol="lf" eof="remove" includes="**/*.sh" />
  229. <fixcrlf srcdir="${build.dist.login}" eol="crlf" eof="remove" includes="**/*.bat" />
  230. <fixcrlf srcdir="${build.dist.login}" eol="lf" eof="remove" includes="**/*.sh" />
  231. <zip destfile="${build}/L2J_Server_BETA.zip" basedir="${build.dist}" />
  232. </target>
  233. <target name="clean" description="Remove the output directories">
  234. <delete dir="${build}" />
  235. </target>
  236. <target name="checkAntVersion" description="Check if Ant 1.8.2 is present">
  237. <fail message="Ant 1.8.2 is required. But your version is ${ant.version}">
  238. <condition>
  239. <not>
  240. <contains string="${ant.version}" substring="1.8.2" />
  241. </not>
  242. </condition>
  243. </fail>
  244. </target>
  245. <target name="checkJavaVersion" description="Checks if Java JDK 7 is present">
  246. <available classname="java.lang.AutoCloseable" property="JDK7.present" />
  247. <fail unless="JDK7.present" message="Java JDK 7 is required." />
  248. </target>
  249. <target name="version" depends="init" description="Create l2j-version.properties file">
  250. <tstamp>
  251. <format property="build.tstamp" pattern="yyyyMMdd_HHmm" />
  252. </tstamp>
  253. <exec dir="." executable="svnversion" outputproperty="l2j.revision">
  254. <arg line="-n ." />
  255. </exec>
  256. <concat destfile="${build.dist.game}/config/l2j-version.properties">
  257. version=${l2j.revision}
  258. builddate=${build.tstamp}
  259. detailed info:
  260. </concat>
  261. <concat destfile="${build.dist.game}/config/l2j-version.properties" append="true">
  262. <filelist dir="${src}/../.svn/" files="entries" />
  263. <filterchain>
  264. <prefixlines prefix=" " />
  265. <headfilter lines="8" skip="4" />
  266. <tokenfilter>
  267. <ignoreblank />
  268. </tokenfilter>
  269. </filterchain>
  270. </concat>
  271. </target>
  272. </project>