Ant buildtools: added base class for Kotlin compiler ant tasks.

As side effect:
 - used cli compiler in both ant tasks.
 - got the ability to use custom args in JS ant task too.
This commit is contained in:
Zalim Bashorov
2014-08-16 19:34:40 +04:00
parent dc97cdb51c
commit d986b0e565
23 changed files with 283 additions and 434 deletions
@@ -0,0 +1,10 @@
OUT:
Buildfile: [TestData]/build.xml
build:
[kotlin2js] Compiling [[TestData]/hello.kt] => [[Temp]/out.js]
BUILD SUCCESSFUL
Total time: [time]
Return code: 0
@@ -0,0 +1,9 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/jet/buildtools/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<kotlin2js src="${test.data}/hello.kt" output="${temp}/out.js">
<compilerarg value="-Xno-inline"/>
</kotlin2js>
</target>
</project>
@@ -0,0 +1,13 @@
package foo
inline fun foo(f: () -> Unit) = f()
var ok = "Fail"
fun main(args : Array<String>) {
foo {
ok = "OK"
}
}
fun box(): String = ok
@@ -2,7 +2,7 @@ OUT:
Buildfile: [TestData]/build.xml
build:
[kotlinc] Compiling [[[TestData]/hello.kt]] => [[Temp]/hello.jar]
[kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
BUILD SUCCESSFUL
Total time: [time]
@@ -4,7 +4,7 @@ Buildfile: [TestData]/build.xml
build:
[mkdir] Created dir: [Temp]/classes
[javac] Compiling 1 source file to [Temp]/classes
[javac] Compiling [[[TestData]/root1]] => [[Temp]/classes]
[javac] Compiling [[TestData]/root1] => [[Temp]/classes]
[javac] Running javac...
[jar] Building jar: [Temp]/hello.jar
@@ -2,7 +2,7 @@ OUT:
Buildfile: [TestData]/build.xml
build:
[kotlinc] Compiling [[[TestData]/hello.kt]] => [[Temp]/hello.jar]
[kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
BUILD SUCCESSFUL
Total time: [time]
@@ -4,7 +4,7 @@ Buildfile: [TestData]/build.xml
build:
[mkdir] Created dir: [Temp]/classes
[javac] Compiling 1 source file to [Temp]/classes
[javac] Compiling [[[TestData]/root1]] => [[Temp]/classes]
[javac] Compiling [[TestData]/root1] => [[Temp]/classes]
[javac] Running javac...
[jar] Building jar: [Temp]/hello.jar
@@ -2,7 +2,7 @@ OUT:
Buildfile: [TestData]/build.xml
build:
[kotlinc] Compiling [[[TestData]/hello.kt]] => [[Temp]/hello.jar]
[kotlinc] Compiling [[TestData]/hello.kt] => [[Temp]/hello.jar]
[kotlinc] WARNING: [TestData]/hello.kt: (15, 9) Variable 'result' is never used
BUILD SUCCESSFUL
@@ -3,7 +3,7 @@ Buildfile: [TestData]/build.xml
build:
[mkdir] Created dir: [Temp]/classes
[kotlinc] Compiling [[[TestData]/root1]] => [[Temp]/classes]
[kotlinc] Compiling [[TestData]/root1] => [[Temp]/classes]
[javac] Compiling 1 source file to [Temp]/classes
[jar] Building jar: [Temp]/hello.jar
@@ -5,7 +5,7 @@
<fileset dir="${kotlin.home}" includes="kotlin-runtime.jar"/>
</path>
<taskdef name = "kotlinc" classname = "org.jetbrains.jet.buildtools.ant.BytecodeCompilerTask"/>
<taskdef name = "kotlinc" classname = "org.jetbrains.jet.buildtools.ant.Kotlin2JvmTask"/>
<target name="build">
<delete dir="${temp}/classes" failonerror="false"/>
@@ -2,7 +2,7 @@ OUT:
Buildfile: [TestData]/build.xml
build:
[kotlinc] Compiling [[[TestData]/root1, [TestData]/root2]] => [[Temp]/hello.jar]
[kotlinc] Compiling [[TestData]/root1, [TestData]/root2] => [[Temp]/hello.jar]
BUILD SUCCESSFUL
Total time: [time]
@@ -2,7 +2,6 @@ OUT:
Buildfile: [TestData]/build.xml
build:
[kotlinc] Compiling [[[TestData]/hello.kt]] => [[Temp]/hello.jar]
ERR: