annotate build.xml @ 28:c310ec097194

Add Linux support.
author David Barts <n5jrn@me.com>
date Fri, 25 Dec 2020 19:07:47 -0800
parents 9bf3d8de6904
children e90d290a9a8d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
1 <?xml version="1.0" encoding="UTF-8"?>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
2 <project name="ImagePrep" default="help" basedir=".">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
3 <!-- import all environment variables as env.* -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
4 <property environment="env"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
5
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
6 <!-- ensure required environment variables are set -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
7 <macrodef name="env-require">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
8 <attribute name="name"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
9 <sequential>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
10 <fail message="Environment variable @{name} not set!">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
11 <condition>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
12 <not><isset property="env.@{name}"/></not>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
13 </condition>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
14 </fail>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
15 </sequential>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
16 </macrodef>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
17 <env-require name="JRE_HOME"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
18 <env-require name="KOTLIN_HOME"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
19 <env-require name="OSDEP_HOME"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
20
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
21 <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
22 <scriptdef language="javascript" name="toLowerCase">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
23 <attribute name="value" />
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
24 <attribute name="target" />
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
25 <![CDATA[
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
26 "use strict";
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
27 project.setProperty( attributes.get( "target" ),
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
28 attributes.get( "value" ).toLowerCase() );
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
29 ]]>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
30 </scriptdef>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
31
28
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
32 <!-- estimate disk usage -->
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
33 <scriptdef language="javascript" name="du">
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
34 <attribute name="path" />
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
35 <attribute name="target" />
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
36 <![CDATA[
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
37 "use strict";
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
38 var File = Java.type('java.io.File');
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
39 function du(fp) {
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
40 if (fp.isDirectory()) {
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
41 var files = fp.listFiles();
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
42 if (!files) return 0;
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
43 var total = 0;
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
44 for (var i=0; i<files.length; i++)
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
45 total += du(files[i]);
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
46 return total;
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
47 } else {
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
48 return fp.length();
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
49 }
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
50 }
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
51 var path = new File(attributes.get("path"));
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
52 project.setProperty(attributes.get("target"),
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
53 Math.round(du(path) / 1024) + "");
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
54 ]]>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
55 </scriptdef>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
56
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
57 <!-- Define the properties used by the build -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
58 <property name="app.name" value="${ant.project.name}"/>
2
a6f9b51d5e8d Got jar building.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
59 <toLowerCase target="lc.app.name" value="${app.name}"/>
26
9bf3d8de6904 Fix Preferences bug, bump version number.
David Barts <n5jrn@me.com>
parents: 23
diff changeset
60 <property name="app.version" value="1.01"/>
2
a6f9b51d5e8d Got jar building.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
61 <property name="app.domain" value="name.blackcap.${lc.app.name}"/>
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
62 <property name="app.entry" value="${app.domain}.MainKt"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
63 <property name="app.copyright" value="Copyright © 2020, David W. Barts."/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
64 <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
65 <property name="work.jar" value="${basedir}/work.jar"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
66 <property name="lib.home" value="${basedir}/lib"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
67 <property name="src.home" value="${basedir}/src"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
68 <property name="dist.home" value="${basedir}/dist"/>
23
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
69 <property name="pf.home" value="${basedir}/package-files"/>
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
70 <property name="jvm.version" value="1.8"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
71
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
72 <!-- define the kotlin task -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
73 <property name="kotlin.lib" value="${env.KOTLIN_HOME}/lib"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
74 <typedef resource="org/jetbrains/kotlin/ant/antlib.xml"
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
75 classpath="${kotlin.lib}/kotlin-ant.jar"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
76
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
77 <!-- help message -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
78 <target name="help">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
79 <echo>You can use the following targets:</echo>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
80 <echo> </echo>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
81 <echo> help : (default) Prints this message </echo>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
82 <echo> all : Cleans, compiles, and stages application</echo>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
83 <echo> clean : Deletes work directories</echo>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
84 <echo> compile : Compiles servlets into class files</echo>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
85 <echo> jar : Make JAR file.</echo>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
86 <echo> </echo>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
87 <echo>For example, to clean, compile, and package all at once, run:</echo>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
88 <echo>prompt> ant all </echo>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
89 </target>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
90
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
91 <!-- Define the CLASSPATH -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
92 <target name="classpath">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
93 <path id="compile.classpath">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
94 <pathelement location="${src.home}"/>
4
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 2
diff changeset
95 <fileset dir="${lib.home}">
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 2
diff changeset
96 <include name="*.jar"/>
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 2
diff changeset
97 </fileset>
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
98 </path>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
99 </target>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
100
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
101 <!-- make needed directories -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
102 <target name="mkdirs">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
103 <mkdir dir="${dist.home}"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
104 </target>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
105
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
106 <!-- remove old cruft -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
107 <target name="clean">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
108 <delete includeEmptyDirs="true" failonerror="false">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
109 <fileset dir="${dist.home}" includes="**/*"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
110 </delete>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
111 </target>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
112
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
113 <!-- rename files containing OS-dependant code -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
114 <target name="osdep">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
115 <exec executable="${env.JRE_HOME}/bin/java" failonerror="true">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
116 <arg value="-jar"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
117 <arg file="${env.OSDEP_HOME}/osdep.jar"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
118 <arg value="${src.home}"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
119 </exec>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
120 </target>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
121
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
122 <!-- do everything but install -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
123 <target name="all" depends="jar"
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
124 description="Clean work dirs, compile, make JAR."/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
125
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
126 <!-- compile *.kt to *.class -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
127 <target name="compile" depends="mkdirs,osdep,classpath"
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
128 description="Compile Java sources to ${work.home}">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
129 <kotlinc src="${src.home}" output="${work.jar}"
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
130 classpathref="compile.classpath">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
131 <compilerarg line="-jvm-target ${jvm.version}"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
132 </kotlinc>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
133 </target>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
134
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
135 <!-- make .jar file -->
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
136 <target name="jar" depends="compile" description="Create JAR file.">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
137 <jar destfile="${jar.name}">
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
138 <manifest>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
139 <attribute name="Main-Class" value="${app.entry}"/>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
140 </manifest>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
141 <!-- <zipgroupfileset dir="${lib.home}" includes="*.jar"/> -->
4
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 2
diff changeset
142 <zipgroupfileset dir="${lib.home}" includes="*.jar"/>
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
143 <zipfileset src="${work.jar}"/>
2
a6f9b51d5e8d Got jar building.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
144 <zipfileset dir="${src.home}" includes="**/*.properties,**/*.html"/>
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
145 </jar>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
146 </target>
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
147
23
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
148 <target name="macapp" depends="jar" description="Create MacOS app bundle.">
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
149 <fail message="Macintosh packages can only be built on a Mac.">
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
150 <condition>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
151 <not><os family="mac"/></not>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
152 </condition>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
153 </fail>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
154 <sequential>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
155 <property name="mac.disk.image.filename"
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
156 value="${lc.app.name}_${app.version}.dmg"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
157 <property name="app.bundle" value="${dist.home}/${app.name}.app"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
158 <mkdir dir="${app.bundle}/Contents"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
159 <copy todir="${app.bundle}/Contents" encoding="UTF-8" overwrite="true">
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
160 <fileset file="${pf.home}/osx/Info.plist"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
161 <!-- XXX will break if any tokens contain <, >, or & -->
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
162 <filterset>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
163 <filter token="app.copyright" value="${app.copyright}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
164 <filter token="app.domain" value="${app.domain}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
165 <filter token="app.entry" value="${app.entry}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
166 <filter token="app.name" value="${app.name}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
167 <filter token="app.version" value="${app.version}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
168 <filter token="jar.filename" value="${lc.app.name}.jar"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
169 <filter token="jvm.version" value="${jvm.version}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
170 <filter token="lc.app.name" value="${lc.app.name}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
171 </filterset>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
172 </copy>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
173 <mkdir dir="${app.bundle}/Contents/MacOS"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
174 <copy todir="${app.bundle}/Contents/MacOS" encoding="UTF-8"
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
175 overwrite="true">
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
176 <fileset file="${pf.home}/osx/JavaApplicationStub"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
177 <filterset>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
178 <filter token="app.domain" value="${app.domain}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
179 <filter token="app.name" value="${app.name}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
180 </filterset>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
181 </copy>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
182 <chmod file="${app.bundle}/Contents/MacOS/JavaApplicationStub"
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
183 perm="755"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
184 <mkdir dir="${app.bundle}/Contents/Resources"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
185 <copy file="${basedir}/${app.name}.icns"
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
186 todir="${app.bundle}/Contents/Resources"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
187 <mkdir dir="${app.bundle}/Contents/Java"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
188 <copy file="${jar.name}" todir="${app.bundle}/Contents/Java"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
189 <echo file="${app.bundle}/Contents/PkgInfo" message="APPL????"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
190 <exec executable="hdiutil" failonerror="true">
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
191 <arg value="create"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
192 <arg value="-volname"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
193 <arg value="${app.name}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
194 <arg value="-srcfolder"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
195 <arg file="${app.bundle}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
196 <arg file="${dist.home}/orig-${mac.disk.image.filename}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
197 </exec>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
198 <exec executable="hdiutil" failonerror="true">
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
199 <arg value="convert"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
200 <arg file="${dist.home}/orig-${mac.disk.image.filename}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
201 <arg value="-format"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
202 <arg value="UDRW"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
203 <arg value="-o"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
204 <arg file="${dist.home}/udrw-${mac.disk.image.filename}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
205 </exec>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
206 <exec executable="hdiutil" failonerror="true">
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
207 <arg value="convert"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
208 <arg file="${dist.home}/udrw-${mac.disk.image.filename}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
209 <arg value="-format"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
210 <arg value="UDZO"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
211 <arg value="-imagekey"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
212 <arg value="zlib-level=9"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
213 <arg value="-o"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
214 <arg file="${dist.home}/${mac.disk.image.filename}"/>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
215 </exec>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
216 </sequential>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
217 </target>
92afaa27f40a Mac app support.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
218
28
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
219 <target name="deb" depends="jar" description="Create Debian package.">
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
220 <fail message="Linux packages can only be built on Linux.">
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
221 <condition>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
222 <not><os family="unix"/></not>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
223 </condition>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
224 </fail>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
225 <sequential>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
226 <mkdir dir="${dist.home}/data/usr/share/applications"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
227 <copy file="${pf.home}/linux/deb/imageprep.desktop"
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
228 tofile="${dist.home}/data/usr/share/applications/imageprep.desktop"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
229 <mkdir dir="${dist.home}/data/usr/share/icons/hicolor/48x48/apps"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
230 <copy file="${pf.home}/linux/icon_48x48.png"
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
231 tofile="${dist.home}/data/usr/share/icons/hicolor/48x48/apps/imageprep.png"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
232 <mkdir dir="${dist.home}/data/usr/share/imageprep"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
233 <copy file="${jar.name}" todir="${dist.home}/data/usr/share/imageprep"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
234 <mkdir dir="${dist.home}/data/usr/share/doc/imageprep"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
235 <copy todir="${dist.home}/data/usr/share/doc/imageprep">
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
236 <filelist dir="${basedir}" files="Readme.html,Readme.rst"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
237 </copy>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
238 <copy todir="${dist.home}/data/usr/share/doc/imageprep" encoding="UTF-8" overwrite="true">
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
239 <fileset file="${pf.home}/linux/deb/copyright"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
240 <filterset>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
241 <filter token="app.copyright" value="${app.copyright}"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
242 </filterset>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
243 </copy>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
244 <gzip src="${pf.home}/linux/deb/changelog"
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
245 destfile="${dist.home}/data/usr/share/doc/imageprep/changelog.gz"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
246 <mkdir dir="${dist.home}/data/usr/share/man/man1"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
247 <gzip src="${pf.home}/linux/imageprep.1"
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
248 destfile="${dist.home}/data/usr/share/man/man1/imageprep.1.gz"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
249 <mkdir dir="${dist.home}/data/usr/bin"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
250 <copy todir="${dist.home}/data/usr/bin" encoding="UTF-8" overwrite="true">
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
251 <fileset file="${pf.home}/linux/imageprep"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
252 <filterset>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
253 <filter token="jar.filename" value="${lc.app.name}.jar"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
254 </filterset>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
255 </copy>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
256 <chmod file="${dist.home}/data/usr/bin/imageprep" perm="755"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
257 <du path="${dist.home}/data" target="deb.installed.size"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
258 <mkdir dir="${dist.home}/control"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
259 <copy todir="${dist.home}/control" encoding="UTF-8" overwrite="true">
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
260 <fileset file="${pf.home}/linux/deb/control"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
261 <filterset>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
262 <filter token="app.version" value="${app.version}"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
263 <filter token="deb.installed.size" value="${deb.installed.size}"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
264 </filterset>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
265 </copy>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
266 <copy todir="${dist.home}/control">
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
267 <filelist dir="${pf.home}/linux/deb" files="postinst,postrm"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
268 </copy>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
269 <chmod perm="755">
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
270 <filelist dir="${dist.home}/control" files="postinst,postrm"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
271 </chmod>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
272 <exec executable="${basedir}/make-debian-package" failonerror="true">
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
273 <arg value="${dist.home}"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
274 <arg value="${lc.app.name}_${app.version}.deb"/>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
275 </exec>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
276 </sequential>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
277 </target>
c310ec097194 Add Linux support.
David Barts <n5jrn@me.com>
parents: 26
diff changeset
278
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
279 </project>