Configuration: Setup project settings even if library is not detected
#KT-22305 Fixed
This commit is contained in:
+7
-7
@@ -73,6 +73,13 @@ abstract class CustomLibraryDescriptorWithDeferredConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun finishLibConfiguration(module: Module, rootModel: ModifiableRootModel) {
|
fun finishLibConfiguration(module: Module, rootModel: ModifiableRootModel) {
|
||||||
|
configureKotlinSettings(module.project, rootModel.sdk)
|
||||||
|
|
||||||
|
KotlinCommonCompilerArgumentsHolder.getInstance(module.project).update {
|
||||||
|
languageVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||||
|
apiVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||||
|
}
|
||||||
|
|
||||||
val library = rootModel.orderEntries().findLibrary { library ->
|
val library = rootModel.orderEntries().findLibrary { library ->
|
||||||
val libraryPresentationManager = LibraryPresentationManager.getInstance()
|
val libraryPresentationManager = LibraryPresentationManager.getInstance()
|
||||||
val classFiles = library.getFiles(OrderRootType.CLASSES).toList()
|
val classFiles = library.getFiles(OrderRootType.CLASSES).toList()
|
||||||
@@ -99,13 +106,6 @@ abstract class CustomLibraryDescriptorWithDeferredConfig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configureKotlinSettings(module.project, rootModel.sdk)
|
|
||||||
|
|
||||||
KotlinCommonCompilerArgumentsHolder.getInstance(module.project).update {
|
|
||||||
languageVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
|
||||||
apiVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
|
||||||
}
|
|
||||||
|
|
||||||
collector.showNotification()
|
collector.showNotification()
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.idea.configuration.BuildSystemType
|
|||||||
import org.jetbrains.kotlin.idea.configuration.getBuildSystemType
|
import org.jetbrains.kotlin.idea.configuration.getBuildSystemType
|
||||||
import javax.swing.JComponent
|
import javax.swing.JComponent
|
||||||
|
|
||||||
internal class JavaFrameworkSupportProvider : FrameworkSupportInModuleProvider() {
|
class JavaFrameworkSupportProvider : FrameworkSupportInModuleProvider() {
|
||||||
override fun getFrameworkType(): FrameworkTypeEx = JavaFrameworkType.instance
|
override fun getFrameworkType(): FrameworkTypeEx = JavaFrameworkType.instance
|
||||||
|
|
||||||
override fun createConfigurable(model: FrameworkSupportModel): FrameworkSupportInModuleConfigurable {
|
override fun createConfigurable(model: FrameworkSupportModel): FrameworkSupportInModuleConfigurable {
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. 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.configuration
|
||||||
|
|
||||||
|
import com.intellij.framework.addSupport.FrameworkSupportInModuleProvider
|
||||||
|
import com.intellij.ide.util.frameworkSupport.FrameworkSupportProviderTestCase
|
||||||
|
import junit.framework.TestCase
|
||||||
|
import org.jetbrains.kotlin.config.LanguageVersion
|
||||||
|
import org.jetbrains.kotlin.config.VersionView
|
||||||
|
import org.jetbrains.kotlin.config.apiVersionView
|
||||||
|
import org.jetbrains.kotlin.config.languageVersionView
|
||||||
|
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder
|
||||||
|
import org.jetbrains.kotlin.idea.framework.JSFrameworkSupportProvider
|
||||||
|
import org.jetbrains.kotlin.idea.framework.JavaFrameworkSupportProvider
|
||||||
|
|
||||||
|
class KotlinFrameworkSupportProviderTest : FrameworkSupportProviderTestCase() {
|
||||||
|
private fun doTest(provider: FrameworkSupportInModuleProvider) {
|
||||||
|
selectFramework(provider).createLibraryDescription()
|
||||||
|
addSupport()
|
||||||
|
|
||||||
|
with (KotlinCommonCompilerArgumentsHolder.getInstance(module.project).settings) {
|
||||||
|
TestCase.assertEquals(VersionView.Specific(LanguageVersion.LATEST_STABLE), languageVersionView)
|
||||||
|
TestCase.assertEquals(VersionView.Specific(LanguageVersion.LATEST_STABLE), apiVersionView)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testJvm() = doTest(JavaFrameworkSupportProvider())
|
||||||
|
|
||||||
|
fun testJs() = doTest(JSFrameworkSupportProvider())
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user