Fixed line separators for fix maven build on Windows.

This commit is contained in:
Zalim Bashorov
2014-04-16 18:06:28 +04:00
parent 361c81bbe5
commit 23922c1387
4 changed files with 9 additions and 12 deletions
@@ -16,13 +16,12 @@
package org.jetbrains.k2js.test.semantics;
import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.k2js.config.EcmaVersion;
import java.io.FileInputStream;
import java.io.File;
import java.io.IOException;
import static com.intellij.openapi.util.io.FileUtil.loadTextAndClose;
public final class StringTest extends AbstractExpressionTest {
public StringTest() {
@@ -75,8 +74,7 @@ public final class StringTest extends AbstractExpressionTest {
private void checkHasNoToStringCalls() throws IOException {
for (EcmaVersion ecmaVersion : DEFAULT_ECMA_VERSIONS) {
String filePath = getOutputFilePath(getTestName(true) + ".kt", ecmaVersion);
//noinspection IOResourceOpenedButNotSafelyClosed
String text = loadTextAndClose(new FileInputStream(filePath));
String text = FileUtil.loadFile(new File(filePath), /*convertLineSeparators = */ true);
assertFalse(filePath + " should not contain toString calls", text.contains("toString"));
}
}
@@ -21,7 +21,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.k2js.config.EcmaVersion;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.EnumSet;
@@ -49,9 +48,7 @@ public final class JsTestUtils {
@NotNull
public static String readFile(@NotNull String path) throws IOException {
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
FileInputStream stream = new FileInputStream(new File(path));
return FileUtil.loadTextAndClose(stream);
return FileUtil.loadFile(new File(path), /*convertLineSeparators = */ true);
}
@NotNull
@@ -21,6 +21,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
@@ -120,7 +121,7 @@ public class LibrarySourcesConfig extends Config {
ZipEntry entry = zipEntries.nextElement();
if (!entry.isDirectory() && entry.getName().endsWith(".kt")) {
InputStream stream = file.getInputStream(entry);
String text = FileUtil.loadTextAndClose(stream);
String text = StringUtil.convertLineSeparators(FileUtil.loadTextAndClose(stream));
JetFile jetFile = JetPsiFactory.createFile(getProject(), entry.getName(), text);
jetFile.putUserData(EXTERNAL_MODULE_NAME, UNKNOWN_EXTERNAL_MODULE_NAME);
result.add(jetFile);
@@ -156,4 +157,4 @@ public class LibrarySourcesConfig extends Config {
return true;
}
}
}
}
@@ -18,6 +18,7 @@ package org.jetbrains.k2js.config;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetPsiFactory;
@@ -73,7 +74,7 @@ public final class MetaInfServices {
// lets try to discover the file
InputStream stream = loadClasspathResource(line);
if (stream != null) {
String text = FileUtil.loadTextAndClose(stream);
String text = StringUtil.convertLineSeparators(FileUtil.loadTextAndClose(stream));
libFiles.add(JetPsiFactory.createFile(project, line, text));
}
}