build.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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 destdir="${build.classes}" compiler="javac1.7" debug="true" debuglevel="lines,vars,source" includeantruntime="false" source="1.7" target="1.7">
  49. <src path="${src}" />
  50. <classpath refid="classpath" />
  51. </javac>
  52. </target>
  53. <target name="jar" depends="compile" description="Create the jar files">
  54. <jar destfile="${build.dist.login}/l2jlogin.jar">
  55. <fileset dir="${build.classes}">
  56. <exclude name="**/dbinstaller/**" />
  57. <exclude name="**/gameserver/**" />
  58. </fileset>
  59. <manifest>
  60. <attribute name="Built-By" value="${user.name}" />
  61. <attribute name="Built-Date" value="${build.tstamp}" />
  62. <attribute name="Class-Path" value="${manifest.libs}" />
  63. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  64. <attribute name="Implementation-Version" value="${l2j.version}" />
  65. <attribute name="Main-Class" value="com.l2jserver.loginserver.L2LoginServer" />
  66. </manifest>
  67. </jar>
  68. <jar destfile="${build.dist.game}/l2jserver.jar">
  69. <fileset dir="${build.classes}">
  70. <exclude name="**/dbinstaller/**" />
  71. <exclude name="**/loginserver/**" />
  72. <exclude name="**/accountmanager/**" />
  73. <exclude name="**/gsregistering/**" />
  74. </fileset>
  75. <manifest>
  76. <attribute name="Built-By" value="${user.name}" />
  77. <attribute name="Built-Date" value="${build.tstamp}" />
  78. <attribute name="Class-Path" value="${manifest.libs}" />
  79. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  80. <attribute name="Implementation-Version" value="${l2j.version}" />
  81. <attribute name="Main-Class" value="com.l2jserver.gameserver.GameServer" />
  82. </manifest>
  83. </jar>
  84. <jar destfile="${build.dist.tools}/dbinst_cs.jar">
  85. <fileset dir="${build.classes}">
  86. <include name="**/dbinstaller/**" />
  87. <include name="**/images/**" />
  88. <include name="**/util/swing/**" />
  89. <exclude name="**/LauncherGS*" />
  90. <exclude name="**/LauncherLS*" />
  91. </fileset>
  92. <manifest>
  93. <attribute name="Built-By" value="${user.name}" />
  94. <attribute name="Built-Date" value="${build.tstamp}" />
  95. <attribute name="Class-Path" value="${manifest.libs}" />
  96. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  97. <attribute name="Implementation-Version" value="${l2j.version}" />
  98. <attribute name="Main-Class" value="com.l2jserver.dbinstaller.LauncherCS" />
  99. </manifest>
  100. </jar>
  101. <jar destfile="${build.dist.tools}/dbinst_gs.jar">
  102. <fileset dir="${build.classes}">
  103. <include name="**/dbinstaller/**" />
  104. <include name="**/images/**" />
  105. <include name="**/util/swing/**" />
  106. <exclude name="**/LauncherCS*" />
  107. <exclude name="**/LauncherLS*" />
  108. </fileset>
  109. <manifest>
  110. <attribute name="Built-By" value="${user.name}" />
  111. <attribute name="Built-Date" value="${build.tstamp}" />
  112. <attribute name="Class-Path" value="${manifest.libs}" />
  113. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  114. <attribute name="Implementation-Version" value="${l2j.version}" />
  115. <attribute name="Main-Class" value="com.l2jserver.dbinstaller.LauncherGS" />
  116. </manifest>
  117. </jar>
  118. <jar destfile="${build.dist.tools}/dbinst_ls.jar">
  119. <fileset dir="${build.classes}">
  120. <include name="**/dbinstaller/**" />
  121. <include name="**/images/**" />
  122. <include name="**/util/swing/**" />
  123. <exclude name="**/LauncherCS*" />
  124. <exclude name="**/LauncherGS*" />
  125. </fileset>
  126. <manifest>
  127. <attribute name="Built-By" value="${user.name}" />
  128. <attribute name="Built-Date" value="${build.tstamp}" />
  129. <attribute name="Class-Path" value="${manifest.libs}" />
  130. <attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
  131. <attribute name="Implementation-Version" value="${l2j.version}" />
  132. <attribute name="Main-Class" value="com.l2jserver.dbinstaller.LauncherLS" />
  133. </manifest>
  134. </jar>
  135. </target>
  136. <target name="dist" depends="jar">
  137. <copy todir="${build.dist}">
  138. <fileset dir="dist" />
  139. </copy>
  140. <concat destfile="${build.dist.doc}/L2J_Server_CHANGELOG.txt">${l2j.changelog}</concat>
  141. <copy todir="${build.dist.game}">
  142. <fileset dir="misc" />
  143. </copy>
  144. <concat destfile="${build.dist.game}/config/l2j-version.properties">version=${l2j.version}${line.separator}builddate=${build.tstamp}</concat>
  145. <copy todir="${build.dist.libs}">
  146. <fileset dir="lib" />
  147. </copy>
  148. <copy todir="${build.dist.login}">
  149. <fileset dir="misc" />
  150. </copy>
  151. <fixcrlf srcdir="${build.dist.game}" eol="crlf" eof="remove" includes="**/*.bat" />
  152. <fixcrlf srcdir="${build.dist.game}" eol="lf" eof="remove" includes="**/*.sh" />
  153. <fixcrlf srcdir="${build.dist.login}" eol="crlf" eof="remove" includes="**/*.bat" />
  154. <fixcrlf srcdir="${build.dist.login}" eol="lf" eof="remove" includes="**/*.sh" />
  155. <zip destfile="${build}/L2J_Server_BETA.zip" basedir="${build.dist}" />
  156. </target>
  157. <target name="clean" description="Remove the output directories">
  158. <delete dir="${build}" />
  159. </target>
  160. <target name="checkRequirements" description="Check Requirements">
  161. <fail message="Ant 1.8.2 is required. But your version is ${ant.version}">
  162. <condition>
  163. <not>
  164. <antversion atleast="1.8.2" />
  165. </not>
  166. </condition>
  167. </fail>
  168. <available classname="java.lang.AutoCloseable" property="JDK7.present" />
  169. <fail unless="JDK7.present" message="Java 1.7 is required. But your version is Java ${ant.java.version} and probably JDK is not installed." />
  170. </target>
  171. <target name="getChangelogDateVersion" description="Get Changelog, Date, Version">
  172. <exec dir="." executable="svn" outputproperty="l2j.changelog">
  173. <arg value="log" />
  174. <arg value="--stop-on-copy" />
  175. </exec>
  176. <tstamp>
  177. <format property="build.tstamp" pattern="dd/MM/yyyy HH:mm" />
  178. </tstamp>
  179. <exec dir="." executable="svnversion" outputproperty="l2j.version" />
  180. </target>
  181. </project>