-
Notifications
You must be signed in to change notification settings - Fork 540
Populate FileIndexMap during sync instead of using the Gradle Tooling API directly #5708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
I am pretty sure this closes #5628 |
There's something off with the |
AFAIK , the Gradle Tooling will be run for each Gradle project. So the IntelliJ sync should also be run isolated for each Gradle project. I will rewrite the sqldelight Gradle plugin to support project isolation today and also will change the SqlDelightPropertiesFile. This file is currently used as Gradle task input and as Idea model, but that's problematic due the same reason you mention. |
Yes, but the problem is with how the builder is registered. It's done so each time the plugin is applied, which can be multiple times, when it should only be registered once. The model builder provides the
If this is the case, we may not even need the model builder at all. If we can add the sqldelight files as a source set via Gradle, that can be queried from the |
Do you mean a Gradle SourceDirectorySet? That's the direction I want to rewrite the sqldelight Gradle plugin. |
Yep! I think that will expose the files to the IDEA plugin, which we can then query for. Just out of curiosity, is the only place to expect the sqldelight files in the directory |
Yes, commonMain or just main. |
If this is the case, we can get the path to this directory without adding it as a source to Gradle via the ContentRootData object in IntelliJ, which would contain the sources root path (which contains the |
@@ -8,163 +8,63 @@ import app.cash.sqldelight.dialect.api.SqlDelightDialect | |||
import app.cash.sqldelight.intellij.FileIndex | |||
import app.cash.sqldelight.intellij.SqlDelightFileIndexImpl | |||
import app.cash.sqldelight.intellij.notifications.FileIndexingNotification | |||
import app.cash.sqldelight.intellij.notifications.FileIndexingNotification.UnconfiguredReason.Syncing | |||
import app.cash.sqldelight.intellij.resolvers.SQL_DELIGHT_MODEL_KEY | |||
import com.android.tools.idea.gradle.project.sync.GradleSyncState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this wont work for not android studio
This resolves the issue where the
FileIndexMap
triggers a Gradle build configuration separate from the IDE sync. It gives a project resolver to the IDE to indicate thatSqlDelightPropertiesFile
can be queried during sync, and sets it as part of the internal IDE data structure for later retrieval.It also resolves the issue where the SqlDelight plugin was creating multiple Gradle daemons.
Example of syncing with the plugin while viewing a

.sq
file.As a side note, there is potential for improvement, as the IDE plugin can instead own the ToolingModelBuilder that lives in the Gradle plugin, although that would require much more work and discussions out of scope of this PR.