diff options
author | Ilya Kirillov <ilya.kirillov@jetbrains.com> | 2020-10-29 11:47:35 +0300 |
---|---|---|
committer | kotlin-ide-monorepo-bot <kotlin-ide-monorepo-bot-no-reply@jetbrains.com> | 2020-11-08 06:33:11 +0000 |
commit | c69cf6c092d9f36b3b46bb932d73218701134404 (patch) | |
tree | f15dd41acb198f2a2988e70a6ee9012952ce829a /project-wizard | |
parent | f4860b5bab8f34f6c4da95b5d4224e4ba4b840c1 (diff) | |
download | intellij-kotlin-c69cf6c092d9f36b3b46bb932d73218701134404.tar.gz |
Wizard: do not allow creating compose projects with gradle groovy
^KT-42983 fixed
Original commit: 21928d8f5125e011f7c31c0a894594cc8962393c
GitOrigin-RevId: 55ba2a05fcbed0f6d2db5026f30ae113338563f8
Diffstat (limited to 'project-wizard')
4 files changed, 32 insertions, 15 deletions
diff --git a/project-wizard/cli/test/org/jetbrains/kotlin/tools/projectWizard/cli/AbstractBuildFileGenerationTest.kt b/project-wizard/cli/test/org/jetbrains/kotlin/tools/projectWizard/cli/AbstractBuildFileGenerationTest.kt index a0bf8b54c111..919e396e7fad 100644 --- a/project-wizard/cli/test/org/jetbrains/kotlin/tools/projectWizard/cli/AbstractBuildFileGenerationTest.kt +++ b/project-wizard/cli/test/org/jetbrains/kotlin/tools/projectWizard/cli/AbstractBuildFileGenerationTest.kt @@ -26,7 +26,7 @@ abstract class AbstractBuildFileGenerationTest : UsefulTestCase() { val buildSystemsToRunFor = listOfNotNull( BuildSystem.GRADLE_KOTLIN_DSL, - BuildSystem.GRADLE_GROOVY_DSL, + if (testParameters.runForGradleGroovy) BuildSystem.GRADLE_GROOVY_DSL else null, if (testParameters.runForMaven) BuildSystem.MAVEN else null ) diff --git a/project-wizard/core/resources/messages/KotlinNewProjectWizardBundle.properties b/project-wizard/core/resources/messages/KotlinNewProjectWizardBundle.properties index b751f2c22920..90203cd278d7 100644 --- a/project-wizard/core/resources/messages/KotlinNewProjectWizardBundle.properties +++ b/project-wizard/core/resources/messages/KotlinNewProjectWizardBundle.properties @@ -40,6 +40,7 @@ project.kind.kotlin.js=Kotlin/JS project.kind.multiplatform=Multiplatform project.kind.singleplatform=JVM project.kind.compose=JetBrains Compose (Experimental) +project.kind.compose.short.name=JetBrains Compose project=Project diff --git a/project-wizard/core/src/org/jetbrains/kotlin/tools/projectWizard/plugins/buildSystem/BuildSystemPlugin.kt b/project-wizard/core/src/org/jetbrains/kotlin/tools/projectWizard/plugins/buildSystem/BuildSystemPlugin.kt index 22ea146b37c6..22484825a224 100644 --- a/project-wizard/core/src/org/jetbrains/kotlin/tools/projectWizard/plugins/buildSystem/BuildSystemPlugin.kt +++ b/project-wizard/core/src/org/jetbrains/kotlin/tools/projectWizard/plugins/buildSystem/BuildSystemPlugin.kt @@ -43,19 +43,17 @@ abstract class BuildSystemPlugin(context: Context) : Plugin(context) { } validate { buildSystemType -> - if (!buildSystemType.isGradle - && KotlinPlugin.projectKind.notRequiredSettingValue != ProjectKind.Singleplatform - ) { - val projectKind = KotlinPlugin.projectKind.notRequiredSettingValue?.text?.capitalize() - ?: KotlinNewProjectWizardBundle.message("project") - ValidationResult.ValidationError( + val projectKind = KotlinPlugin.projectKind.notRequiredSettingValue ?: ProjectKind.Multiplatform + when (buildSystemType) { + in projectKind.supportedBuildSystems -> ValidationResult.OK + else -> ValidationResult.ValidationError( KotlinNewProjectWizardBundle.message( "plugin.buildsystem.setting.type.error.wrong.project.kind", - projectKind, + projectKind.shortName.capitalize(), buildSystemType.fullText ) ) - } else ValidationResult.OK + } } } @@ -171,6 +169,10 @@ enum class BuildSystemType( override val greyText: String? get() = null + + companion object { + val ALL_GRADLE = setOf(GradleKotlinDsl, GradleGroovyDsl) + } } val BuildSystemType.isGradle diff --git a/project-wizard/core/src/org/jetbrains/kotlin/tools/projectWizard/plugins/kotlin/KotlinPlugin.kt b/project-wizard/core/src/org/jetbrains/kotlin/tools/projectWizard/plugins/kotlin/KotlinPlugin.kt index 11ff03ed036a..9915ff5ea539 100644 --- a/project-wizard/core/src/org/jetbrains/kotlin/tools/projectWizard/plugins/kotlin/KotlinPlugin.kt +++ b/project-wizard/core/src/org/jetbrains/kotlin/tools/projectWizard/plugins/kotlin/KotlinPlugin.kt @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.inContextOfM import org.jetbrains.kotlin.tools.projectWizard.phases.GenerationPhase import org.jetbrains.kotlin.tools.projectWizard.plugins.StructurePlugin import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemPlugin +import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemType import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.buildSystemType import org.jetbrains.kotlin.tools.projectWizard.plugins.pomIR import org.jetbrains.kotlin.tools.projectWizard.plugins.projectPath @@ -194,12 +195,25 @@ class KotlinPlugin(context: Context) : Plugin(context) { } -enum class ProjectKind(override val text: String, val message: String? = null) : DisplayableSettingItem { - Singleplatform(KotlinNewProjectWizardBundle.message("project.kind.singleplatform")), - Multiplatform(KotlinNewProjectWizardBundle.message("project.kind.multiplatform")), - Android(KotlinNewProjectWizardBundle.message("project.kind.android")), - Js(KotlinNewProjectWizardBundle.message("project.kind.kotlin.js")), - COMPOSE(KotlinNewProjectWizardBundle.message("project.kind.compose"), message = "uses Kotlin ${Versions.KOTLIN_VERSION_FOR_COMPOSE}") +enum class ProjectKind( + override val text: String, + val supportedBuildSystems: Set<BuildSystemType>, + val shortName: String = text, + val message: String? = null, +) : DisplayableSettingItem { + Singleplatform( + KotlinNewProjectWizardBundle.message("project.kind.singleplatform"), + supportedBuildSystems = BuildSystemType.values().toSet() + ), + Multiplatform(KotlinNewProjectWizardBundle.message("project.kind.multiplatform"), supportedBuildSystems = BuildSystemType.ALL_GRADLE), + Android(KotlinNewProjectWizardBundle.message("project.kind.android"), supportedBuildSystems = BuildSystemType.ALL_GRADLE), + Js(KotlinNewProjectWizardBundle.message("project.kind.kotlin.js"), supportedBuildSystems = BuildSystemType.ALL_GRADLE), + COMPOSE( + KotlinNewProjectWizardBundle.message("project.kind.compose"), + supportedBuildSystems = setOf(BuildSystemType.GradleKotlinDsl), + shortName = KotlinNewProjectWizardBundle.message("project.kind.compose.short.name"), + message = "uses Kotlin ${Versions.KOTLIN_VERSION_FOR_COMPOSE}" + ) } fun List<Module>.withAllSubModules(includeSourcesets: Boolean = false): List<Module> = buildList { |