Fix withKotlin Ant task when no classpath is given
#KT-6492 Fixed
This commit is contained in:
@@ -42,7 +42,12 @@ public class KotlinCompilerAdapter extends DefaultCompilerAdapter {
|
||||
|
||||
Kotlin2JvmTask kotlinTask = new Kotlin2JvmTask();
|
||||
kotlinTask.setOutput(javac.getDestdir());
|
||||
kotlinTask.setClasspath(javac.getClasspath());
|
||||
|
||||
Path classpath = javac.getClasspath();
|
||||
if (classpath != null) {
|
||||
kotlinTask.setClasspath(classpath);
|
||||
}
|
||||
|
||||
kotlinTask.setSrc(javac.getSrcdir());
|
||||
kotlinTask.setExternalAnnotations(externalAnnotations);
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package hello;
|
||||
|
||||
public class J {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
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
|
||||
|
||||
BUILD SUCCESSFUL
|
||||
Total time: [time]
|
||||
|
||||
Return code: 0
|
||||
@@ -0,0 +1,13 @@
|
||||
<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>
|
||||
</target>
|
||||
</project>
|
||||
@@ -0,0 +1,5 @@
|
||||
package hello
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
println("Hello!")
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
OUT:
|
||||
Hello!
|
||||
|
||||
Return code: 0
|
||||
@@ -96,6 +96,11 @@ public class AntTaskJvmTest extends AntTaskBaseTest {
|
||||
doJvmAntTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noClasspathGiven() throws Exception {
|
||||
doJvmAntTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javacCompiler() throws Exception {
|
||||
doJvmAntTest("-cp", getClassPathForAnt(),
|
||||
|
||||
Reference in New Issue
Block a user