Configuration: Use specific language/API version only for new projects
#KT-25640 Fixed
This commit is contained in:
-5
@@ -99,11 +99,6 @@ abstract class KotlinWithLibraryConfigurator internal constructor() : KotlinProj
|
||||
|
||||
configureKotlinSettings(modulesToConfigure)
|
||||
|
||||
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
||||
languageVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||
apiVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||
}
|
||||
|
||||
collector.showNotification()
|
||||
}
|
||||
|
||||
|
||||
+10
-4
@@ -72,12 +72,18 @@ abstract class CustomLibraryDescriptorWithDeferredConfig
|
||||
return suitableLibraryKinds
|
||||
}
|
||||
|
||||
fun finishLibConfiguration(module: Module, rootModel: ModifiableRootModel) {
|
||||
fun finishLibConfiguration(
|
||||
module: Module,
|
||||
rootModel: ModifiableRootModel,
|
||||
isNewProject: Boolean
|
||||
) {
|
||||
configureKotlinSettings(module.project, rootModel.sdk)
|
||||
|
||||
KotlinCommonCompilerArgumentsHolder.getInstance(module.project).update {
|
||||
languageVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||
apiVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||
if (isNewProject) {
|
||||
KotlinCommonCompilerArgumentsHolder.getInstance(module.project).update {
|
||||
languageVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||
apiVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||
}
|
||||
}
|
||||
|
||||
val library = rootModel.orderEntries().findLibrary { library ->
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ class JavaFrameworkSupportProvider : FrameworkSupportInModuleProvider() {
|
||||
JSLibraryStdDescription.SUITABLE_LIBRARY_KINDS,
|
||||
"Kotlin/\u200BJS")
|
||||
|
||||
description!!.finishLibConfiguration(module, rootModel)
|
||||
description!!.finishLibConfiguration(module, rootModel, false)
|
||||
}
|
||||
|
||||
override fun onFrameworkSelectionChanged(selected: Boolean) {
|
||||
|
||||
@@ -31,16 +31,22 @@ import javax.swing.Icon
|
||||
class KotlinModuleBuilder(
|
||||
val targetPlatform: TargetPlatform, val builderName: String, val builderDescription: String, val icon: Icon
|
||||
) : JavaModuleBuilder() {
|
||||
private var wizardContext: WizardContext? = null
|
||||
|
||||
override fun getBuilderId() = "kotlin.module.builder"
|
||||
override fun getName() = builderName
|
||||
override fun getPresentableName() = builderName
|
||||
override fun getDescription() = builderDescription
|
||||
override fun getNodeIcon() = icon
|
||||
override fun getGroupName() = KotlinTemplatesFactory.KOTLIN_GROUP_NAME
|
||||
override fun createWizardSteps(wizardContext: WizardContext, modulesProvider: ModulesProvider) = ModuleWizardStep.EMPTY_ARRAY
|
||||
|
||||
override fun createWizardSteps(wizardContext: WizardContext, modulesProvider: ModulesProvider): Array<out ModuleWizardStep>? {
|
||||
this.wizardContext = wizardContext
|
||||
return ModuleWizardStep.EMPTY_ARRAY
|
||||
}
|
||||
|
||||
override fun modifySettingsStep(settingsStep: SettingsStep): ModuleWizardStep {
|
||||
return KotlinModuleSettingStep(targetPlatform, this, settingsStep)
|
||||
return KotlinModuleSettingStep(targetPlatform, this, settingsStep, wizardContext)
|
||||
}
|
||||
|
||||
override fun isSuitableSdkType(sdkType: SdkTypeId?) = when (targetPlatform) {
|
||||
|
||||
@@ -20,10 +20,7 @@ import com.intellij.CommonBundle;
|
||||
import com.intellij.facet.impl.ui.libraries.LibraryCompositionSettings;
|
||||
import com.intellij.facet.impl.ui.libraries.LibraryOptionsPanel;
|
||||
import com.intellij.framework.library.FrameworkLibraryVersionFilter;
|
||||
import com.intellij.ide.util.projectWizard.JavaSettingsStep;
|
||||
import com.intellij.ide.util.projectWizard.ModuleBuilder;
|
||||
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
|
||||
import com.intellij.ide.util.projectWizard.SettingsStep;
|
||||
import com.intellij.ide.util.projectWizard.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.JavaModuleType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -64,6 +61,8 @@ public class KotlinModuleSettingStep extends ModuleWizardStep {
|
||||
private final CustomLibraryDescription customLibraryDescription;
|
||||
private final LibrariesContainer librariesContainer;
|
||||
|
||||
private boolean isNewProject;
|
||||
|
||||
private LibraryOptionsPanel libraryOptionsPanel;
|
||||
private JPanel panel;
|
||||
|
||||
@@ -71,7 +70,14 @@ public class KotlinModuleSettingStep extends ModuleWizardStep {
|
||||
|
||||
private final String basePath;
|
||||
|
||||
public KotlinModuleSettingStep(TargetPlatform targetPlatform, ModuleBuilder moduleBuilder, @NotNull SettingsStep settingsStep) {
|
||||
public KotlinModuleSettingStep(
|
||||
TargetPlatform targetPlatform,
|
||||
ModuleBuilder moduleBuilder,
|
||||
@NotNull SettingsStep settingsStep,
|
||||
@Nullable WizardContext wizardContext
|
||||
) {
|
||||
isNewProject = wizardContext != null && wizardContext.isCreatingNewProject();
|
||||
|
||||
if (!(targetPlatform instanceof JvmPlatform)) {
|
||||
KotlinSdkType.Companion.setUpIfNeeded();
|
||||
}
|
||||
@@ -98,7 +104,7 @@ public class KotlinModuleSettingStep extends ModuleWizardStep {
|
||||
libraryCompositionSettings.addLibraries(rootModel, new ArrayList<Library>(), librariesContainer);
|
||||
|
||||
if (customLibraryDescription instanceof CustomLibraryDescriptorWithDeferredConfig) {
|
||||
((CustomLibraryDescriptorWithDeferredConfig) customLibraryDescription).finishLibConfiguration(module, rootModel);
|
||||
((CustomLibraryDescriptorWithDeferredConfig) customLibraryDescription).finishLibConfiguration(module, rootModel, isNewProject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user