mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 14:17:48 +00:00
Make the unittests for ecj work on windows
This commit is contained in:
1 parent
0f86101098
commit
102e7eafb0
1 file changed
+17
-9
@@ -26,6 +26,7 @@ import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@@ -92,18 +93,10 @@ public class RunTestsViaEcj extends AbstractRunTests {
|
||||
}
|
||||
};
|
||||
|
||||
List<String> classpath = new ArrayList<String>();
|
||||
classpath.addAll(Arrays.asList(System.getProperty("sun.boot.class.path").split(File.pathSeparator)));
|
||||
classpath.add("dist/lombok.jar");
|
||||
classpath.add("lib/test/commons-logging.jar");
|
||||
classpath.add("lib/test/slf4j-api.jar");
|
||||
classpath.add("lib/test/log4j.jar");
|
||||
FileSystem fileAccess = new FileSystem(classpath.toArray(new String[0]), new String[] {file.getAbsolutePath()}, "UTF-8");
|
||||
|
||||
String source = readFile(file);
|
||||
final CompilationUnit sourceUnit = new CompilationUnit(source.toCharArray(), file.getName(), "UTF-8");
|
||||
|
||||
Compiler ecjCompiler = new Compiler(fileAccess, ecjErrorHandlingPolicy(), ecjCompilerOptions(), bitbucketRequestor, new DefaultProblemFactory(Locale.ENGLISH)) {
|
||||
Compiler ecjCompiler = new Compiler(createFileSystem(file), ecjErrorHandlingPolicy(), ecjCompilerOptions(), bitbucketRequestor, new DefaultProblemFactory(Locale.ENGLISH)) {
|
||||
@Override protected synchronized void addCompilationUnit(ICompilationUnit inUnit, CompilationUnitDeclaration parsedUnit) {
|
||||
if (inUnit == sourceUnit) compilationUnit_.set(parsedUnit);
|
||||
super.addCompilationUnit(inUnit, parsedUnit);
|
||||
@@ -123,4 +116,19 @@ public class RunTestsViaEcj extends AbstractRunTests {
|
||||
|
||||
result.append(cud.toString());
|
||||
}
|
||||
|
||||
private FileSystem createFileSystem(File file) {
|
||||
List<String> classpath = new ArrayList<String>();
|
||||
classpath.addAll(Arrays.asList(System.getProperty("sun.boot.class.path").split(File.pathSeparator)));
|
||||
for (Iterator<String> i = classpath.iterator(); i.hasNext();) {
|
||||
if (FileSystem.getClasspath(i.next(), "UTF-8", null) == null) {
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
classpath.add("dist/lombok.jar");
|
||||
classpath.add("lib/test/commons-logging.jar");
|
||||
classpath.add("lib/test/slf4j-api.jar");
|
||||
classpath.add("lib/test/log4j.jar");
|
||||
return new FileSystem(classpath.toArray(new String[0]), new String[] {file.getAbsolutePath()}, "UTF-8");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user