Skip to content

Commit

Permalink
fix: incompatibility with intellij versions on Gradle Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
DevSrSouza committed May 7, 2023
1 parent 3d067af commit fecccc7
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ class FocusService(private val project: Project) {
)
}

private val requestConstructor by lazy {
GradleSyncInvoker.Request::class.java.getConstructor(
GradleSyncStats.Trigger::class.java
)
}

fun syncGradle() {
_focusOperationState.value = true

Expand All @@ -112,12 +118,14 @@ class FocusService(private val project: Project) {
)
}.onFailure {
// AS 2022.1 Canary 1 does not have a function with [Trigger] type
requestProjectSyncMethodWithRequest.invoke(
gradleProjectImporterInstance,
project,
GradleSyncInvoker.Request(GradleSyncStats.Trigger.TRIGGER_PROJECT_MODIFIED),
null,
)
try {
requestProjectSyncMethodWithRequest.invoke(
gradleProjectImporterInstance,
project,
requestConstructor.newInstance(GradleSyncStats.Trigger.TRIGGER_PROJECT_MODIFIED),
null,
)
} catch (e: Throwable) {}
}
}
}

0 comments on commit fecccc7

Please sign in to comment.