Minor: report error instead of crash with exceptions when collect JetFiles to compile and remove obsolete (wrong now) code
#EA-61681 Obsolete
This commit is contained in:
@@ -171,19 +171,22 @@ public open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
val compilerConfiguration = KotlinToJVMBytecodeCompiler.createCompilerConfiguration(configuration, moduleScript.getModules(), directory)
|
||||
environment = createCoreEnvironment(rootDisposable, compilerConfiguration)
|
||||
|
||||
if (messageSeverityCollector.anyReported(CompilerMessageSeverity.ERROR)) return COMPILATION_ERROR
|
||||
|
||||
KotlinToJVMBytecodeCompiler.compileModules(environment, configuration, moduleScript.getModules(), directory, jar, arguments.includeRuntime)
|
||||
}
|
||||
else if (arguments.script) {
|
||||
val scriptArgs = arguments.freeArgs.subList(1, arguments.freeArgs.size())
|
||||
environment = createCoreEnvironment(rootDisposable, configuration)
|
||||
|
||||
if (messageSeverityCollector.anyReported(CompilerMessageSeverity.ERROR)) return COMPILATION_ERROR
|
||||
|
||||
KotlinToJVMBytecodeCompiler.compileAndExecuteScript(configuration, paths, environment, scriptArgs)
|
||||
}
|
||||
else {
|
||||
environment = createCoreEnvironment(rootDisposable, configuration)
|
||||
|
||||
if (messageSeverityCollector.anyReported(CompilerMessageSeverity.ERROR)) {
|
||||
return COMPILATION_ERROR
|
||||
}
|
||||
if (messageSeverityCollector.anyReported(CompilerMessageSeverity.ERROR)) return COMPILATION_ERROR
|
||||
|
||||
if (environment.getSourceFiles().isEmpty()) {
|
||||
messageSeverityCollector.report(CompilerMessageSeverity.ERROR, "No source files", CompilerMessageLocation.NO_LOCATION)
|
||||
|
||||
-5
@@ -85,11 +85,6 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
if (!source.isAbsolute()) {
|
||||
source = new File(directory, sourceFile);
|
||||
}
|
||||
|
||||
if (!source.exists()) {
|
||||
throw new CompileEnvironmentException("'" + source + "' does not exist in module " + module.getModuleName());
|
||||
}
|
||||
|
||||
result.add(source.getAbsolutePath());
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user