mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 06:39:38 +07:00
jps model: don't fail if some iml file doesn't exist (IDEA-173842)
This commit is contained in:
@@ -303,17 +303,22 @@ public class JpsProjectLoader extends JpsLoaderBase {
|
||||
try {
|
||||
final List<String> classpathDirs = new ArrayList<>();
|
||||
for (Future<Pair<Path, Element>> moduleFile : futureModuleFilesContents) {
|
||||
final String classpathDir = moduleFile.get().getSecond().getAttributeValue(CLASSPATH_DIR_ATTRIBUTE);
|
||||
if (classpathDir != null) {
|
||||
classpathDirs.add(classpathDir);
|
||||
Element rootElement = moduleFile.get().getSecond();
|
||||
if (rootElement != null) {
|
||||
final String classpathDir = rootElement.getAttributeValue(CLASSPATH_DIR_ATTRIBUTE);
|
||||
if (classpathDir != null) {
|
||||
classpathDirs.add(classpathDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Future<JpsModule>> futures = new ArrayList<>();
|
||||
for (final Future<Pair<Path, Element>> futureModuleFile : futureModuleFilesContents) {
|
||||
final Pair<Path, Element> moduleFile = futureModuleFile.get();
|
||||
futures.add(ourThreadPool.submit(
|
||||
() -> loadModule(moduleFile.getFirst(), moduleFile.getSecond(), classpathDirs, projectSdkType, pathVariables)));
|
||||
if (moduleFile.getSecond() != null) {
|
||||
futures.add(ourThreadPool.submit(
|
||||
() -> loadModule(moduleFile.getFirst(), moduleFile.getSecond(), classpathDirs, projectSdkType, pathVariables)));
|
||||
}
|
||||
}
|
||||
for (Future<JpsModule> future : futures) {
|
||||
JpsModule module = future.get();
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/missingImlFile.iml" filepath="$PROJECT_DIR$/missingImlFile.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.4" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -236,6 +236,11 @@ public class JpsProjectSerializationTest extends JpsSerializationTestCase {
|
||||
assertEquals("main", assertOneElement(myProject.getModules()).getName());
|
||||
}
|
||||
|
||||
public void testMissingImlFile() {
|
||||
loadProject("/jps/model-serialization/testData/missingImlFile/missingImlFile.ipr");
|
||||
assertEmpty(myProject.getModules());
|
||||
}
|
||||
|
||||
private void doTestSaveLibrary(@NotNull Path libFile, String libName, JpsLibrary library) {
|
||||
Element actual = new Element("library");
|
||||
JpsLibraryTableSerializer.saveLibrary(library, actual, libName);
|
||||
|
||||
Reference in New Issue
Block a user