Clean up of plugin-common.xml and convert components to services
This commit is contained in:
-39
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.compiler.configuration
|
||||
|
||||
import com.intellij.compiler.server.BuildProcessParametersProvider
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.idea.PluginStartupComponent
|
||||
|
||||
class KotlinBuildProcessParametersProvider(private val project: Project) : BuildProcessParametersProvider() {
|
||||
override fun getVMArguments(): MutableList<String> {
|
||||
val compilerWorkspaceSettings = KotlinCompilerWorkspaceSettings.getInstance(project)
|
||||
|
||||
val res = arrayListOf<String>()
|
||||
if (compilerWorkspaceSettings.preciseIncrementalEnabled) {
|
||||
res.add("-D" + IncrementalCompilation.INCREMENTAL_COMPILATION_JVM_PROPERTY + "=true")
|
||||
}
|
||||
if (compilerWorkspaceSettings.incrementalCompilationForJsEnabled) {
|
||||
res.add("-D" + IncrementalCompilation.INCREMENTAL_COMPILATION_JS_PROPERTY + "=true")
|
||||
}
|
||||
if (compilerWorkspaceSettings.enableDaemon) {
|
||||
res.add("-Dkotlin.daemon.enabled")
|
||||
}
|
||||
if (Registry.`is`("kotlin.jps.instrument.bytecode", false)) {
|
||||
res.add("-Dkotlin.jps.instrument.bytecode=true")
|
||||
}
|
||||
PluginStartupComponent.getInstance().aliveFlagPath.let {
|
||||
if (!it.isBlank()) {
|
||||
// TODO: consider taking the property name from compiler/daemon/common (check whether dependency will be not too heavy)
|
||||
res.add("-Dkotlin.daemon.client.alive.path=\"$it\"")
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerServ
|
||||
class KotlinExternalSystemSyncListener : ExternalSystemTaskNotificationListenerAdapter() {
|
||||
override fun onStart(id: ExternalSystemTaskId, workingDir: String) {
|
||||
val project = id.findResolvedProject() ?: return
|
||||
KotlinMigrationProjectComponent.getInstanceIfNotDisposed(project)?.onImportAboutToStart()
|
||||
KotlinMigrationProjectService.getInstanceIfNotDisposed(project)?.onImportAboutToStart()
|
||||
KotlinConfigurationCheckerService.getInstanceIfNotDisposed(project)?.syncStarted()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ class KotlinConfigurationCheckerComponent(val project: Project) : ProjectCompone
|
||||
NotificationsConfiguration.getNotificationsConfiguration()
|
||||
.register(CONFIGURE_NOTIFICATION_GROUP_ID, NotificationDisplayType.STICKY_BALLOON, true)
|
||||
|
||||
val connection = project.messageBus.connect()
|
||||
val connection = project.messageBus.connect(project)
|
||||
connection.subscribe(ProjectDataImportListener.TOPIC, ProjectDataImportListener {
|
||||
notifyOutdatedBundledCompilerIfNecessary(project)
|
||||
})
|
||||
|
||||
+20
-6
@@ -18,6 +18,8 @@ package org.jetbrains.kotlin.idea.configuration.ui
|
||||
|
||||
import com.intellij.notification.NotificationDisplayType
|
||||
import com.intellij.notification.NotificationsConfiguration
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.ModalityState
|
||||
import com.intellij.openapi.application.ReadAction.nonBlocking
|
||||
import com.intellij.openapi.application.runReadAction
|
||||
import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataImportListener
|
||||
@@ -28,6 +30,9 @@ import org.jetbrains.kotlin.idea.configuration.getModulesWithKotlinFiles
|
||||
import org.jetbrains.kotlin.idea.configuration.notifyOutdatedBundledCompilerIfNecessary
|
||||
import org.jetbrains.kotlin.idea.configuration.ui.notifications.notifyKotlinStyleUpdateIfNeeded
|
||||
import org.jetbrains.kotlin.idea.project.getAndCacheLanguageLevelByDependencies
|
||||
import org.jetbrains.kotlin.idea.util.ProgressIndicatorUtils
|
||||
import org.jetbrains.kotlin.idea.util.application.isUnitTestMode
|
||||
import java.util.concurrent.Callable
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
class KotlinConfigurationCheckerStartupActivity : StartupActivity {
|
||||
@@ -53,15 +58,24 @@ class KotlinConfigurationCheckerService(val project: Project) {
|
||||
private val syncDepth = AtomicInteger()
|
||||
|
||||
fun performProjectPostOpenActions() {
|
||||
nonBlocking {
|
||||
val modulesWithKotlinFiles = getModulesWithKotlinFiles(project)
|
||||
for (module in modulesWithKotlinFiles) {
|
||||
module.getAndCacheLanguageLevelByDependencies()
|
||||
}
|
||||
}
|
||||
nonBlocking(Callable {
|
||||
return@Callable getModulesWithKotlinFiles(project)
|
||||
})
|
||||
.inSmartMode(project)
|
||||
.expireWith(project)
|
||||
.coalesceBy(this)
|
||||
.finishOnUiThread(ModalityState.any()) { modulesWithKotlinFiles ->
|
||||
val promise = ApplicationManager.getApplication().executeOnPooledThread {
|
||||
for (module in modulesWithKotlinFiles) {
|
||||
runReadAction {
|
||||
module.getAndCacheLanguageLevelByDependencies()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isUnitTestMode()) {
|
||||
ProgressIndicatorUtils.awaitWithCheckCanceled(promise)
|
||||
}
|
||||
}
|
||||
.submit(AppExecutorUtil.getAppExecutorService())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user