Don't create multiple copies of KotlinJavaRuntime for multiple modules

#KT-17259 Fixed
This commit is contained in:
Dmitry Jemerov
2017-04-06 19:10:45 +02:00
parent 1488b21143
commit 5ef2b39804
@@ -23,7 +23,6 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.* import com.intellij.openapi.roots.*
import com.intellij.openapi.roots.libraries.Library import com.intellij.openapi.roots.libraries.Library
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.vfs.JarFileSystem import com.intellij.openapi.vfs.JarFileSystem
import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VfsUtil import com.intellij.openapi.vfs.VfsUtil
@@ -93,12 +92,9 @@ abstract class KotlinWithLibraryConfigurator internal constructor() : KotlinProj
copyLibraryIntoPath = dialog.copyIntoPath copyLibraryIntoPath = dialog.copyIntoPath
} }
val finalModulesToConfigure = modulesToConfigure
val finalCopyLibraryIntoPath = copyLibraryIntoPath
val collector = createConfigureKotlinNotificationCollector(project) val collector = createConfigureKotlinNotificationCollector(project)
for (module in finalModulesToConfigure) { for (module in modulesToConfigure) {
configureModuleWithLibrary(module, defaultPathToJar, finalCopyLibraryIntoPath, collector) configureModuleWithLibrary(module, defaultPathToJar, copyLibraryIntoPath, collector)
} }
collector.showNotification() collector.showNotification()
@@ -112,7 +108,9 @@ abstract class KotlinWithLibraryConfigurator internal constructor() : KotlinProj
) { ) {
val project = module.project val project = module.project
val library = getKotlinLibrary(module) ?: createNewLibrary(project, collector) val library = getKotlinLibrary(module)
?: getKotlinLibrary(project)
?: createNewLibrary(project, collector)
for (descriptor in libraryJarDescriptors) { for (descriptor in libraryJarDescriptors) {
val dirToCopyJar = getPathToCopyFileTo(project, descriptor.orderRootType, defaultPath, pathFromDialog) val dirToCopyJar = getPathToCopyFileTo(project, descriptor.orderRootType, defaultPath, pathFromDialog)
@@ -240,10 +238,6 @@ abstract class KotlinWithLibraryConfigurator internal constructor() : KotlinProj
return FileUIUtils.createRelativePath(project, project.baseDir, DEFAULT_LIBRARY_DIR) return FileUIUtils.createRelativePath(project, project.baseDir, DEFAULT_LIBRARY_DIR)
} }
protected fun showError(message: String) {
Messages.showErrorDialog(message, messageForOverrideDialog)
}
enum class FileState { enum class FileState {
EXISTS, EXISTS,
COPY, COPY,