This commit is contained in:
Andrey Breslav
2012-11-12 21:18:19 +04:00
parent b2b5ccefbd
commit afa4ee898c
3 changed files with 8 additions and 11 deletions
@@ -106,7 +106,7 @@ public class JetCompiler implements TranslatingCompiler {
MessageCollector messageCollector = new MessageCollectorAdapter(compileContext);
CompilerEnvironment environment = CompilerUtils.getEnvironmentFor(compileContext, module, tests);
CompilerEnvironment environment = TranslatingCompilerUtils.getEnvironmentFor(compileContext, module, tests);
if (!environment.success()) {
environment.reportErrorsTo(messageCollector);
return;
@@ -129,7 +129,7 @@ public class JetCompiler implements TranslatingCompiler {
};
runCompiler(messageCollector, environment, scriptFile, collector);
CompilerUtils.reportOutputs(outputSink, outputDir, collector);
TranslatingCompilerUtils.reportOutputs(outputSink, outputDir, collector);
}
private static void runCompiler(
@@ -82,7 +82,7 @@ public final class K2JSCompiler implements TranslatingCompiler {
MessageCollector messageCollector = new MessageCollectorAdapter(context);
CompilerEnvironment environment = CompilerUtils.getEnvironmentFor(context, module, /*tests = */ false);
CompilerEnvironment environment = TranslatingCompilerUtils.getEnvironmentFor(context, module, /*tests = */ false);
if (!environment.success()) {
environment.reportErrorsTo(messageCollector);
return;
@@ -100,7 +100,7 @@ public final class K2JSCompiler implements TranslatingCompiler {
return execInProcess(messageCollector, environment, stream, module);
}
});
CompilerUtils.reportOutputs(sink, environment.getOutput(), collector);
TranslatingCompilerUtils.reportOutputs(sink, environment.getOutput(), collector);
}
@Nullable
@@ -34,22 +34,19 @@ import java.io.File;
import java.util.List;
import java.util.Set;
/**
* @author Pavel Talanov
*/
public final class CompilerUtils {
private CompilerUtils() {
public final class TranslatingCompilerUtils {
private TranslatingCompilerUtils() {
}
@NotNull
public static CompilerEnvironment getEnvironmentFor(@NotNull CompileContext compileContext, @NotNull Module module, boolean tests) {
VirtualFile mainOutput = compileContext.getModuleOutputDirectory(module);
VirtualFile outputDirectoryForTests = compileContext.getModuleOutputDirectoryForTests(module);
return CompilerEnvironment.getEnvironmentFor(tests, toIoFile(mainOutput), toIoFile(outputDirectoryForTests));
return CompilerEnvironment.getEnvironmentFor(tests, toNullableIoFile(mainOutput), toNullableIoFile(outputDirectoryForTests));
}
@Nullable
public static File toIoFile(@Nullable VirtualFile file) {
public static File toNullableIoFile(@Nullable VirtualFile file) {
if (file == null) return null;
return new File(file.getPath());
}