Skip to content

Commit

Permalink
Refactor MavenImportListener in MavenUtils
Browse files Browse the repository at this point in the history
The importFinished method in MavenImportListener has been modified to receive two additional parameters: importedProjects and newModules. Additionally, unnecessary import lines for javaApi and javaRuntime were removed from MavenUtils.kt. This refinement provides more information during the import finish event for further handling.

(cherry picked from commit d62be21)
  • Loading branch information
lamba92 committed Jan 30, 2024
1 parent d9dba5e commit 582a79f
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ import org.jetbrains.idea.maven.project.MavenProjectsManager
import org.jetbrains.packagesearch.api.v3.ApiPackage
import org.jetbrains.packagesearch.api.v3.ApiRepository
import org.jetbrains.packagesearch.api.v3.search.buildPackageTypes
import org.jetbrains.packagesearch.api.v3.search.javaApi
import org.jetbrains.packagesearch.api.v3.search.javaRuntime
import org.jetbrains.packagesearch.api.v3.search.jvmMavenPackages
import org.jetbrains.packagesearch.maven.POM_XML_NAMESPACE
import org.jetbrains.packagesearch.maven.ProjectObjectModel
Expand All @@ -63,10 +61,16 @@ val commonScopes = listOf("compile", "provided", "runtime", "test", "system", "i

val Project.mavenImportFlow
get() = messageBus.flow(MavenImportListener.TOPIC) {
MavenImportListener { _, _ ->
trySend(Unit)
object : MavenImportListener {
override fun importFinished(
importedProjects: MutableCollection<MavenProject>,
newModules: MutableList<Module>,
) {
trySend(Unit)
}
}
}

context(ProjectContext)
fun getModuleChangesFlow(pomPath: Path): Flow<Unit> = merge(
watchExternalFileChanges(mavenSettingsFilePath),
Expand Down

0 comments on commit 582a79f

Please sign in to comment.