Skip to content

Commit

Permalink
exclude junit.jar from default idea sdk (leave only junit4.xxx.jar)
Browse files Browse the repository at this point in the history
  • Loading branch information
akozlova committed Mar 28, 2012
1 parent da2ff9f commit ff3ee4a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions plugins/devkit/src/projectRoots/IdeaJdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import java.io.FileFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -183,25 +184,26 @@ public static String getBuildNumber(String ideaHome) {

private static VirtualFile[] getIdeaLibrary(String home) {
ArrayList<VirtualFile> result = new ArrayList<VirtualFile>();
appendIdeaLibrary(home + File.separator + LIB_DIR_NAME, null, result);
appendIdeaLibrary(home + File.separator + PLUGINS_DIR + File.separator + JAVAEE_DIR + File.separator + LIB_DIR_NAME, "javaee-impl.jar",
result);
appendIdeaLibrary(home + File.separator + PLUGINS_DIR + File.separator + JSF_DIR + File.separator + LIB_DIR_NAME, "jsf-impl.jar", result);
appendIdeaLibrary(home + File.separator + PLUGINS_DIR + File.separator + PERSISTENCE_SUPPORT + File.separator + LIB_DIR_NAME, "persistence-impl.jar", result);
appendIdeaLibrary(home + File.separator + PLUGINS_DIR + File.separator + DATABASE_DIR + File.separator + LIB_DIR_NAME, "database-impl.jar", result);
appendIdeaLibrary(home + File.separator + PLUGINS_DIR + File.separator + CSS_DIR + File.separator + LIB_DIR_NAME, "css.jar", result);
appendIdeaLibrary(home + File.separator + LIB_DIR_NAME, result, "junit.jar");
appendIdeaLibrary(home + File.separator + PLUGINS_DIR + File.separator + JAVAEE_DIR + File.separator + LIB_DIR_NAME, result, "javaee-impl.jar");
appendIdeaLibrary(home + File.separator + PLUGINS_DIR + File.separator + JSF_DIR + File.separator + LIB_DIR_NAME, result, "jsf-impl.jar");
appendIdeaLibrary(home + File.separator + PLUGINS_DIR + File.separator + PERSISTENCE_SUPPORT + File.separator + LIB_DIR_NAME, result, "persistence-impl.jar");
appendIdeaLibrary(home + File.separator + PLUGINS_DIR + File.separator + DATABASE_DIR + File.separator + LIB_DIR_NAME, result, "database-impl.jar");
appendIdeaLibrary(home + File.separator + PLUGINS_DIR + File.separator + CSS_DIR + File.separator + LIB_DIR_NAME, result, "css.jar");
return VfsUtil.toVirtualFileArray(result);
}

private static void appendIdeaLibrary(final String path, @Nullable @NonNls final String forbidden, final ArrayList<VirtualFile> result) {
private static void appendIdeaLibrary(final String path,
final ArrayList<VirtualFile> result,
@NonNls final String... forbidden) {
final JarFileSystem jfs = JarFileSystem.getInstance();
final File lib = new File(path);
if (lib.isDirectory()) {
File[] jars = lib.listFiles();
if (jars != null) {
for (File jar : jars) {
@NonNls String name = jar.getName();
if (jar.isFile() && !name.equals(forbidden) && (name.endsWith(".jar") || name.endsWith(".zip"))) {
if (jar.isFile() && Arrays.binarySearch(forbidden, name) < 0 && (name.endsWith(".jar") || name.endsWith(".zip"))) {
result.add(jfs.findFileByPath(jar.getPath() + JarFileSystem.JAR_SEPARATOR));
}
}
Expand Down

0 comments on commit ff3ee4a

Please sign in to comment.