@@ -11416,7 +11416,6 @@ def _complianceToIntellijLanguageLevel(compliance):
1141611416 def processDep(dep, edge):
1141711417 if dep is proj:
1141811418 return
11419-
1142011419 if dep.isLibrary() or dep.isJARDistribution():
1142111420 libraries.add(dep)
1142211421 moduleXml.element('orderEntry', attributes={'type': 'library', 'name': dep.name, 'level': 'project'})
@@ -11715,7 +11714,7 @@ def fsckprojects(args):
1171511714 # don't traverse subdirs of an existing distributions in this suite
1171611715 dirnames[:] = []
1171711716 else:
11718- projectConfigFiles = frozenset(['.classpath', '.project', 'nbproject'])
11717+ projectConfigFiles = frozenset(['.classpath', '.project', 'nbproject', basename(dirpath) + '.iml' ])
1171911718 indicators = projectConfigFiles.intersection(files)
1172011719 if len(indicators) != 0:
1172111720 indicators = [os.path.relpath(join(dirpath, i), suite.dir) for i in indicators]
@@ -11725,6 +11724,26 @@ def fsckprojects(args):
1172511724 if ask_yes_no(dirpath + ' looks like a removed project -- delete it', 'n'):
1172611725 shutil.rmtree(dirpath)
1172711726 log('Deleted ' + dirpath)
11727+ ideaProjectDirectory = join(suite.dir, '.idea')
11728+ librariesDirectory = join(ideaProjectDirectory, 'libraries')
11729+ if exists(librariesDirectory):
11730+ neededLibraries = set()
11731+ for p in suite.projects_recursive():
11732+ def processDep(dep, edge):
11733+ if dep is p:
11734+ return
11735+ if dep.isLibrary() or dep.isJARDistribution() or dep.isJdkLibrary():
11736+ neededLibraries.add(dep)
11737+ p.walk_deps(visit=processDep, ignoredEdges=[DEP_EXCLUDED])
11738+ neededLibraryFiles = frozenset([l.name + '.xml' for l in neededLibraries])
11739+ existingLibraryFiles = frozenset(os.listdir(librariesDirectory))
11740+ for library_file in existingLibraryFiles - neededLibraryFiles:
11741+ file_path = join(librariesDirectory, library_file)
11742+ relative_file_path = os.path.relpath(file_path, os.curdir)
11743+ if ask_yes_no(relative_file_path + ' looks like a removed library -- delete it', 'n'):
11744+ os.remove(file_path)
11745+ log('Deleted ' + relative_file_path)
11746+
1172811747
1172911748def _find_packages(project, onlyPublic=True, included=None, excluded=None):
1173011749 """
0 commit comments