override suspend fun editModule()

in plugin/gradle/kmp/src/main/kotlin/com/jetbrains/packagesearch/plugin/gradle/PackageSearchKotlinMultiplatformModule.kt [51:67]


    override suspend fun editModule(action: EditModuleContext.() -> Unit) {
        val ctx = writeAction {
            val modifier = DependencyModifierService.getInstance(nativeModule.project)
            val context = EditKMPModuleContext(EditKMPModuleContextData(modifier, nativeModule))
            action(context)
            context.data
        }
        ctx.getRemoves()
            .takeIf { it.isNotEmpty() }
            ?.let { MppDependencyModifier.removeDependencies(nativeModule, it) }
        ctx.getInstalls()
            .takeIf { it.isNotEmpty() }
            ?.let { MppDependencyModifier.addDependencies(nativeModule, it) }
        ctx.getUpdates()
            .takeIf { it.isNotEmpty() }
            ?.let { MppDependencyModifier.updateDependencies(nativeModule, it) }
    }