mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
[kotlin] Limit new Gradle Kotlin templates to only be generated with Gradle 8.2+
^KTIJ-31697 fixed (cherry picked from commit fe6493d804e6abed224e899d867b1bf2877384c7) IJ-CR-147989 GitOrigin-RevId: 30ab7a5e2e61f04c2117813a91a5e0d7426e2592
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7d2f0086c2
commit
6df603988a
@@ -85,7 +85,7 @@ abstract class GradleNewProjectWizardStep<ParentStep>(parent: ParentStep) :
|
||||
final override var gradleDsl by gradleDslProperty
|
||||
|
||||
private val distributionTypeProperty = propertyGraph.lazyProperty { suggestDistributionType() }
|
||||
private val gradleVersionProperty = propertyGraph.lazyProperty { suggestGradleVersion() }
|
||||
protected val gradleVersionProperty = propertyGraph.lazyProperty { suggestGradleVersion() }
|
||||
private val gradleVersionsProperty = propertyGraph.lazyProperty { suggestGradleVersions() }
|
||||
private val autoSelectGradleVersionProperty = propertyGraph.lazyProperty { suggestAutoSelectGradleVersion() }
|
||||
private val gradleHomeProperty = propertyGraph.lazyProperty { suggestGradleHome() }
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.intellij.ide.wizard.NewProjectWizardStep.Companion.ADD_SAMPLE_CODE_PR
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.command.CommandProcessor
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
|
||||
import com.intellij.openapi.observable.util.and
|
||||
import com.intellij.openapi.observable.util.bindBooleanStorage
|
||||
import com.intellij.openapi.observable.util.equalsTo
|
||||
import com.intellij.openapi.project.Project
|
||||
@@ -66,6 +67,8 @@ import org.jetbrains.plugins.gradle.util.GradleConstants.KOTLIN_DSL_SETTINGS_FIL
|
||||
|
||||
private const val GENERATE_SINGLE_MODULE_PROPERTY_NAME: String = "NewProjectWizard.generateSingleModule"
|
||||
|
||||
private val MIN_GRADLE_VERSION_BUILD_SRC = GradleVersion.version("8.2")
|
||||
|
||||
private class GradleKotlinModuleBuilder : AbstractGradleModuleBuilder()
|
||||
|
||||
internal class GradleKotlinNewProjectWizard : BuildSystemKotlinNewProjectWizard {
|
||||
@@ -102,8 +105,17 @@ internal class GradleKotlinNewProjectWizard : BuildSystemKotlinNewProjectWizard
|
||||
|
||||
override var generateSingleModule by generateSingleModuleProperty
|
||||
|
||||
private val gradleVersionSupportsConventionPlugins = propertyGraph.property(false)
|
||||
init {
|
||||
propertyGraph.dependsOn(gradleVersionSupportsConventionPlugins, gradleVersionProperty) {
|
||||
val selectedGradleVersion = runCatching { GradleVersion.version(gradleVersion) }.getOrNull() ?: return@dependsOn false
|
||||
selectedGradleVersion >= MIN_GRADLE_VERSION_BUILD_SRC
|
||||
}
|
||||
}
|
||||
|
||||
internal val shouldGenerateMultipleModules
|
||||
get() = !generateSingleModule && gradleDsl == GradleDsl.KOTLIN && context.isCreatingNewProject
|
||||
get() = !generateSingleModule && gradleDsl == GradleDsl.KOTLIN && context.isCreatingNewProject &&
|
||||
gradleVersionSupportsConventionPlugins.get()
|
||||
|
||||
private fun setupSampleCodeUI(builder: Panel) {
|
||||
builder.row {
|
||||
@@ -134,7 +146,7 @@ internal class GradleKotlinNewProjectWizard : BuildSystemKotlinNewProjectWizard
|
||||
.onApply { logGenerateSingleModuleBuildFinished(generateSingleModule) }
|
||||
|
||||
contextHelp(KotlinNewProjectWizardUIBundle.message("tooltip.project.wizard.new.project.generate.single.module"))
|
||||
}.visibleIf(gradleDslProperty.equalsTo(GradleDsl.KOTLIN))
|
||||
}.visibleIf(gradleDslProperty.equalsTo(GradleDsl.KOTLIN).and(gradleVersionSupportsConventionPlugins))
|
||||
}
|
||||
|
||||
override fun setupSettingsUI(builder: Panel) {
|
||||
|
||||
Reference in New Issue
Block a user