Drop "-src" in kotlinc-jvm

Free arguments should be used instead
This commit is contained in:
Alexander Udalov
2014-07-22 17:50:41 +04:00
parent 917938e57b
commit de0fd3818c
25 changed files with 47 additions and 71 deletions
@@ -96,9 +96,10 @@ public class MockLibraryUtil {
Method execMethod = compilerClass.getMethod("exec", PrintStream.class, String[].class);
//noinspection IOResourceOpenedButNotSafelyClosed
Enum<?> invocationResult = (Enum<?>) execMethod
.invoke(compilerObject, new PrintStream(outStream),
new String[] {"-src", sourcesPath, "-output", outDir.getAbsolutePath(), "-classpath", sourcesPath});
Enum<?> invocationResult = (Enum<?>) execMethod.invoke(
compilerObject, new PrintStream(outStream),
new String[] {sourcesPath, "-output", outDir.getAbsolutePath(), "-classpath", sourcesPath}
);
assertEquals(new String(outStream.toByteArray()), ExitCode.OK.name(), invocationResult.name());
}
@@ -17,6 +17,8 @@
package org.jetbrains.jet.codegen.forTestCompile;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.ArrayUtil;
import kotlin.KotlinPackage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.cli.common.ExitCode;
@@ -57,8 +59,9 @@ public class ForTestCompileRuntime {
}
private static void compileBuiltIns(@NotNull File destDir) throws IOException {
String src = BUILT_INS_SRC_PATH + File.pathSeparator + RUNTIME_JVM_SRC_PATH + File.pathSeparator + REFLECTION_SRC_PATH;
compileKotlinToJvm("built-ins", destDir, src, src);
compileKotlinToJvm("built-ins", destDir,
BUILT_INS_SRC_PATH + File.pathSeparator + RUNTIME_JVM_SRC_PATH + File.pathSeparator + REFLECTION_SRC_PATH,
BUILT_INS_SRC_PATH, RUNTIME_JVM_SRC_PATH, REFLECTION_SRC_PATH);
JetTestUtils.compileJavaFiles(
javaFilesUnder(RUNTIME_JVM_SRC_PATH),
@@ -75,25 +78,25 @@ public class ForTestCompileRuntime {
}
private static void compileStdlib(@NotNull File destDir) throws IOException {
compileKotlinToJvm("stdlib", destDir, "libraries/stdlib/src", destDir.getPath());
compileKotlinToJvm("stdlib", destDir, destDir.getPath(), "libraries/stdlib/src");
}
private static void compileKotlinToJvm(
@NotNull String debugName,
@NotNull File destDir,
@NotNull String src,
@NotNull String classPath
@NotNull String classPath,
@NotNull String... src
) {
ExitCode exitCode = new K2JVMCompiler().exec(
System.out,
List<String> args = KotlinPackage.arrayListOf(
"-output", destDir.getPath(),
"-src", src,
"-noStdlib",
"-noJdkAnnotations",
"-suppress", "warnings",
"-annotations", JetTestUtils.getJdkAnnotationsJar().getAbsolutePath(),
"-classpath", classPath
);
args.addAll(Arrays.asList(src));
ExitCode exitCode = new K2JVMCompiler().exec(System.out, ArrayUtil.toStringArray(args));
if (exitCode != ExitCode.OK) {
throw new IllegalStateException("Compilation of " + debugName + " failed: " + exitCode);
}
@@ -79,13 +79,16 @@ public class CompileEnvironmentTest extends TestCase {
File out = new File(tempDir, "out");
File stdlib = ForTestCompileRuntime.runtimeJarForTests();
File jdkAnnotations = JetTestUtils.getJdkAnnotationsJar();
ExitCode exitCode = new K2JVMCompiler()
.exec(System.out, "-src", JetTestCaseBuilder.getTestDataPathBase() + "/compiler/smoke/Smoke.kt",
"-output", out.getAbsolutePath(),
"-noStdlib",
"-classpath", stdlib.getAbsolutePath(),
"-noJdkAnnotations",
"-annotations", jdkAnnotations.getAbsolutePath());
ExitCode exitCode = new K2JVMCompiler().exec(
System.out,
JetTestCaseBuilder.getTestDataPathBase() +
"/compiler/smoke/Smoke.kt",
"-output", out.getAbsolutePath(),
"-noStdlib",
"-classpath", stdlib.getAbsolutePath(),
"-noJdkAnnotations",
"-annotations", jdkAnnotations.getAbsolutePath()
);
Assert.assertEquals(ExitCode.OK, exitCode);
assertEquals(1, out.listFiles().length);
assertEquals(2, out.listFiles()[0].listFiles().length);