build.xml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <project name="launch4j" default="compile" basedir=".">
  2. <property name="src" location="src" />
  3. <property name="lib" location="lib" />
  4. <property name="build" location="build" />
  5. <property name="jar" location="./${ant.project.name}.jar" />
  6. <property name="launch4j.dir" location="." />
  7. <property name="maven" location="maven" />
  8. <property file="${src}/launch4j.properties"/>
  9. <path id="dist.classpath">
  10. <pathelement path="${build}" />
  11. <fileset dir="${lib}">
  12. <include name="**/*.jar" />
  13. </fileset>
  14. </path>
  15. <target name="init">
  16. <tstamp />
  17. <mkdir dir="${build}" />
  18. </target>
  19. <target name="compile" depends="init" description="compile the source">
  20. <javac srcdir="${src}" destdir="${build}" classpathref="dist.classpath" source="1.8" debug="on" includeantruntime="false" />
  21. <copy todir="${build}/images">
  22. <fileset dir="${src}/images">
  23. <include name="**/*" />
  24. </fileset>
  25. </copy>
  26. <copy todir="${build}">
  27. <fileset dir="${src}">
  28. <include name="**/*.properties" />
  29. </fileset>
  30. </copy>
  31. </target>
  32. <target name="jar" depends="compile" description="create jar">
  33. <fileset dir="${lib}" id="lib.dist.fileset">
  34. <include name="**/*.jar" />
  35. </fileset>
  36. <pathconvert pathsep=" " property="dist.classpath" refid="lib.dist.fileset">
  37. <map from="${lib}" to="./lib" />
  38. </pathconvert>
  39. <!-- Put everything in ${build} into a jar file -->
  40. <jar jarfile="${jar}">
  41. <fileset dir="${build}" excludes="**/messages_es.properties" />
  42. <manifest>
  43. <attribute name="Main-Class" value="net.sf.launch4j.Main" />
  44. <attribute name="Class-Path" value=". ${dist.classpath}" />
  45. </manifest>
  46. </jar>
  47. </target>
  48. <target name="demo" depends="jar" description="build the demos">
  49. <ant dir="./demo/ConsoleApp" inheritAll="false" />
  50. <ant dir="./demo/SimpleApp" inheritAll="false" />
  51. </target>
  52. <target name="clean" description="clean up">
  53. <delete dir="${build}" />
  54. <delete file="${jar}" />
  55. <ant dir="./demo/ConsoleApp" target="clean" inheritAll="false" />
  56. <ant dir="./demo/SimpleApp" target="clean" inheritAll="false" />
  57. </target>
  58. <target name="switch-to-maven" description="switch project to maven">
  59. <copy todir="." overwrite="true">
  60. <fileset dir="${maven}">
  61. <include name="**/*" />
  62. </fileset>
  63. </copy>
  64. <replace file="./pom.xml">
  65. <replacefilter token="$${launch4j.version}" value="${version}"/>
  66. </replace>
  67. <delete dir="${lib}" />
  68. <mkdir dir="./target" />
  69. </target>
  70. </project>