diff --git a/build-tools/build-tools.iml b/build-tools/build-tools.iml
index d184270053f..d0304c4b431 100644
--- a/build-tools/build-tools.iml
+++ b/build-tools/build-tools.iml
@@ -10,6 +10,7 @@
+
diff --git a/build-tools/core/src/org/jetbrains/jet/buildtools/core/BytecodeCompiler.java b/build-tools/core/src/org/jetbrains/jet/buildtools/core/BytecodeCompiler.java
index 0f35310a117..6e886343e5f 100644
--- a/build-tools/core/src/org/jetbrains/jet/buildtools/core/BytecodeCompiler.java
+++ b/build-tools/core/src/org/jetbrains/jet/buildtools/core/BytecodeCompiler.java
@@ -16,6 +16,7 @@
package org.jetbrains.jet.buildtools.core;
+import jet.modules.Module;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.compiler.*;
@@ -139,7 +140,9 @@ public class BytecodeCompiler {
public void moduleToJar ( @NotNull String module, @NotNull String jar, boolean includeRuntime, @Nullable String stdlib, @Nullable String[] classpath ) {
try {
CompileEnvironmentConfiguration env = env(stdlib, classpath);
- boolean success = KotlinToJVMBytecodeCompiler.compileModules(env, module, jar, null, includeRuntime);
+ List modules = CompileEnvironmentUtil.loadModuleScript(module, env.getMessageCollector());
+ File directory = new File(module).getParentFile();
+ boolean success = KotlinToJVMBytecodeCompiler.compileModules(env, modules, directory, jar, null, includeRuntime);
if ( ! success ) {
throw new CompileEnvironmentException( errorMessage( module, false ));
}