Ant task: pass kotlin-runtime to javac's classpath; simplify tests

'kotlinCompiler' test is deleted because it's a very roundabout way to compile
Kotlin and Java sources, and there's no point in testing it.

'javacCompiler' test is deleted for similar reasons: using javac's "compiler"
option is not an advertised way to use Kotlin Ant task, and anyway it will work
with any CompilerAdapter instance, so it's hard to break it (apart from
deleting "withKotlin" adapter).

There are tests which check compilation/running of the same code but with the
recommended method. The pretext for deletion of these tests is to make Ant
tests generated, and that would be easier if they wouldn't depend on any outer
variables
This commit is contained in:
Alexander Udalov
2015-06-03 13:08:34 +03:00
parent 49c78602af
commit 89408f45bb
17 changed files with 43 additions and 201 deletions
@@ -1,17 +1,10 @@
<project name="Ant Task Test" default="build">
<path id="classpath">
<fileset dir="${idea.sdk}/lib" includes="annotations.jar"/>
<fileset dir="${kotlin.home}" includes="kotlin-runtime.jar"/>
</path>
<typedef name="withKotlin" classname="org.jetbrains.kotlin.ant.KotlinCompilerAdapter"/>
<taskdef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<delete dir="${temp}/classes" failonerror="false"/>
<mkdir dir="${temp}/classes"/>
<javac destdir="${temp}/classes" includeAntRuntime="false" srcdir="${test.data}/root1">
<classpath refid="classpath"/>
<withKotlin externalannotations="${test.data}/root1/b/">
<externalannotations path="${test.data}/root1/a/"/>
</withKotlin>
@@ -1,14 +0,0 @@
OUT:
Buildfile: [TestData]/build.xml
build:
[mkdir] Created dir: [Temp]/classes
[javac] Compiling 2 source files to [Temp]/classes
[javac] Compiling [[TestData]/root1] => [[Temp]/classes]
[javac] Running javac...
[jar] Building jar: [Temp]/hello.jar
BUILD SUCCESSFUL
Total time: [time]
Return code: 0
@@ -1,18 +0,0 @@
<project name="Ant Task Test" default="build">
<path id="classpath">
<fileset dir="${kotlin.home}" includes="kotlin-runtime.jar"/>
</path>
<target name="build">
<delete dir="${temp}/classes" failonerror="false"/>
<mkdir dir="${temp}/classes"/>
<javac destdir="${temp}/classes" includeantruntime="false" compiler="org.jetbrains.kotlin.ant.KotlinCompilerAdapter">
<src path="${test.data}/root1"/>
<classpath refid="classpath"/>
</javac>
<jar destfile="${temp}/hello.jar">
<fileset dir="${temp}/classes"/>
</jar>
</target>
</project>
@@ -1,5 +0,0 @@
OUT:
Hello, a!
Java
Return code: 0
@@ -1,7 +0,0 @@
package hello
fun main(args : Array<String>) {
for (s in arrayListOf("a"))
println("Hello, $s!")
j.Java().f();
}
@@ -1,14 +0,0 @@
package j;
import java.lang.String;
import java.lang.System;
public class Java {
public void f() {
System.out.println("Java");
}
public static void main(String[] args) {
hello.HelloPackage.main(new String[] {});
}
}
@@ -1,13 +0,0 @@
OUT:
Buildfile: [TestData]/build.xml
build:
[mkdir] Created dir: [Temp]/classes
[kotlinc] Compiling [[TestData]/root1] => [[Temp]/classes]
[javac] Compiling 1 source file to [Temp]/classes
[jar] Building jar: [Temp]/hello.jar
BUILD SUCCESSFUL
Total time: [time]
Return code: 0
@@ -1,24 +0,0 @@
<project name="Ant Task Test" default="build">
<path id="classpath">
<fileset dir="${idea.sdk}/lib" includes="annotations.jar"/>
<fileset dir="${kotlin.home}" includes="kotlin-runtime.jar"/>
</path>
<taskdef name="kotlinc" classname="org.jetbrains.kotlin.ant.Kotlin2JvmTask"/>
<target name="build">
<delete dir="${temp}/classes" failonerror="false"/>
<mkdir dir="${temp}/classes"/>
<kotlinc output="${temp}/classes" src="${test.data}/root1" externalannotations="${test.data}/root1/b/">
<classpath refid="classpath"/>
<externalannotations path="${test.data}/root1/a/"/>
</kotlinc>
<javac destdir="${temp}/classes" includeAntRuntime="false" srcdir="${test.data}/root1">
<classpath refid="classpath"/>
</javac>
<jar destfile="${temp}/hello.jar">
<fileset dir="${temp}/classes"/>
</jar>
</target>
</project>
@@ -1,5 +0,0 @@
OUT:
Hello, a!
Java Hello
Return code: 0
@@ -1,5 +0,0 @@
<root>
<item name='j.Java java.lang.String f()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
</root>
@@ -1,5 +0,0 @@
<root>
<item name='j.Java java.lang.String f2()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
</root>
@@ -1,9 +0,0 @@
package hello
fun main(args : Array<String>) {
for (s in arrayListOf("a"))
println("Hello, $s!")
val java: String = j.Java().f()
val hello: String = j.Java().f2()
println("$java $hello")
}
@@ -1,20 +0,0 @@
package j;
import org.jetbrains.annotations.NotNull;
import java.lang.String;
import java.lang.System;
public class Java {
public String f() {
return "Java";
}
public String f2() {
return "Hello";
}
public static void main(String[] args) {
hello.HelloPackage.main(new String[] {});
}
}