Support "-d" option in kotlinc-jvm

The intent is to unify "-output" and "-jar" options into the one "-d"
(destination)
This commit is contained in:
Alexander Udalov
2014-07-22 18:22:51 +04:00
parent de0fd3818c
commit 19b80f57cf
29 changed files with 65 additions and 43 deletions
@@ -37,7 +37,7 @@ import java.util.List;
import java.util.regex.Pattern;
import java.util.zip.ZipOutputStream;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
public class MockLibraryUtil {
@@ -98,7 +98,7 @@ public class MockLibraryUtil {
//noinspection IOResourceOpenedButNotSafelyClosed
Enum<?> invocationResult = (Enum<?>) execMethod.invoke(
compilerObject, new PrintStream(outStream),
new String[] {sourcesPath, "-output", outDir.getAbsolutePath(), "-classpath", sourcesPath}
new String[] {sourcesPath, "-d", outDir.getAbsolutePath(), "-classpath", sourcesPath}
);
assertEquals(new String(outStream.toByteArray()), ExitCode.OK.name(), invocationResult.name());
@@ -88,7 +88,7 @@ public class ForTestCompileRuntime {
@NotNull String... src
) {
List<String> args = KotlinPackage.arrayListOf(
"-output", destDir.getPath(),
"-d", destDir.getPath(),
"-noStdlib",
"-noJdkAnnotations",
"-suppress", "warnings",
@@ -44,13 +44,15 @@ public class CompileEnvironmentTest extends TestCase {
File stdlib = ForTestCompileRuntime.runtimeJarForTests();
File jdkAnnotations = JetTestUtils.getJdkAnnotationsJar();
File resultJar = new File(tempDir, "result.jar");
ExitCode rv = new K2JVMCompiler().exec(System.out,
"-module", JetTestCaseBuilder.getTestDataPathBase() + "/compiler/smoke/Smoke.ktm",
"-jar", resultJar.getAbsolutePath(),
"-noStdlib",
"-classpath", stdlib.getAbsolutePath(),
"-noJdkAnnotations",
"-annotations", jdkAnnotations.getAbsolutePath());
ExitCode rv = new K2JVMCompiler().exec(
System.out,
"-module", JetTestCaseBuilder.getTestDataPathBase() + "/compiler/smoke/Smoke.ktm",
"-d", resultJar.getAbsolutePath(),
"-noStdlib",
"-classpath", stdlib.getAbsolutePath(),
"-noJdkAnnotations",
"-annotations", jdkAnnotations.getAbsolutePath()
);
Assert.assertEquals("compilation completed with non-zero code", ExitCode.OK, rv);
FileInputStream fileInputStream = new FileInputStream(resultJar);
try {
@@ -81,9 +83,8 @@ public class CompileEnvironmentTest extends TestCase {
File jdkAnnotations = JetTestUtils.getJdkAnnotationsJar();
ExitCode exitCode = new K2JVMCompiler().exec(
System.out,
JetTestCaseBuilder.getTestDataPathBase() +
"/compiler/smoke/Smoke.kt",
"-output", out.getAbsolutePath(),
JetTestCaseBuilder.getTestDataPathBase() + "/compiler/smoke/Smoke.kt",
"-d", out.getAbsolutePath(),
"-noStdlib",
"-classpath", stdlib.getAbsolutePath(),
"-noJdkAnnotations",