better error reporting in commandline compiler

This commit is contained in:
Stepan Koltsov
2012-01-06 21:22:50 +04:00
parent dba41c2e88
commit 430b973458
2 changed files with 19 additions and 7 deletions
@@ -33,9 +33,14 @@ public class KotlinCompiler {
try {
Args.parse(arguments, args);
}
catch (Throwable t) {
catch (IllegalArgumentException e) {
System.out.println("Usage: KotlinCompiler [-output <outputDir>|-jar <jarFileName>] [-src <filename or dirname>|-module <module file>] [-includeRuntime]");
System.exit(1);
return;
}
catch (Throwable t) {
t.printStackTrace();
System.exit(1);
return;
}
@@ -44,7 +49,8 @@ public class KotlinCompiler {
try {
environment.setJavaRuntime(CompileEnvironment.findRtJar(true));
if (!environment.initializeKotlinRuntime()) {
System.out.println("No runtime library found");
System.err.println("No Kotlin runtime library found");
System.exit(1);
return;
}
@@ -53,10 +59,15 @@ public class KotlinCompiler {
return;
}
else {
environment.compileBunchOfSources(arguments.src, arguments.jar, arguments.outputDir, arguments.includeRuntime);
if (!environment.compileBunchOfSources(arguments.src, arguments.jar, arguments.outputDir, arguments.includeRuntime)) {
System.exit(1);
return;
}
}
} catch (CompileEnvironmentException e) {
System.out.println(e.getMessage());
System.err.println(e.getMessage());
System.exit(1);
return;
}
}