29
|
1 <?xml version="1.0" encoding="UTF-8"?>
|
|
2 <project name="ImagePrep" 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="ANT_HOME"/>
|
|
18 <env-require name="JRE_HOME"/>
|
|
19 <env-require name="KOTLIN_HOME"/>
|
|
20
|
|
21 <!-- define the kotlin task -->
|
|
22 <property name="kotlin.lib" value="${env.KOTLIN_HOME}/lib"/>
|
|
23 <typedef resource="org/jetbrains/kotlin/ant/antlib.xml"
|
|
24 classpath="${kotlin.lib}/kotlin-ant.jar"/>
|
|
25
|
|
26 <!-- help message -->
|
|
27 <target name="help">
|
|
28 <echo>You can use the following targets:</echo>
|
|
29 <echo> </echo>
|
|
30 <echo> help : (default) Prints this message </echo>
|
|
31 <echo> jar : Make JAR file.</echo>
|
|
32 <echo> </echo>
|
|
33 </target>
|
|
34
|
|
35 <!-- compile *.kt to *.class -->
|
|
36 <property name="jar.name" value="antlib.jar"/>
|
|
37 <target name="jar"
|
|
38 description="Compile sources to ${jar.name}.">
|
|
39 <kotlinc src="." output="${jar.name}"
|
|
40 noStdlib="false" includeRuntime="true">
|
|
41 <compilerarg line="-jvm-target 1.8"/>
|
|
42 <classpath>
|
|
43 <fileset dir="${env.ANT_HOME}/lib">
|
|
44 <include name="*.jar"/>
|
|
45 </fileset>
|
|
46 </classpath>
|
|
47 </kotlinc>
|
|
48 </target>
|
|
49
|
|
50
|
|
51 </project>
|