Wizard: get rid of reflection: specify plugin path by hand
This commit is contained in:
committed by
Kirill Shmakov
parent
3ed11c0491
commit
cc35529b9a
+1
-2
@@ -29,8 +29,7 @@ abstract class Plugin(override val context: Context) : EntityBase(),
|
|||||||
): ReadOnlyProperty<Any, PluginSetting<V, T>> = context.pluginSettingDelegate(create)
|
): ReadOnlyProperty<Any, PluginSetting<V, T>> = context.pluginSettingDelegate(create)
|
||||||
|
|
||||||
val reference = this::class
|
val reference = this::class
|
||||||
override val path = reference.path
|
abstract override val path: String
|
||||||
open val title: String = reference.name
|
|
||||||
|
|
||||||
abstract val settings: List<PluginSetting<*, *>>
|
abstract val settings: List<PluginSetting<*, *>>
|
||||||
abstract val pipelineTasks: List<PipelineTask>
|
abstract val pipelineTasks: List<PipelineTask>
|
||||||
|
|||||||
+2
@@ -22,6 +22,8 @@ import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.KotlinPlugin
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.withAllSubModules
|
import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.withAllSubModules
|
||||||
|
|
||||||
class AndroidPlugin(context: Context) : Plugin(context) {
|
class AndroidPlugin(context: Context) : Plugin(context) {
|
||||||
|
override val path = "android"
|
||||||
|
|
||||||
val androidSdkPath by pathSetting(
|
val androidSdkPath by pathSetting(
|
||||||
KotlinNewProjectWizardBundle.message("plugin.android.setting.sdk"),
|
KotlinNewProjectWizardBundle.message("plugin.android.setting.sdk"),
|
||||||
neededAtPhase = GenerationPhase.PROJECT_GENERATION
|
neededAtPhase = GenerationPhase.PROJECT_GENERATION
|
||||||
|
|||||||
+2
@@ -16,6 +16,8 @@ import org.jetbrains.kotlin.tools.projectWizard.phases.GenerationPhase
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemPlugin
|
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemPlugin
|
||||||
|
|
||||||
class RunConfigurationsPlugin(context: Context) : Plugin(context) {
|
class RunConfigurationsPlugin(context: Context) : Plugin(context) {
|
||||||
|
override val path = "runConfigurations"
|
||||||
|
|
||||||
val configurations by listProperty<WizardRunConfiguration>()
|
val configurations by listProperty<WizardRunConfiguration>()
|
||||||
|
|
||||||
val createRunConfigurationsTask by pipelineTask(GenerationPhase.PROJECT_IMPORT) {
|
val createRunConfigurationsTask by pipelineTask(GenerationPhase.PROJECT_IMPORT) {
|
||||||
|
|||||||
+2
@@ -17,6 +17,8 @@ import java.nio.file.Files
|
|||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
|
|
||||||
class StructurePlugin(context: Context) : Plugin(context) {
|
class StructurePlugin(context: Context) : Plugin(context) {
|
||||||
|
override val path = "structure"
|
||||||
|
|
||||||
val projectPath by pathSetting(
|
val projectPath by pathSetting(
|
||||||
KotlinNewProjectWizardBundle.message("plugin.structure.setting.location"),
|
KotlinNewProjectWizardBundle.message("plugin.structure.setting.location"),
|
||||||
GenerationPhase.FIRST_STEP
|
GenerationPhase.FIRST_STEP
|
||||||
|
|||||||
+2
@@ -27,6 +27,8 @@ import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Repository
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.updateBuildFiles
|
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.updateBuildFiles
|
||||||
|
|
||||||
abstract class BuildSystemPlugin(context: Context) : Plugin(context) {
|
abstract class BuildSystemPlugin(context: Context) : Plugin(context) {
|
||||||
|
override val path = "buildSystem"
|
||||||
|
|
||||||
val type by enumSetting<BuildSystemType>(
|
val type by enumSetting<BuildSystemType>(
|
||||||
KotlinNewProjectWizardBundle.message("plugin.buildsystem.setting.type"),
|
KotlinNewProjectWizardBundle.message("plugin.buildsystem.setting.type"),
|
||||||
GenerationPhase.FIRST_STEP
|
GenerationPhase.FIRST_STEP
|
||||||
|
|||||||
+2
@@ -3,6 +3,8 @@ package org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.core.Context
|
import org.jetbrains.kotlin.tools.projectWizard.core.Context
|
||||||
|
|
||||||
class JpsPlugin(context: Context) : BuildSystemPlugin(context) {
|
class JpsPlugin(context: Context) : BuildSystemPlugin(context) {
|
||||||
|
override val path = "buildSystem.jps"
|
||||||
|
|
||||||
val addBuildSystemData by addBuildSystemData(
|
val addBuildSystemData by addBuildSystemData(
|
||||||
BuildSystemData(
|
BuildSystemData(
|
||||||
type = BuildSystemType.Jps,
|
type = BuildSystemType.Jps,
|
||||||
|
|||||||
+2
@@ -14,6 +14,8 @@ import org.jetbrains.kotlin.tools.projectWizard.plugins.printer.MavenPrinter
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.updateBuildFiles
|
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.updateBuildFiles
|
||||||
|
|
||||||
class MavenPlugin(context: Context) : BuildSystemPlugin(context) {
|
class MavenPlugin(context: Context) : BuildSystemPlugin(context) {
|
||||||
|
override val path = "buildSystem.maven"
|
||||||
|
|
||||||
private val isMaven = checker {
|
private val isMaven = checker {
|
||||||
BuildSystemPlugin::type.settingValue == BuildSystemType.Maven
|
BuildSystemPlugin::type.settingValue == BuildSystemType.Maven
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -27,6 +27,8 @@ import org.jetbrains.kotlin.tools.projectWizard.templates.FileTemplateDescriptor
|
|||||||
|
|
||||||
|
|
||||||
abstract class GradlePlugin(context: Context) : BuildSystemPlugin(context) {
|
abstract class GradlePlugin(context: Context) : BuildSystemPlugin(context) {
|
||||||
|
override val path = "buildSystem.gradle"
|
||||||
|
|
||||||
val gradleProperties by listProperty(
|
val gradleProperties by listProperty(
|
||||||
"kotlin.code.style" to "official"
|
"kotlin.code.style" to "official"
|
||||||
)
|
)
|
||||||
|
|||||||
+2
@@ -8,6 +8,8 @@ import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemT
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.printer.GradlePrinter
|
import org.jetbrains.kotlin.tools.projectWizard.plugins.printer.GradlePrinter
|
||||||
|
|
||||||
class GroovyDslPlugin(context: Context) : GradlePlugin(context) {
|
class GroovyDslPlugin(context: Context) : GradlePlugin(context) {
|
||||||
|
override val path = "buildSystem.gradle.groovyDsl"
|
||||||
|
|
||||||
val addBuildSystemData by addBuildSystemData(
|
val addBuildSystemData by addBuildSystemData(
|
||||||
BuildSystemData(
|
BuildSystemData(
|
||||||
type = BuildSystemType.GradleGroovyDsl,
|
type = BuildSystemType.GradleGroovyDsl,
|
||||||
|
|||||||
+2
@@ -8,6 +8,8 @@ import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemT
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.printer.GradlePrinter
|
import org.jetbrains.kotlin.tools.projectWizard.plugins.printer.GradlePrinter
|
||||||
|
|
||||||
class KotlinDslPlugin(context: Context) : GradlePlugin(context) {
|
class KotlinDslPlugin(context: Context) : GradlePlugin(context) {
|
||||||
|
override val path = "buildSystem.gradle.kotlinDsl"
|
||||||
|
|
||||||
val addBuildSystemData by addBuildSystemData(
|
val addBuildSystemData by addBuildSystemData(
|
||||||
BuildSystemData(
|
BuildSystemData(
|
||||||
type = BuildSystemType.GradleKotlinDsl,
|
type = BuildSystemType.GradleKotlinDsl,
|
||||||
|
|||||||
+2
@@ -25,6 +25,8 @@ import org.jetbrains.kotlin.tools.projectWizard.settings.version.Version
|
|||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
|
||||||
class KotlinPlugin(context: Context) : Plugin(context) {
|
class KotlinPlugin(context: Context) : Plugin(context) {
|
||||||
|
override val path = "kotlin"
|
||||||
|
|
||||||
val version by property(
|
val version by property(
|
||||||
// todo do not hardcode kind & repository
|
// todo do not hardcode kind & repository
|
||||||
WizardKotlinVersion(Versions.KOTLIN, KotlinVersionKind.M, Repositories.KOTLIN_EAP_BINTRAY)
|
WizardKotlinVersion(Versions.KOTLIN, KotlinVersionKind.M, Repositories.KOTLIN_EAP_BINTRAY)
|
||||||
|
|||||||
+2
@@ -11,6 +11,8 @@ import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.withAllSubModules
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.projectTemplates.ProjectTemplate
|
import org.jetbrains.kotlin.tools.projectWizard.projectTemplates.ProjectTemplate
|
||||||
|
|
||||||
class ProjectTemplatesPlugin(context: Context) : Plugin(context) {
|
class ProjectTemplatesPlugin(context: Context) : Plugin(context) {
|
||||||
|
override val path = "projectTemplates"
|
||||||
|
|
||||||
val template by dropDownSetting<ProjectTemplate>(
|
val template by dropDownSetting<ProjectTemplate>(
|
||||||
KotlinNewProjectWizardBundle.message("plugin.templates.setting.template"),
|
KotlinNewProjectWizardBundle.message("plugin.templates.setting.template"),
|
||||||
GenerationPhase.INIT_TEMPLATE,
|
GenerationPhase.INIT_TEMPLATE,
|
||||||
|
|||||||
+2
@@ -4,6 +4,8 @@ import org.jetbrains.kotlin.tools.projectWizard.core.Context
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.templates.ConsoleJvmApplicationTemplate
|
import org.jetbrains.kotlin.tools.projectWizard.templates.ConsoleJvmApplicationTemplate
|
||||||
|
|
||||||
class ConsoleJvmApplicationTemplatePlugin(context: Context) : TemplatePlugin(context) {
|
class ConsoleJvmApplicationTemplatePlugin(context: Context) : TemplatePlugin(context) {
|
||||||
|
override val path = "template.consoleJvmApplicationTemplate"
|
||||||
|
|
||||||
val addTemplate by addTemplateTask(
|
val addTemplate by addTemplateTask(
|
||||||
ConsoleJvmApplicationTemplate()
|
ConsoleJvmApplicationTemplate()
|
||||||
)
|
)
|
||||||
|
|||||||
+2
@@ -5,6 +5,8 @@ import org.jetbrains.kotlin.tools.projectWizard.core.entity.PipelineTask
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.templates.SimpleJsClientTemplate
|
import org.jetbrains.kotlin.tools.projectWizard.templates.SimpleJsClientTemplate
|
||||||
|
|
||||||
class JsTemplatesPlugin(context: Context) : TemplatePlugin(context) {
|
class JsTemplatesPlugin(context: Context) : TemplatePlugin(context) {
|
||||||
|
override val path = "template.jsTemplate"
|
||||||
|
|
||||||
val addTemplate by addTemplateTask(SimpleJsClientTemplate())
|
val addTemplate by addTemplateTask(SimpleJsClientTemplate())
|
||||||
|
|
||||||
override val pipelineTasks: List<PipelineTask> = super.pipelineTasks +
|
override val pipelineTasks: List<PipelineTask> = super.pipelineTasks +
|
||||||
|
|||||||
+2
@@ -8,6 +8,8 @@ import org.jetbrains.kotlin.tools.projectWizard.phases.GenerationPhase
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.templates.Template
|
import org.jetbrains.kotlin.tools.projectWizard.templates.Template
|
||||||
|
|
||||||
abstract class TemplatePlugin(context: Context) : Plugin(context) {
|
abstract class TemplatePlugin(context: Context) : Plugin(context) {
|
||||||
|
override val path = "template"
|
||||||
|
|
||||||
fun addTemplateTask(template: Template) = pipelineTask(GenerationPhase.PREPARE) {
|
fun addTemplateTask(template: Template) = pipelineTask(GenerationPhase.PREPARE) {
|
||||||
withAction {
|
withAction {
|
||||||
TemplatesPlugin::addTemplate.execute(template)
|
TemplatesPlugin::addTemplate.execute(template)
|
||||||
|
|||||||
+2
@@ -23,6 +23,8 @@ import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.settingValue
|
|||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
|
||||||
class TemplatesPlugin(context: Context) : Plugin(context) {
|
class TemplatesPlugin(context: Context) : Plugin(context) {
|
||||||
|
override val path = "templates"
|
||||||
|
|
||||||
val templates by property<Map<String, Template>>(
|
val templates by property<Map<String, Template>>(
|
||||||
emptyMap()
|
emptyMap()
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user