Skip to content

Conversation

@yuriy-solodkyy
Copy link
Contributor

This change fixes the JpsProjectModelSynchronizer synchronizer behavior in Android Studio making it the same as in IntelliJ Idea CE. Without this change loading pure workspace model projects triggers empty project handling that is not needed and also it seems that it breaks the facet index in ProjectFacetManagerImpl by not notifying it that about any facets loaded from the workspace model.

jrguzman-ms pushed a commit to msft-mirror-aosp/platform.tools.idea that referenced this pull request Nov 6, 2025
This is an early cherry-pick of upstream pull request
JetBrains/intellij-community#3296.

Bug: 457465500
Change-Id: I61e3ad5d65e7fb2dd0bede2d3dbf7389ed7e3c1a
return is(RUSTROVER_PREFIX);
}

public static boolean isAndroidStudio() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really like to avoid adding new methods to this class, see its Javadoc for details. The chances that people will think about Android Studio when adding new isIdeaCommunity checks are low even if we have such a method.

Let's move this method to JpsProjectModelSynchronizer for now. After that, I will introduce a proper API for that case (like isIdeSupportsMultiModuleProjects) and use it in this and other similar places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update the PR. I also wanted to check whether the behavior that we try to change this way is actually correct.
We (re)use Jps workspace model entities with a different entity source so that they are not recognised by the synchronizer and do not create .iml/xml files as it is really slow and not needed for us. However, when opening such projects without this change the workspace model isLoadedFromCache (maybe not the exact name) flag is reset to false and it results in facedAdded not being called and the project facet manager gets it facet index not updated. I think in the presence of .iml files it is subsequently updated as a result of jps sync but it feels like it is an issue somewhere else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is correct. The whole point of that hasNoSerializedJpsModules function is to implement a workaround for IDEs like WebStorm which don't show modules in their UI and automatically create a single module on opening a project (IJPL-9255). It's unnecessary for IntelliJ IDEA and other IDEs where modules are created by users or imported from a build system. Unfortunately, we didn't find time yet to implement a proper fix instead of that workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants