support eclipse compiler in external build (initial)

This commit is contained in:
Eugene Zhuravlev
2012-07-03 20:32:36 +02:00
parent 0f7e18f8b3
commit 84ba062959
12 changed files with 93 additions and 23 deletions
@@ -50,9 +50,20 @@ public class EclipseCompiler extends ExternalCompiler {
private final Project myProject;
private final List<File> myTempFiles = new ArrayList<File>();
private static final String COMPILER_CLASS_NAME = "org.eclipse.jdt.core.compiler.batch.BatchCompiler";
@NonNls private static final String PATH_TO_COMPILER_JAR = findJarPah();
private static String findJarPah() {
try {
final Class<?> aClass = Class.forName(COMPILER_CLASS_NAME);
final String path = PathManager.getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class");
if (path != null) {
return path;
}
}
catch (ClassNotFoundException ignored) {
}
File dir = new File(PathManager.getLibPath());
File[] jars = dir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
@@ -696,6 +696,7 @@ public class BuildManager implements ApplicationComponent{
if (ApplicationManager.getApplication().isUnitTestMode()) {
cmdLine.addParameter("-Dtest.mode=true");
}
cmdLine.addParameter("-Djdt.compiler.useSingleThread=true");
final String shouldGenerateIndex = System.getProperty(GlobalOptions.GENERATE_CLASSPATH_INDEX_OPTION);
if (shouldGenerateIndex != null) {