From cf6704479f25c2b2fa680b878b971d30c4f8a470 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Wed, 25 Jan 2012 13:59:19 +0400 Subject: [PATCH] some logging --- .../jetbrains/jet/compiler/CompileEnvironment.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java b/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java index 54b530da695..600c61ec281 100644 --- a/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java +++ b/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java @@ -124,6 +124,10 @@ public class CompileEnvironment { throw new CompileEnvironmentException("Module script " + moduleFile + " compilation failed"); } + if (modules.isEmpty()) { + throw new CompileEnvironmentException("No modules where defined by " + moduleFile); + } + final String directory = new File(moduleFile).getParent(); for (Module moduleBuilder : modules) { ClassFileFactory moduleFactory = compileModule(moduleBuilder, directory); @@ -169,12 +173,21 @@ public class CompileEnvironment { public ClassFileFactory compileModule(Module moduleBuilder, String directory) { CompileSession moduleCompileSession = new CompileSession(myEnvironment); + + if (moduleBuilder.getSourceFiles().isEmpty()) { + throw new CompileEnvironmentException("No source files where defined"); + } + for (String sourceFile : moduleBuilder.getSourceFiles()) { File source = new File(sourceFile); if (!source.isAbsolute()) { source = new File(directory, sourceFile); } + if (!source.exists()) { + throw new CompileEnvironmentException("'" + source + "' does not exist"); + } + moduleCompileSession.addSources(source.getPath()); } for (String classpathRoot : moduleBuilder.getClasspathRoots()) {