comparison build.xml @ 0:db63d01a23c6

JNI calls and test case (finally!) seem to work.
author David Barts <n5jrn@me.com>
date Tue, 31 Mar 2020 13:24:48 -0700
parents
children dc1f4359659d
comparison
equal deleted inserted replaced
-1:000000000000 0:db63d01a23c6
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="ExifWasher" default="help" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
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 <env-require name="KOTLIN_HOME"/>
19
20 <!-- define the kotlin task -->
21 <property name="kotlin.lib" value="${env.KOTLIN_HOME}/libexec/lib"/>
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"/>
29
30 <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property -->
31 <scriptdef language="javascript" name="toLowerCase">
32 <attribute name="value" />
33 <attribute name="target" />
34 <![CDATA[
35 project.setProperty( attributes.get( "target" ),
36 attributes.get( "value" ).toLowerCase() );
37 ]]>
38 </scriptdef>
39
40 <!-- Define the properties used by the build -->
41 <property name="app.name" value="${ant.project.name}"/>
42 <property name="app.entry" value="name.blackcap.exifwasher.MainKt"/>
43 <toLowerCase target="lc.app.name" value="${app.name}"/>
44 <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/>
45 <property name="work.jar" value="${basedir}/work.jar"/>
46 <property name="lib.home" value="${basedir}/lib"/>
47 <property name="src.home" value="${basedir}/src"/>
48 <property name="nat.dir" value="${src.home}/name/blackcap/exifwasher/exiv2"/>
49 <property name="bin.dir" value="${src.home}/name/blackcap/exifwasher/binaries"/>
50
51 <!-- help message -->
52 <target name="help">
53 <echo>You can use the following targets:</echo>
54 <echo> </echo>
55 <echo> help : (default) Prints this message </echo>
56 <echo> all : Cleans, compiles, and stages application</echo>
57 <echo> clean : Deletes work directories</echo>
58 <echo> compile : Compiles servlets into class files</echo>
59 <echo> jar : Make JAR file.</echo>
60 <echo> </echo>
61 <echo>For example, to clean, compile, and package all at once, run:</echo>
62 <echo>prompt> ant all </echo>
63 </target>
64
65 <!-- Define the CLASSPATH -->
66 <target name="classpath">
67 <path id="std.classpath">
68 <fileset dir="${lib.home}">
69 <include name="*.jar"/>
70 </fileset>
71 </path>
72 <path id="compile.classpath">
73 <path refid="std.classpath"/>
74 <pathelement location="${src.home}"/>
75 </path>
76 <path id="test.classpath">
77 <path refid="std.classpath"/>
78 <pathelement location="${work.home}"/>
79 </path>
80 </target>
81
82 <!-- do everything but install -->
83 <target name="all" depends="jar"
84 description="Clean work dirs, compile, make JAR."/>
85
86 <!-- compile *.kt to *.class -->
87 <target name="compile" depends="classpath"
88 description="Compile Java sources to ${work.home}">
89 <kotlinc src="${src.home}" output="${work.jar}"
90 classpathref="compile.classpath"/>
91 </target>
92
93 <!-- make .jar file -->
94 <target name="jar" depends="compile" description="Create JAR file.">
95 <jar destfile="${jar.name}">
96 <manifest>
97 <attribute name="Main-Class" value="${app.entry}"/>
98 </manifest>
99 <zipgroupfileset dir="${lib.home}" includes="*.jar"/>
100 <zipfileset src="${work.jar}"/>
101 <zipfileset dir="${src.home}" includes="**/*.properties,**/*.dll,**/*.so,**/*.dylib"/>
102 </jar>
103 </target>
104
105 <!-- for making bundled apps -->
106 <macrodef name="bundle">
107 <attribute name="type"/>
108 <element name="args"/>
109 <sequential>
110 <fx:deploy nativeBundles="@{type}" outdir="${basedir}" outfile="${app.name}"
111 signBundle="false">
112 <fx:application mainClass="${app.entry}" name="${app.name}" toolkit="swing"
113 version="1.0"/>
114 <fx:info description="ExifWasher" title="${app.name}"
115 vendor="David Barts &lt;n5jrn@me.com&gt;"
116 copyright="© MMXX, David W. Barts"/>
117 <fx:resources>
118 <fx:fileset dir="${basedir}" includes="${lc.app.name}.jar"/>
119 </fx:resources>
120 <fx:bundleArgument arg="runtime" value="${env.JRE_HOME}"/>
121 <args/>
122 </fx:deploy>
123 </sequential>
124 </macrodef>
125
126 <target name="macapp" depends="jar" description="Create MacOS app bundle.">
127 <bundle type="image">
128 <args>
129 <fx:bundleArgument arg="jvmOptions" value="-Xdock:name=${app.name}"/>
130 </args>
131 </bundle>
132 </target>
133
134 <target name="app" depends="jar" description="Create app bundle.">
135 <bundle type="image"/>
136 </target>
137
138 <target name="rpm" depends="jar" description="Create RPM package.">
139 <bundle type="rpm"/>
140 </target>
141
142 <target name="deb" depends="jar" description="Create Debian package.">
143 <bundle type="deb"/>
144 </target>
145
146 </project>