Mercurial > cgi-bin > hgweb.cgi > JpegWasher
comparison lib/mod/build_mod.xml @ 33:3d86f0391168
Work on improving the build system.
author | David Barts <davidb@stashtea.com> |
---|---|
date | Fri, 24 Apr 2020 19:45:57 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
32:c06edc56669b | 33:3d86f0391168 |
---|---|
1 <?xml version="1.0" encoding="UTF-8"?> | |
2 <project name="mod" default="help" basedir="."> | |
3 <!-- import all environment variables as env.* --> | |
4 <property environment="env"/> | |
5 | |
6 <!-- ensure required environment variables are set --> | |
7 <macrodef name="env-require"> | |
8 <attribute name="name"/> | |
9 <sequential> | |
10 <fail message="Environment variable @{name} not set!"> | |
11 <condition> | |
12 <not><isset property="env.@{name}"/></not> | |
13 </condition> | |
14 </fail> | |
15 </sequential> | |
16 </macrodef> | |
17 <env-require name="JRE_HOME"/> | |
18 | |
19 <!-- load launch4j (Windows app builder) --> | |
20 <!-- load m-o-d (Linux Gnome app builder) --> | |
21 | |
22 <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property --> | |
23 <scriptdef language="javascript" name="toLowerCase"> | |
24 <attribute name="value" /> | |
25 <attribute name="target" /> | |
26 <![CDATA[ | |
27 project.setProperty( attributes.get( "target" ), | |
28 attributes.get( "value" ).toLowerCase() ); | |
29 ]]> | |
30 </scriptdef> | |
31 | |
32 <!-- Define the properties used by the build --> | |
33 <property name="app.name" value="${ant.project.name}"/> | |
34 <toLowerCase target="lc.app.name" value="${app.name}"/> | |
35 <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/> | |
36 <property name="src.home" value="${basedir}/src"/> | |
37 <property name="work.home" value="${basedir}/work"/> | |
38 | |
39 <!-- help message --> | |
40 <target name="help"> | |
41 <echo>You can use the following targets:</echo> | |
42 <echo> </echo> | |
43 <echo> help : (default) Prints this message </echo> | |
44 <echo> clean : Deletes work directories</echo> | |
45 <echo> compile : Compiles source into class files</echo> | |
46 <echo> jar : Make JAR file.</echo> | |
47 <echo> </echo> | |
48 <echo>For example, to clean, compile, and package all at once, run:</echo> | |
49 <echo>prompt> ant -f build_mod.xml all </echo> | |
50 </target> | |
51 | |
52 <!-- do everything --> | |
53 <target name="all" depends="clean,jar" | |
54 description="Clean work dirs, compile, make JAR."/> | |
55 | |
56 <!-- clean old cruft out of our way --> | |
57 <target name="clean" | |
58 description="Delete old work and dist directories."> | |
59 <delete dir="${work.home}"/> | |
60 </target> | |
61 | |
62 <!-- make new dist and work trees --> | |
63 <target name="mkdirs" description="Create working dirs"> | |
64 <mkdir dir="${work.home}"/> | |
65 </target> | |
66 | |
67 <!-- compile *.java to *.class --> | |
68 <target name="compile" depends="mkdirs" | |
69 description="Compile Java sources to ${work.home}"> | |
70 <javac srcdir="${src.home}" destdir="${work.home}" debug="true" | |
71 includeAntRuntime="true"> | |
72 </javac> | |
73 </target> | |
74 | |
75 <!-- make .jar file --> | |
76 <target name="jar" depends="compile" description="Create JAR file."> | |
77 <jar destfile="${jar.name}"> | |
78 <fileset dir="${work.home}"/> | |
79 </jar> | |
80 </target> | |
81 | |
82 </project> |