Files
openide/platform/external-system-impl
Alex Plate 7746460f32 [Workspace Model] [IJPL-867] Refactor deletion of iml files for removed imported modules
`iml` files of imported modules are not automatically removed due to different circumstances.
Because of this issue, the external build system did this manually for many years.
Unfortunately, this also affects the serialization of files and caused IJPL-867.

To fix the IJPL-867 issue, the following steps are taken:
- Get rid of manual `iml` removal by the external build system (`AbstractModuleDataService`).
- Update jps serializer to mark the imported iml for deletion.
- The `.iml` should not be deleted by the component store, but it's not due to IJPL-926. Ideally, we fix IJPL-926, but for now do the workaround: remove the ` iml ` file on the level of JPS serialization.

These steps fix the IJPL-867 issue, but a further fix for IJPL-926 is still needed.

# Notes
- Test `ExternalSystemProjectSaveTest` is created as a separate class that uses JUnit 4, however, this test can be placed in `ExternalSystemProjectTest`. The problem is that `ExternalSystemProjectTest` uses JUnit 3 and it freezez on `project.stateStore.save()` because of an unclear reason.

- `JpsProjectSerializersImpl.saveEntities` has a complicated logic when the `iml` file should be removed. As there is no goal to refactor/refresh this logic, I tried to minimize the number of changes around this place.

- `JpsProjectSerializersImpl.shouldDeleteImportedFile` has a corner case for broken configuration of the iml. This case is covered in `ExternalSystemStorageTest.multiple modules with the same name` test.

- `ModuleImlFileEntitiesSerializer.manuallyRemoveImlFile` has a check for the correct casing. This test case is covered in `ExternalSystemStorageTest.multiple modules with the same name but different case`.

- After the `iml` deletion, the VFS should technically be refreshed, but we don't do it because the module with JPS serialization does not have a dependency to the module with VFS. Because of that, the `iml` does not disappear immediately from the project tree if it's there. I consider that this problem is minor.

GitOrigin-RevId: e6228e06017f6aef26fb78321a27a3ad05e1c22c
2024-06-26 21:18:15 +00:00
..