Mercurial > cgi-bin > hgweb.cgi > Osdep
comparison build.xml @ 0:895aa9a8d628
Initial commit.
author | David Barts <n5jrn@me.com> |
---|---|
date | Sat, 08 Feb 2020 08:46:17 -0800 |
parents | |
children | 2abd1acde716 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:895aa9a8d628 |
---|---|
1 <?xml version="1.0" encoding="UTF-8"?> | |
2 <project name="Osdep" 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 <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property --> | |
26 <scriptdef language="javascript" name="toLowerCase"> | |
27 <attribute name="value" /> | |
28 <attribute name="target" /> | |
29 <![CDATA[ | |
30 project.setProperty( attributes.get( "target" ), | |
31 attributes.get( "value" ).toLowerCase() ); | |
32 ]]> | |
33 </scriptdef> | |
34 | |
35 <!-- Define the properties used by the build --> | |
36 <property name="app.name" value="${ant.project.name}"/> | |
37 <property name="app.entry" value="name.blackcap.osdep.OsdepKt"/> | |
38 <toLowerCase target="lc.app.name" value="${app.name}"/> | |
39 <property name="jar.name" value="${basedir}/${lc.app.name}.jar"/> | |
40 <property name="work.jar" value="${basedir}/work.jar"/> | |
41 <property name="lib.home" value="${basedir}/lib"/> | |
42 <property name="src.home" value="${basedir}/src"/> | |
43 | |
44 <!-- help message --> | |
45 <target name="help"> | |
46 <echo>You can use the following targets:</echo> | |
47 <echo> </echo> | |
48 <echo> help : (default) Prints this message </echo> | |
49 <echo> all : Cleans, compiles, and stages application</echo> | |
50 <echo> clean : Deletes work directories</echo> | |
51 <echo> compile : Compiles servlets into class files</echo> | |
52 <echo> jar : Make JAR file.</echo> | |
53 <echo> </echo> | |
54 <echo>For example, to clean, compile, and package all at once, run:</echo> | |
55 <echo>prompt> ant all </echo> | |
56 </target> | |
57 | |
58 <!-- Define the CLASSPATH --> | |
59 <target name="classpath"> | |
60 <path id="std.classpath"> | |
61 <fileset dir="${lib.home}"> | |
62 <include name="*.jar"/> | |
63 </fileset> | |
64 </path> | |
65 <path id="compile.classpath"> | |
66 <path refid="std.classpath"/> | |
67 <pathelement location="${src.home}"/> | |
68 </path> | |
69 <path id="test.classpath"> | |
70 <path refid="std.classpath"/> | |
71 <pathelement location="${work.home}"/> | |
72 </path> | |
73 </target> | |
74 | |
75 <!-- do everything but install --> | |
76 <target name="all" depends="jar" | |
77 description="Clean work dirs, compile, make JAR."/> | |
78 | |
79 <!-- compile *.kt to *.class --> | |
80 <target name="compile" depends="classpath" | |
81 description="Compile Java sources to ${work.home}"> | |
82 <kotlinc src="${src.home}" output="${work.jar}" | |
83 classpathref="compile.classpath"/> | |
84 </target> | |
85 | |
86 <!-- make .jar file --> | |
87 <target name="jar" depends="compile" description="Create JAR file."> | |
88 <jar destfile="${jar.name}"> | |
89 <manifest> | |
90 <attribute name="Main-Class" value="${app.entry}"/> | |
91 </manifest> | |
92 <zipgroupfileset dir="${lib.home}" includes="*.jar"/> | |
93 <zipfileset src="${work.jar}"/> | |
94 </jar> | |
95 </target> | |
96 </project> |