annotate build.xml @ 0:895aa9a8d628

Initial commit.
author David Barts <n5jrn@me.com>
date Sat, 08 Feb 2020 08:46:17 -0800
parents
children 2abd1acde716
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
1 <?xml version="1.0" encoding="UTF-8"?>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
2 <project name="Osdep" default="help" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
3 <!-- import all environment variables as env.* -->
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
4 <property environment="env"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
5
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
6 <!-- ensure required environment variables are set -->
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
7 <macrodef name="env-require">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
8 <attribute name="name"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
9 <sequential>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
10 <fail message="Environment variable @{name} not set!">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
11 <condition>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
12 <not><isset property="env.@{name}"/></not>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
13 </condition>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
14 </fail>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
15 </sequential>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
16 </macrodef>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
17 <env-require name="JRE_HOME"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
18 <env-require name="KOTLIN_HOME"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
19
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
20 <!-- define the kotlin task -->
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
21 <property name="kotlin.lib" value="${env.KOTLIN_HOME}/libexec/lib"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
22 <typedef resource="org/jetbrains/kotlin/ant/antlib.xml"
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
23 classpath="${kotlin.lib}/kotlin-ant.jar"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
24
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
25 <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property -->
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
26 <scriptdef language="javascript" name="toLowerCase">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
27 <attribute name="value" />
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
28 <attribute name="target" />
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
29 <![CDATA[
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
30 project.setProperty( attributes.get( "target" ),
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
31 attributes.get( "value" ).toLowerCase() );
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
32 ]]>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
33 </scriptdef>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
34
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
35 <!-- Define the properties used by the build -->
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
36 <property name="app.name" value="${ant.project.name}"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
37 <property name="app.entry" value="name.blackcap.osdep.OsdepKt"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
38 <toLowerCase target="lc.app.name" value="${app.name}"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
39 <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
40 <property name="work.jar" value="${basedir}/work.jar"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
41 <property name="lib.home" value="${basedir}/lib"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
42 <property name="src.home" value="${basedir}/src"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
43
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
44 <!-- help message -->
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
45 <target name="help">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
46 <echo>You can use the following targets:</echo>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
47 <echo> </echo>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
48 <echo> help : (default) Prints this message </echo>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
49 <echo> all : Cleans, compiles, and stages application</echo>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
50 <echo> clean : Deletes work directories</echo>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
51 <echo> compile : Compiles servlets into class files</echo>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
52 <echo> jar : Make JAR file.</echo>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
53 <echo> </echo>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
54 <echo>For example, to clean, compile, and package all at once, run:</echo>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
55 <echo>prompt> ant all </echo>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
56 </target>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
57
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
58 <!-- Define the CLASSPATH -->
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
59 <target name="classpath">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
60 <path id="std.classpath">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
61 <fileset dir="${lib.home}">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
62 <include name="*.jar"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
63 </fileset>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
64 </path>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
65 <path id="compile.classpath">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
66 <path refid="std.classpath"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
67 <pathelement location="${src.home}"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
68 </path>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
69 <path id="test.classpath">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
70 <path refid="std.classpath"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
71 <pathelement location="${work.home}"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
72 </path>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
73 </target>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
74
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
75 <!-- do everything but install -->
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
76 <target name="all" depends="jar"
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
77 description="Clean work dirs, compile, make JAR."/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
78
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
79 <!-- compile *.kt to *.class -->
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
80 <target name="compile" depends="classpath"
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
81 description="Compile Java sources to ${work.home}">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
82 <kotlinc src="${src.home}" output="${work.jar}"
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
83 classpathref="compile.classpath"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
84 </target>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
85
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
86 <!-- make .jar file -->
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
87 <target name="jar" depends="compile" description="Create JAR file.">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
88 <jar destfile="${jar.name}">
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
89 <manifest>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
90 <attribute name="Main-Class" value="${app.entry}"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
91 </manifest>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
92 <zipgroupfileset dir="${lib.home}" includes="*.jar"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
93 <zipfileset src="${work.jar}"/>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
94 </jar>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
95 </target>
895aa9a8d628 Initial commit.
David Barts <n5jrn@me.com>
parents:
diff changeset
96 </project>