Ant task - distribution zip is unpacked to ${kotlin-home} and used for all tests.
This commit is contained in:
+45
-30
@@ -1,6 +1,7 @@
|
|||||||
<project name="build-tools" default="buildToolsJar">
|
<project name="build-tools" default="buildToolsJar">
|
||||||
|
|
||||||
<property name="tests-dir" location="${output}/build-tools-test"/>
|
<property name="tests-dir" location="${output}/ant-test/build-tools-test"/>
|
||||||
|
<property name="kotlin-home" location="${output}/ant-test/kotlin-home"/>
|
||||||
|
|
||||||
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
||||||
<classpath>
|
<classpath>
|
||||||
@@ -8,18 +9,36 @@
|
|||||||
</classpath>
|
</classpath>
|
||||||
</taskdef>
|
</taskdef>
|
||||||
|
|
||||||
<path id="dist.jars">
|
|
||||||
<fileset dir="${idea.sdk}" includes="*.jar"/>
|
|
||||||
<fileset dir="${basedir}/lib" includes="*.jar"/>
|
|
||||||
<fileset dir="${output}" includes="*.jar"/>
|
|
||||||
</path>
|
|
||||||
|
|
||||||
<presetdef name="run-java">
|
<presetdef name="run-java">
|
||||||
<java classpathref = "dist.jars" failonerror = "true">
|
<java failonerror = "true">
|
||||||
<classpath path = "${tests-dir}"/>
|
<classpath>
|
||||||
|
<pathelement path = "${tests-dir}"/>
|
||||||
|
<fileset dir = "${kotlin-home}/lib" includes = "*.jar"/>
|
||||||
|
</classpath>
|
||||||
</java>
|
</java>
|
||||||
</presetdef>
|
</presetdef>
|
||||||
|
|
||||||
|
<!-- Re-creates ${kotlin-home} and defines <kotlin> task using its jars -->
|
||||||
|
<macrodef name="setup-kotlin-home">
|
||||||
|
<sequential>
|
||||||
|
|
||||||
|
<delete dir = "${kotlin-home}" failonerror="true"/>
|
||||||
|
<mkdir dir = "${kotlin-home}"/>
|
||||||
|
<unzip src = "${output}/${output.name}.zip"
|
||||||
|
dest = "${kotlin-home}"/>
|
||||||
|
<move todir = "${kotlin-home}">
|
||||||
|
<fileset dir = "${kotlin-home}/kotlinc"/>
|
||||||
|
</move>
|
||||||
|
<delete dir = "${kotlin-home}/kotlinc" failonerror="true"/>
|
||||||
|
|
||||||
|
<taskdef resource = "org/jetbrains/jet/buildtools/ant/antlib.xml">
|
||||||
|
<classpath>
|
||||||
|
<fileset dir = "${kotlin-home}/lib" includes = "*.jar"/>
|
||||||
|
</classpath>
|
||||||
|
</taskdef>
|
||||||
|
</sequential>
|
||||||
|
</macrodef>
|
||||||
|
|
||||||
|
|
||||||
<!-- Invokes <java> for compiled Hello class and verifies the output -->
|
<!-- Invokes <java> for compiled Hello class and verifies the output -->
|
||||||
<macrodef name="hello-java">
|
<macrodef name="hello-java">
|
||||||
@@ -28,8 +47,8 @@
|
|||||||
<attribute name="out"/>
|
<attribute name="out"/>
|
||||||
<sequential>
|
<sequential>
|
||||||
<var name = "java-out" unset = "true"/>
|
<var name = "java-out" unset = "true"/>
|
||||||
<run-java outputproperty = "java-out" classname = "namespace">
|
<run-java outputproperty = "java-out" classname = "namespace">
|
||||||
<arg line = "@{args}"/>
|
<arg line = "@{args}"/>
|
||||||
</run-java>
|
</run-java>
|
||||||
<if>
|
<if>
|
||||||
<equals arg1="${java-out}" arg2="@{out}"/>
|
<equals arg1="${java-out}" arg2="@{out}"/>
|
||||||
@@ -49,27 +68,21 @@
|
|||||||
<attribute name="args" default=""/>
|
<attribute name="args" default=""/>
|
||||||
<attribute name="out"/>
|
<attribute name="out"/>
|
||||||
<sequential>
|
<sequential>
|
||||||
<taskdef resource = "org/jetbrains/jet/buildtools/ant/antlib.xml"
|
<delete dir = "${tests-dir}" includes = "**/*"/>
|
||||||
classpathref = "dist.jars"/>
|
<kotlinc destdir = "${tests-dir}" file = "@{root}/Hello.kt"/>
|
||||||
|
<hello-java root = "@{root}" args = "@{args}" out = "@{out}"/>
|
||||||
|
|
||||||
<delete dir = "${tests-dir}" verbose = "false" includes = "**/*.class"/>
|
<delete dir = "${tests-dir}" includes = "**/*"/>
|
||||||
<kotlinc destdir = "${tests-dir}" file = "@{root}/Hello.kt" />
|
<kotlinc destdir = "${tests-dir}" srcdir = "@{root}"/>
|
||||||
<hello-java root = "@{root}" args = "@{args}" out = "@{out}"/>
|
<hello-java root = "@{root}" args = "@{args}" out = "@{out}"/>
|
||||||
|
|
||||||
<delete dir = "${tests-dir}" verbose = "false" includes = "**/*.class"/>
|
|
||||||
<kotlinc destdir = "${tests-dir}" srcdir = "@{root}" />
|
|
||||||
<hello-java root = "@{root}" args = "@{args}" out = "@{out}"/>
|
|
||||||
</sequential>
|
</sequential>
|
||||||
</macrodef>
|
</macrodef>
|
||||||
|
|
||||||
<!-- Compiles and runs with <java> web demo longer examples -->
|
<!-- Compiles and runs with <java> web demo longer examples -->
|
||||||
<macrodef name="longer-examples">
|
<macrodef name="longer-examples">
|
||||||
<sequential>
|
<sequential>
|
||||||
<taskdef resource = "org/jetbrains/jet/buildtools/ant/antlib.xml"
|
<delete dir = "${tests-dir}" includes = "**/*"/>
|
||||||
classpathref = "dist.jars"/>
|
<kotlinc destdir = "${tests-dir}" srcdir = "${basedir}/build-tools/test/longer-examples" />
|
||||||
|
|
||||||
<delete dir = "${tests-dir}" verbose = "false" includes="**/*.class"/>
|
|
||||||
<kotlinc destdir = "${tests-dir}" srcdir = "${basedir}/build-tools/test/longer-examples" />
|
|
||||||
|
|
||||||
<run-java classname = "bottles.namespace"/>
|
<run-java classname = "bottles.namespace"/>
|
||||||
<run-java classname = "maze.namespace"/>
|
<run-java classname = "maze.namespace"/>
|
||||||
@@ -91,18 +104,20 @@
|
|||||||
</dirset>
|
</dirset>
|
||||||
</src>
|
</src>
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="classpath.kotlin"/>
|
<path refid = "classpath.kotlin"/>
|
||||||
<fileset dir="${idea.sdk}/ant/lib" includes="*.jar"/>
|
<fileset dir = "${idea.sdk}/ant/lib" includes="*.jar"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
</javac>
|
</javac>
|
||||||
<jar destfile="${output}/kotlin-build-tools.jar">
|
<jar destfile="${output}/kotlin-build-tools.jar">
|
||||||
<fileset dir="${output}/classes/buildTools"/>
|
<fileset dir = "${output}/classes/buildTools"/>
|
||||||
<fileset dir="${basedir}/build-tools/ant/src" includes="**/*.xml"/>
|
<fileset dir = "${basedir}/build-tools/ant/src" includes="**/*.xml"/>
|
||||||
</jar>
|
</jar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Tests build tools distribution jar -->
|
<!-- Tests build tools distribution jar -->
|
||||||
<target name="buildToolsTest" depends="jarRT, jar, buildToolsJar">
|
<target name="buildToolsTest" depends="dist">
|
||||||
|
|
||||||
|
<setup-kotlin-home/>
|
||||||
|
|
||||||
<!-- Compiles every "Hello, World!" example and verifies the output of <java> run -->
|
<!-- Compiles every "Hello, World!" example and verifies the output of <java> run -->
|
||||||
<hello-test root="${basedir}/build-tools/test/hello/1" out="Hello, world!"/>
|
<hello-test root="${basedir}/build-tools/test/hello/1" out="Hello, world!"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user