intellij-community
intellij-community copied to clipboard
Consume version catalog for included gradle build module
CommonGradleProjectResolverExtension creates and fill IdeaProject/IdeaModule models with Gradle Sync data. It attaches BuildScriptClasspathData.VERSION_CATALOGS to IdeaProject for regular projects. However, project with included builds there is module that may have it's own catalog. So it also needs to be consumed
Android Studio heavily rely on catalog data that is available after sync (parsing settings files is slow), so also need to have this additional chunk of data too Relates to: https://b.corp.google.com/issues/391154478
Another thought: using getBuildModel is limited because it's slow as it parses files to produce DSL model. Sometime ago we start using sync data in GradleDslVersionCatalogHandler.getVersionCatalogFiles. Method is in use by different code hilighting helpers that can be called very often. Refactoring (like renaming something in build files) also uses this method, problem is that refactoring happens in EDT. So the general vector is now using sync data as much as possible as it is very cheap.
Another thought: using getBuildModel is limited because it's slow as it parses files to produce DSL model
Just in case, when I suggested using getBuildModel, I didn't mean the code that parses a file. I was talking about ProjectResolverContext#getBuildModel, which is about the data from Gradle.
So the general vector is now using sync data as much as possible as it is very
cheap.
I agree with that point. That's why I also want to rely on this data to get the version catalog locations. Now, resolving a lot of PsiElements in build scripts in Groovy causes parsing files and producing the DSL model, for each element separately. Sounds expensive :)
Thank you. As we are migrating away from DataNodes overall, this PR is no longer relevant.