Add externalAnnotations ant test and ant-1.8
This commit is contained in:
@@ -28,7 +28,7 @@ import static junit.framework.Assert.assertEquals;
|
||||
public class AntTaskTest extends KotlinIntegrationTestBase {
|
||||
private void doAntTest(String... extraJavaArgs) throws Exception {
|
||||
String jar = tmpdir.getTmpDir().getAbsolutePath() + File.separator + "hello.jar";
|
||||
String runtime = new File("dist/kotlinc/lib/kotlin-runtime.jar").getAbsolutePath();
|
||||
String runtime = getKotlinRuntimePath();
|
||||
|
||||
assertEquals("compilation failed", 0, runAnt("build.log", "build.xml", extraJavaArgs));
|
||||
runJava("hello.run", "-cp", jar + File.pathSeparator + runtime, "hello.HelloPackage");
|
||||
@@ -46,7 +46,22 @@ public class AntTaskTest extends KotlinIntegrationTestBase {
|
||||
|
||||
@Test
|
||||
public void javacCompiler() throws Exception {
|
||||
doAntTest("-cp", getCompilerLib() + "/kotlin-ant.jar");
|
||||
doAntTest("-cp", getKotlinAntPath(),
|
||||
"-Dkotlin.home", getCompilerLib().getAbsolutePath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void externalAnnotations() throws Exception {
|
||||
doAntTest("-cp", getKotlinAntPath(),
|
||||
"-Didea.sdk", getIdeaSdkHome(),
|
||||
"-Dkotlin.home", getCompilerLib().getAbsolutePath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void kotlinCompiler() throws Exception {
|
||||
doAntTest("-cp", getKotlinAntPath(),
|
||||
"-Didea.sdk", getIdeaSdkHome(),
|
||||
"-Dkotlin.home", getCompilerLib().getAbsolutePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,7 +84,15 @@ public class AntTaskTest extends KotlinIntegrationTestBase {
|
||||
return runJava(logName, strings.toArray(new String[strings.size()]));
|
||||
}
|
||||
|
||||
private static String getKotlinAntPath() {
|
||||
return getCompilerLib() + File.separator + "kotlin-ant.jar";
|
||||
}
|
||||
|
||||
private static String getIdeaSdkHome() {
|
||||
return getKotlinProjectHome().getAbsolutePath() + File.separator + "ideaSDK";
|
||||
}
|
||||
|
||||
private static String getAntHome() {
|
||||
return getKotlinProjectHome().getAbsolutePath() + File.separator + "dependencies" + File.separator + "ant-1.7";
|
||||
return getKotlinProjectHome().getAbsolutePath() + File.separator + "dependencies" + File.separator + "ant-1.8";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
OUT Buildfile: build.xml
|
||||
OUT Buildfile: [TestData]/build.xml
|
||||
OUT
|
||||
OUT build:
|
||||
OUT [kotlinc] Compiling [[[TestData]/hello.kt]] => [[Temp]/hello.jar]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
OUT Buildfile: build.xml
|
||||
OUT Buildfile: [TestData]/build.xml
|
||||
OUT
|
||||
OUT build:
|
||||
OUT [kotlinc] Compiling [[[TestData]/root1, [TestData]/root2]] => [[Temp]/hello.jar]
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
OUT Buildfile: [TestData]/build.xml
|
||||
OUT
|
||||
OUT build:
|
||||
OUT [mkdir] Created dir: [Temp]/classes
|
||||
OUT [javac] Compiling 1 source file to [Temp]/classes
|
||||
OUT [javac] Compiling [[[TestData]/root1]] => [[Temp]/classes]
|
||||
OUT [javac] Running javac...
|
||||
OUT [jar] Building jar: [Temp]/hello.jar
|
||||
OUT
|
||||
OUT BUILD SUCCESSFUL
|
||||
OUT Total time: [time]
|
||||
Return code: 0
|
||||
@@ -0,0 +1,23 @@
|
||||
<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.jet.buildtools.ant.KotlinCompilerAdapter"/>
|
||||
|
||||
<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>
|
||||
</javac>
|
||||
<jar destfile="${temp}/hello.jar">
|
||||
<fileset dir="${temp}/classes"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
@@ -0,0 +1,3 @@
|
||||
OUT Hello, a!
|
||||
OUT Java Hello
|
||||
Return code: 0
|
||||
@@ -0,0 +1,5 @@
|
||||
<root>
|
||||
<item name='j.Java java.lang.String f()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
@@ -0,0 +1,5 @@
|
||||
<root>
|
||||
<item name='j.Java java.lang.String f2()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
@@ -0,0 +1,9 @@
|
||||
package hello
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
for (s in arrayList("a"))
|
||||
println("Hello, $s!")
|
||||
val java: String = j.Java().f()
|
||||
val hello: String = j.Java().f2()
|
||||
println("$java $hello")
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
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[] {});
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
OUT Buildfile: build.xml
|
||||
OUT Buildfile: [TestData]/build.xml
|
||||
OUT
|
||||
OUT build:
|
||||
OUT [mkdir] Created dir: [Temp]/classes
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
<project name="Ant Task Test" default="build">
|
||||
|
||||
<target name="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" compiler="org.jetbrains.jet.buildtools.ant.KotlinCompilerAdapter">
|
||||
<javac destdir="${temp}/classes" includeantruntime="false" compiler="org.jetbrains.jet.buildtools.ant.KotlinCompilerAdapter">
|
||||
<src path="${test.data}/root1"/>
|
||||
<classpath refid="classpath"/>
|
||||
</javac>
|
||||
<jar destfile="${temp}/hello.jar">
|
||||
<fileset dir="${temp}/classes"/>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
OUT Buildfile: [TestData]/build.xml
|
||||
OUT
|
||||
OUT build:
|
||||
OUT [mkdir] Created dir: [Temp]/classes
|
||||
OUT [kotlinc] Compiling [[[TestData]/root1]] => [[Temp]/classes]
|
||||
OUT [javac] Compiling 1 source file to [Temp]/classes
|
||||
OUT [jar] Building jar: [Temp]/hello.jar
|
||||
OUT
|
||||
OUT BUILD SUCCESSFUL
|
||||
OUT Total time: [time]
|
||||
Return code: 0
|
||||
@@ -0,0 +1,24 @@
|
||||
<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.jet.buildtools.ant.BytecodeCompilerTask"/>
|
||||
|
||||
<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>
|
||||
@@ -0,0 +1,3 @@
|
||||
OUT Hello, a!
|
||||
OUT Java Hello
|
||||
Return code: 0
|
||||
@@ -0,0 +1,5 @@
|
||||
<root>
|
||||
<item name='j.Java java.lang.String f()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
@@ -0,0 +1,5 @@
|
||||
<root>
|
||||
<item name='j.Java java.lang.String f2()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
@@ -0,0 +1,9 @@
|
||||
package hello
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
for (s in arrayList("a"))
|
||||
println("Hello, $s!")
|
||||
val java: String = j.Java().f()
|
||||
val hello: String = j.Java().f2()
|
||||
println("$java $hello")
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
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[] {});
|
||||
}
|
||||
}
|
||||
+19
-10
@@ -89,6 +89,22 @@
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="get-ant-library">
|
||||
<attribute name="version"/>
|
||||
<attribute name="folderName"/>
|
||||
<sequential>
|
||||
<get src="http://archive.apache.org/dist/ant/binaries/apache-ant-@{version}-bin.tar.gz"
|
||||
dest="dependencies/download/apache-ant-@{version}-bin.tar.gz" usetimestamp="true"/>
|
||||
|
||||
<get src="http://archive.apache.org/dist/ant/source/apache-ant-@{version}-src.zip"
|
||||
dest="dependencies/apache-ant-@{version}-src.zip" usetimestamp="true"/>
|
||||
|
||||
<delete dir="dependencies/@{folderName}" failonerror="false"/>
|
||||
<untar src="dependencies/download/apache-ant-@{version}-bin.tar.gz" dest="dependencies" compression="gzip"/>
|
||||
<move file="dependencies/apache-ant-@{version}" tofile="dependencies/@{folderName}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="fetch-third-party">
|
||||
<mkdir dir="dependencies"/>
|
||||
<mkdir dir="dependencies/download"/>
|
||||
@@ -121,16 +137,9 @@
|
||||
<get src="http://jarjar.googlecode.com/files/jarjar-1.2.jar" dest="dependencies/download/jarjar-1.2.jar" usetimestamp="true"/>
|
||||
<copy file="dependencies/download/jarjar-1.2.jar" tofile="dependencies/jarjar.jar" overwrite="true"/>
|
||||
|
||||
<!-- ant 1.7.0 -->
|
||||
<get src="http://archive.apache.org/dist/ant/binaries/apache-ant-1.7.0-bin.tar.gz"
|
||||
dest="dependencies/download/apache-ant-1.7.0-bin.tar.gz" usetimestamp="true"/>
|
||||
|
||||
<get src="http://archive.apache.org/dist/ant/source/apache-ant-1.7.0-src.zip"
|
||||
dest="dependencies/apache-ant-1.7.0-src.zip" usetimestamp="true"/>
|
||||
|
||||
<delete dir="dependencies/ant-1.7" failonerror="false"/>
|
||||
<untar src="dependencies/download/apache-ant-1.7.0-bin.tar.gz" dest="dependencies" compression="gzip"/>
|
||||
<move file="dependencies/apache-ant-1.7.0" tofile="dependencies/ant-1.7"/>
|
||||
<!-- ant 1.7.0, 1.8.0 -->
|
||||
<get-ant-library version="1.7.0" folderName="ant-1.7"/>
|
||||
<get-ant-library version="1.8.0" folderName="ant-1.8"/>
|
||||
|
||||
<!-- dx.jar -->
|
||||
<get-maven-library prefix="com/google/android/tools" lib="dx" version="1.7" target.jar.name.base="dx"/>
|
||||
|
||||
Reference in New Issue
Block a user