Mercurial > cgi-bin > hgweb.cgi > ClipMan
comparison build.xml @ 59:8b707fa0a4fc
Convert to new-style mac app.
author | David Barts <n5jrn@me.com> |
---|---|
date | Sun, 03 Apr 2022 15:37:42 -0700 |
parents | c6cccbe2f393 |
children | 066f05ebcc00 |
comparison
equal
deleted
inserted
replaced
58:88056f373a94 | 59:8b707fa0a4fc |
---|---|
28 classpath="${env.JRE_HOME}/lib/ant-javafx.jar"/> --> | 28 classpath="${env.JRE_HOME}/lib/ant-javafx.jar"/> --> |
29 | 29 |
30 <!-- Define the properties used by the build --> | 30 <!-- Define the properties used by the build --> |
31 <property name="app.name" value="${ant.project.name}"/> | 31 <property name="app.name" value="${ant.project.name}"/> |
32 <property name="app.entry" value="name.blackcap.clipman.MainKt"/> | 32 <property name="app.entry" value="name.blackcap.clipman.MainKt"/> |
33 <property name="app.version" value="1.10"/> | |
33 <property name="lc.app.name" value="clipman"/> | 34 <property name="lc.app.name" value="clipman"/> |
34 <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/> | 35 <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/> |
35 <property name="work.jar" value="${basedir}/work.jar"/> | 36 <property name="work.jar" value="${basedir}/work.jar"/> |
36 <property name="lib.home" value="${basedir}/lib"/> | 37 <property name="lib.home" value="${basedir}/lib"/> |
37 <property name="src.home" value="${basedir}/src"/> | 38 <property name="src.home" value="${basedir}/src"/> |
38 <property name="work.home" value="${basedir}/work"/> | 39 <property name="work.home" value="${basedir}/work"/> |
40 <property name="dist.home" value="${basedir}/dist"/> | |
41 <property name="pf.home" value="${basedir}/package-files"/> | |
42 <property name="jvm.version" value="1.8"/> | |
39 | 43 |
40 <!-- help message --> | 44 <!-- help message --> |
41 <target name="help"> | 45 <target name="help"> |
42 <echo>You can use the following targets:</echo> | 46 <echo>You can use the following targets:</echo> |
43 <echo> </echo> | 47 <echo> </echo> |
66 <path refid="std.classpath"/> | 70 <path refid="std.classpath"/> |
67 <pathelement location="${work.home}"/> | 71 <pathelement location="${work.home}"/> |
68 </path> | 72 </path> |
69 </target> | 73 </target> |
70 | 74 |
75 <!-- make needed directories --> | |
76 <target name="mkdirs"> | |
77 <mkdir dir="${dist.home}"/> | |
78 </target> | |
79 | |
80 <!-- remove old cruft --> | |
81 <target name="clean"> | |
82 <delete includeEmptyDirs="true" failonerror="false"> | |
83 <fileset dir="${dist.home}" includes="**/*"/> | |
84 </delete> | |
85 </target> | |
86 | |
71 <!-- do everything but install --> | 87 <!-- do everything but install --> |
72 <target name="all" depends="jar" | 88 <target name="all" depends="jar" |
73 description="Clean work dirs, compile, make JAR."/> | 89 description="Clean work dirs, compile, make JAR."/> |
74 | 90 |
75 <!-- compile *.kt to *.class --> | 91 <!-- compile *.kt to *.class --> |
76 <target name="compile" depends="classpath" | 92 <target name="compile" depends="classpath" |
77 description="Compile Java sources to ${work.home}"> | 93 description="Compile Java sources to ${work.home}"> |
78 <kotlinc src="${src.home}" output="${work.jar}" | 94 <kotlinc src="${src.home}" output="${work.jar}" |
79 noStdlib="false" includeRuntime="true" | 95 noStdlib="false" includeRuntime="true" |
80 classpathref="compile.classpath"> | 96 classpathref="compile.classpath"> |
81 <compilerarg line="-jvm-target 1.8"/> | 97 <compilerarg line="-jvm-target ${jvm.version}"/> |
82 </kotlinc> | 98 </kotlinc> |
83 </target> | 99 </target> |
84 | 100 |
85 <!-- make .jar file --> | 101 <!-- make .jar file --> |
86 <target name="jar" depends="compile" description="Create JAR file."> | 102 <target name="jar" depends="compile" description="Create JAR file."> |
113 <args/> | 129 <args/> |
114 </fx:deploy> | 130 </fx:deploy> |
115 </sequential> | 131 </sequential> |
116 </macrodef> | 132 </macrodef> |
117 | 133 |
118 <target name="macapp" depends="jar" description="Create MacOS app bundle."> | 134 <target name="macapp" depends="mkdirs,jar" description="Create MacOS app bundle."> |
119 <bundle type="image"> | 135 <fail message="Macintosh packages can only be built on a Mac."> |
120 <args> | 136 <condition> |
121 <fx:bundleArgument arg="jvmOptions" value="-Xdock:name=${app.name}"/> | 137 <not><os family="mac"/></not> |
122 </args> | 138 </condition> |
123 </bundle> | 139 </fail> |
140 <sequential> | |
141 <property name="mac.disk.image.filename" | |
142 value="${lc.app.name}_${app.version}.dmg"/> | |
143 <property name="app.bundle" value="${dist.home}/${app.name}.app"/> | |
144 <mkdir dir="${app.bundle}/Contents"/> | |
145 <copy todir="${app.bundle}/Contents" encoding="UTF-8" overwrite="true"> | |
146 <fileset file="${pf.home}/osx/Info.plist"/> | |
147 <!-- XXX will break if any tokens contain <, >, or & --> | |
148 <filterset> | |
149 <filter token="app.copyright" value="${app.copyright}"/> | |
150 <filter token="app.domain" value="${app.domain}"/> | |
151 <filter token="app.entry" value="${app.entry}"/> | |
152 <filter token="app.name" value="${app.name}"/> | |
153 <filter token="app.version" value="${app.version}"/> | |
154 <filter token="jar.filename" value="${lc.app.name}.jar"/> | |
155 <filter token="jvm.version" value="${jvm.version}"/> | |
156 <filter token="lc.app.name" value="${lc.app.name}"/> | |
157 </filterset> | |
158 </copy> | |
159 <mkdir dir="${app.bundle}/Contents/MacOS"/> | |
160 <copy todir="${app.bundle}/Contents/MacOS" encoding="UTF-8" | |
161 overwrite="true"> | |
162 <fileset file="${pf.home}/osx/JavaApplicationStub"/> | |
163 <filterset> | |
164 <filter token="app.domain" value="${app.domain}"/> | |
165 <filter token="app.name" value="${app.name}"/> | |
166 </filterset> | |
167 </copy> | |
168 <chmod file="${app.bundle}/Contents/MacOS/JavaApplicationStub" | |
169 perm="755"/> | |
170 <mkdir dir="${app.bundle}/Contents/Resources"/> | |
171 <copy file="${basedir}/${app.name}.icns" | |
172 todir="${app.bundle}/Contents/Resources"/> | |
173 <mkdir dir="${app.bundle}/Contents/Java"/> | |
174 <copy file="${jar.name}" todir="${app.bundle}/Contents/Java"/> | |
175 <echo file="${app.bundle}/Contents/PkgInfo" message="APPL????"/> | |
176 <exec executable="hdiutil" failonerror="true"> | |
177 <arg value="create"/> | |
178 <arg value="-volname"/> | |
179 <arg value="${app.name}"/> | |
180 <arg value="-srcfolder"/> | |
181 <arg file="${app.bundle}"/> | |
182 <arg file="${dist.home}/orig-${mac.disk.image.filename}"/> | |
183 </exec> | |
184 <exec executable="hdiutil" failonerror="true"> | |
185 <arg value="convert"/> | |
186 <arg file="${dist.home}/orig-${mac.disk.image.filename}"/> | |
187 <arg value="-format"/> | |
188 <arg value="UDRW"/> | |
189 <arg value="-o"/> | |
190 <arg file="${dist.home}/udrw-${mac.disk.image.filename}"/> | |
191 </exec> | |
192 <exec executable="hdiutil" failonerror="true"> | |
193 <arg value="convert"/> | |
194 <arg file="${dist.home}/udrw-${mac.disk.image.filename}"/> | |
195 <arg value="-format"/> | |
196 <arg value="UDZO"/> | |
197 <arg value="-imagekey"/> | |
198 <arg value="zlib-level=9"/> | |
199 <arg value="-o"/> | |
200 <arg file="${dist.home}/${mac.disk.image.filename}"/> | |
201 </exec> | |
202 </sequential> | |
124 </target> | 203 </target> |
125 | 204 |
126 <target name="dummywork" description="dummy dir to make javapackager happy"> | 205 <target name="dummywork" description="dummy dir to make javapackager happy"> |
127 <mkdir dir="${work.home}"/> | 206 <mkdir dir="${work.home}"/> |
128 <copy file="${jar.name}" tofile="${work.home}/${app.name}.jar"/> | 207 <copy file="${jar.name}" tofile="${work.home}/${app.name}.jar"/> |