diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt
index a4b6cbb3d220c..8ab96c3aaa68d 100644
--- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt
+++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinGradleAppEnvProvider.kt
@@ -33,6 +33,7 @@ import com.intellij.openapi.projectRoots.ex.JavaSdkUtil
import com.intellij.openapi.roots.ModuleRootManager
import com.intellij.openapi.roots.ProjectFileIndex
import com.intellij.openapi.util.io.FileUtil
+import com.intellij.openapi.util.registry.Registry
import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.PsiClass
import com.intellij.psi.PsiJavaModule
@@ -50,7 +51,10 @@ import org.jetbrains.plugins.gradle.util.GradleConstants
*/
class KotlinGradleAppEnvProvider : GradleExecutionEnvironmentProvider {
- override fun isApplicable(task: ExecuteRunConfigurationTask): Boolean = task.runProfile is KotlinRunConfiguration
+ override fun isApplicable(task: ExecuteRunConfigurationTask): Boolean {
+ val enabled = Registry.`is`("kotlin.gradle-run.enabled", false)
+ return enabled && task.runProfile is KotlinRunConfiguration
+ }
override fun createExecutionEnvironment(
project: Project, executeRunConfigurationTask: ExecuteRunConfigurationTask, executor: Executor?
diff --git a/idea/resources/META-INF/extensions/ide.xml b/idea/resources/META-INF/extensions/ide.xml
index c8bf0deb8fe27..ef26c494b9a1a 100644
--- a/idea/resources/META-INF/extensions/ide.xml
+++ b/idea/resources/META-INF/extensions/ide.xml
@@ -135,6 +135,11 @@
defaultValue="false"
restartRequired="false"/>
+
+