Mercurial > cgi-bin > hgweb.cgi > ClipMan
annotate build.xml @ 53:b1198e4bec25
app -> winapp
author | davidb |
---|---|
date | Thu, 16 Apr 2020 12:19:41 -0700 |
parents | e8d2a7e6f6c7 |
children | c6cccbe2f393 |
rev | line source |
---|---|
0
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
1 <?xml version="1.0" encoding="UTF-8"?> |
25 | 2 <project name="ClipMan" default="help" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant"> |
0
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
3 <!-- import all environment variables as env.* --> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
4 <property environment="env"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
5 |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
6 <!-- ensure required environment variables are set --> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
7 <macrodef name="env-require"> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
8 <attribute name="name"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
9 <sequential> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
10 <fail message="Environment variable @{name} not set!"> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
11 <condition> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
12 <not><isset property="env.@{name}"/></not> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
13 </condition> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
14 </fail> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
15 </sequential> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
16 </macrodef> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
17 <env-require name="JRE_HOME"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
18 <env-require name="KOTLIN_HOME"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
19 |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
20 <!-- define the kotlin task --> |
51 | 21 <property name="kotlin.lib" value="${env.KOTLIN_HOME}/lib"/> |
25 | 22 <typedef resource="org/jetbrains/kotlin/ant/antlib.xml" |
23 classpath="${kotlin.lib}/kotlin-ant.jar"/> | |
24 | |
25 <!-- define the package-building tasks --> | |
26 <taskdef resource="com/sun/javafx/tools/ant/antlib.xml" | |
27 uri="javafx:com.sun.javafx.tools.ant" | |
28 classpath="${env.JRE_HOME}/lib/ant-javafx.jar"/> | |
0
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
29 |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
30 <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property --> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
31 <scriptdef language="javascript" name="toLowerCase"> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
32 <attribute name="value" /> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
33 <attribute name="target" /> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
34 <![CDATA[ |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
35 project.setProperty( attributes.get( "target" ), |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
36 attributes.get( "value" ).toLowerCase() ); |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
37 ]]> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
38 </scriptdef> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
39 |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
40 <!-- Define the properties used by the build --> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
41 <property name="app.name" value="${ant.project.name}"/> |
22
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
42 <property name="app.entry" value="name.blackcap.clipman.MainKt"/> |
0
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
43 <toLowerCase target="lc.app.name" value="${app.name}"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
44 <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/> |
22
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
45 <property name="work.jar" value="${basedir}/work.jar"/> |
0
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
46 <property name="lib.home" value="${basedir}/lib"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
47 <property name="src.home" value="${basedir}/src"/> |
51 | 48 <property name="work.home" value="${basedir}/work"/> |
0
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
49 |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
50 <!-- help message --> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
51 <target name="help"> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
52 <echo>You can use the following targets:</echo> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
53 <echo> </echo> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
54 <echo> help : (default) Prints this message </echo> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
55 <echo> all : Cleans, compiles, and stages application</echo> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
56 <echo> clean : Deletes work directories</echo> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
57 <echo> compile : Compiles servlets into class files</echo> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
58 <echo> jar : Make JAR file.</echo> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
59 <echo> </echo> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
60 <echo>For example, to clean, compile, and package all at once, run:</echo> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
61 <echo>prompt> ant all </echo> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
62 </target> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
63 |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
64 <!-- Define the CLASSPATH --> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
65 <target name="classpath"> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
66 <path id="std.classpath"> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
67 <fileset dir="${lib.home}"> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
68 <include name="*.jar"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
69 </fileset> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
70 </path> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
71 <path id="compile.classpath"> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
72 <path refid="std.classpath"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
73 <pathelement location="${src.home}"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
74 </path> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
75 <path id="test.classpath"> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
76 <path refid="std.classpath"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
77 <pathelement location="${work.home}"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
78 </path> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
79 </target> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
80 |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
81 <!-- do everything but install --> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
82 <target name="all" depends="jar" |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
83 description="Clean work dirs, compile, make JAR."/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
84 |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
85 <!-- compile *.kt to *.class --> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
86 <target name="compile" depends="classpath" |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
87 description="Compile Java sources to ${work.home}"> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
88 <kotlinc src="${src.home}" output="${work.jar}" |
47
19d9da731c43
Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents:
42
diff
changeset
|
89 classpathref="compile.classpath"> |
19d9da731c43
Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents:
42
diff
changeset
|
90 <compilerarg line="-jvm-target 1.8"/> |
19d9da731c43
Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents:
42
diff
changeset
|
91 </kotlinc> |
0
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
92 </target> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
93 |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
94 <!-- make .jar file --> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
95 <target name="jar" depends="compile" description="Create JAR file."> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
96 <jar destfile="${jar.name}"> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
97 <manifest> |
22
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
98 <attribute name="Main-Class" value="${app.entry}"/> |
0
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
99 </manifest> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
100 <zipgroupfileset dir="${lib.home}" includes="*.jar"/> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
101 <zipfileset src="${work.jar}"/> |
42 | 102 <zipfileset dir="${src.home}" includes="**/*.properties"/> |
0
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
103 </jar> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
104 </target> |
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
105 |
22
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
106 <!-- for making bundled apps --> |
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
107 <macrodef name="bundle"> |
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
108 <attribute name="type"/> |
51 | 109 <element name="args" optional="true"/> |
22
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
110 <sequential> |
25 | 111 <fx:deploy nativeBundles="@{type}" outdir="${basedir}" outfile="${app.name}" |
112 signBundle="false"> | |
113 <fx:application mainClass="${app.entry}" name="${app.name}" toolkit="swing" | |
47
19d9da731c43
Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents:
42
diff
changeset
|
114 version="1.01"/> |
25 | 115 <fx:info description="ClipMan, a clipboard manager." title="${app.name}" |
27
8aa2dfac27eb
Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
25
diff
changeset
|
116 vendor="David Barts <n5jrn@me.com>" |
8aa2dfac27eb
Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
25
diff
changeset
|
117 copyright="© MMXX, David W. Barts"/> |
25 | 118 <fx:resources> |
119 <fx:fileset dir="${basedir}" includes="${lc.app.name}.jar"/> | |
120 </fx:resources> | |
121 <fx:bundleArgument arg="runtime" value="${env.JRE_HOME}"/> | |
23 | 122 <args/> |
25 | 123 </fx:deploy> |
124 </sequential> | |
22
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
125 </macrodef> |
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
126 |
25 | 127 <target name="macapp" depends="jar" description="Create MacOS app bundle."> |
128 <bundle type="image"> | |
23 | 129 <args> |
25 | 130 <fx:bundleArgument arg="jvmOptions" value="-Xdock:name=${app.name}"/> |
23 | 131 </args> |
132 </bundle> | |
22
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
133 </target> |
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
134 |
51 | 135 <target name="dummywork" description="dummy dir to make javapackager happy"> |
136 <mkdir dir="${work.home}"/> | |
137 <copy file="${jar.name}" tofile="${work.home}/${app.name}.jar"/> | |
138 </target> | |
139 | |
140 <!-- fx:deploy is broken on Windoze, must run javapackager command --> | |
53 | 141 <target name="winapp" depends="jar,dummywork" description="Create app bundle."> |
51 | 142 <exec executable="${env.JRE_HOME}/bin/javapackager"> |
143 <arg value="-deploy"/> | |
144 <arg value="-title"/> <arg value="${app.name}"/> | |
145 <arg value="-appclass"/> <arg value="${app.entry}"/> | |
146 <arg value="-native"/> <arg value="image"/> | |
147 <arg value="-name"/> <arg value="${app.name}"/> | |
148 <arg value="-outdir"/> <arg value="."/> | |
149 <arg value="-outfile"/> <arg value="${app.name}"/> | |
150 <arg value="-srcdir"/> <arg value="${work.home}"/> | |
151 </exec> | |
22
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
152 </target> |
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
153 |
25 | 154 <target name="rpm" depends="jar" description="Create RPM package."> |
22
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
155 <bundle type="rpm"/> |
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
156 </target> |
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
157 |
25 | 158 <target name="deb" depends="jar" description="Create Debian package."> |
22
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
159 <bundle type="deb"/> |
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
160 </target> |
829769cb1c13
Add some support for making bundled apps to build.xml.
David Barts <n5jrn@me.com>
parents:
0
diff
changeset
|
161 |
0
be282c48010a
Incomplete; checking it in as a backup.
David Barts <n5jrn@me.com>
parents:
diff
changeset
|
162 </project> |