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