better error reporting in commandline compiler
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user