Support default module name for withKotlin ant task

This commit is contained in:
Michael Bogdanov
2015-09-08 14:01:09 +03:00
parent 7c16fb8a89
commit a52281f52a
8 changed files with 66 additions and 9 deletions
@@ -0,0 +1,15 @@
OUT:
Buildfile: [TestData]/build.xml
build:
[mkdir] Created dir: [Temp]/classes
[javac] Compiling 1 source file to [Temp]/classes
[javac] Compiling [[TestData]] => [[Temp]/classes]
[javac] Running javac...
[jar] Building jar: [Temp]/hello.jar
[java] Module info 'META-INF/build.kotlin_module' exists
BUILD SUCCESSFUL
Total time: [time]
Return code: 0
@@ -0,0 +1,20 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<mkdir dir="${temp}/classes"/>
<javac srcdir="${test.data}" destdir="${temp}/classes" includeantruntime="false">
<withKotlin/>
</javac>
<jar destfile="${temp}/hello.jar">
<fileset dir="${temp}/classes"/>
</jar>
<java classname="hello.HelloPackage" fork="true">
<classpath>
<pathelement location="${temp}/hello.jar"/>
<pathelement location="${kotlin.runtime.jar}"/>
</classpath>
</java>
</target>
</project>
@@ -0,0 +1,11 @@
package hello
fun main(args: Array<String>) {
val systemClassLoader = ClassLoader.getSystemClassLoader()
val moduleFile = "META-INF/build.kotlin_module"
val resourceAsStream = systemClassLoader.getResourceAsStream(moduleFile)
if (resourceAsStream != null) {
println("Module info '$moduleFile' exists")
}
}