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