95 lines
3.9 KiB
XML
95 lines
3.9 KiB
XML
<project name="build-tools" default="buildToolsJar">
|
|
|
|
<property name="tests-dir" location="${output}/build-tools-test"/>
|
|
|
|
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
|
<classpath>
|
|
<pathelement location="${basedir}/build-tools/lib/ant-contrib-1.0b3.jar"/>
|
|
</classpath>
|
|
</taskdef>
|
|
|
|
<path id="sourcepath.buildTools">
|
|
<dirset dir="${basedir}/build-tools">
|
|
<include name="core/src"/>
|
|
<include name="ant/src"/>
|
|
<include name="maven/src"/>
|
|
<include name="gradle/src"/>
|
|
</dirset>
|
|
</path>
|
|
|
|
<path id="classpath.buildTools">
|
|
<path refid="classpath.kotlin"/>
|
|
<fileset dir="${idea.sdk}/ant/lib" includes="*.jar"/>
|
|
</path>
|
|
|
|
<path id="dist.jars">
|
|
<fileset dir="${idea.sdk}" includes="*.jar"/>
|
|
<fileset dir="${basedir}/lib" includes="*.jar"/>
|
|
<fileset dir="${output}" includes="*.jar"/>
|
|
</path>
|
|
|
|
<target name="buildToolsJar" depends="compile">
|
|
<mkdir dir ="${output}/classes/buildTools"/>
|
|
<javac destdir="${output}/classes/buildTools" debug="true" debuglevel="lines,vars,source">
|
|
<src refid="sourcepath.buildTools"/>
|
|
<classpath refid="classpath.buildTools"/>
|
|
</javac>
|
|
<jar destfile="${output}/kotlin-build-tools.jar">
|
|
<fileset dir="${output}/classes/buildTools"/>
|
|
<fileset dir="${basedir}/build-tools/ant/src" includes="**/*.xml"/>
|
|
</jar>
|
|
</target>
|
|
|
|
<macrodef name="hello-java">
|
|
<attribute name="root"/>
|
|
<attribute name="args" default=""/>
|
|
<attribute name="out"/>
|
|
<sequential>
|
|
<var name = "java-out"
|
|
unset = "true"/>
|
|
<java classpathref = "dist.jars"
|
|
classname = "namespace"
|
|
failonerror = "true"
|
|
outputproperty = "java-out">
|
|
<classpath path = "${tests-dir}"/>
|
|
<arg line = "@{args}"/>
|
|
</java>
|
|
<if>
|
|
<equals arg1="${java-out}" arg2="@{out}"/>
|
|
<then>
|
|
<echo>${java-out}</echo>
|
|
</then>
|
|
<else>
|
|
<fail message="[@{root}] 'Hello' test failed: '${java-out}' (received) != '@{out}' (expected)"/>
|
|
</else>
|
|
</if>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<macrodef name="hello-test">
|
|
<attribute name="root"/>
|
|
<attribute name="args" default=""/>
|
|
<attribute name="out"/>
|
|
<sequential>
|
|
<taskdef resource = "org/jetbrains/jet/buildtools/ant/antlib.xml"
|
|
classpathref = "dist.jars"/>
|
|
|
|
<delete dir = "${tests-dir}" verbose = "false" includes="**/*.class"/>
|
|
<kotlinc file = "@{root}/Hello.kt" destdir = "${tests-dir}"/>
|
|
<hello-java root = "@{root}" args = "@{args}" out = "@{out}"/>
|
|
|
|
<delete dir = "${tests-dir}" verbose = "false" includes="**/*.class"/>
|
|
<kotlinc srcdir = "@{root}" destdir = "${tests-dir}"/>
|
|
<hello-java root = "@{root}" args = "@{args}" out = "@{out}"/>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<target name="buildToolsTest" depends="jarRT, jar, buildToolsJar">
|
|
<hello-test root="${basedir}/build-tools/test/hello/1" out="Hello, world!"/>
|
|
<hello-test root="${basedir}/build-tools/test/hello/2" args="Kotlin-Developer" out="Hello, Kotlin-Developer!"/>
|
|
<hello-test root="${basedir}/build-tools/test/hello/3" args="Mickey-Mouse" out="Hello, Mickey-Mouse!"/>
|
|
<hello-test root="${basedir}/build-tools/test/hello/4" args="IT" out="Ciao!"/>
|
|
<hello-test root="${basedir}/build-tools/test/hello/5" args="Donald-Duck" out="Hello, Donald-Duck!"/>
|
|
</target>
|
|
</project>
|