[Gradle, JS] Divide allowSinglePlatform
^KT-40527 fixed
This commit is contained in:
+8
-7
@@ -18,7 +18,8 @@ import javax.swing.Icon
|
|||||||
class CreateModuleOrTargetPopup private constructor(
|
class CreateModuleOrTargetPopup private constructor(
|
||||||
private val target: Module?,
|
private val target: Module?,
|
||||||
private val allowMultiplatform: Boolean,
|
private val allowMultiplatform: Boolean,
|
||||||
private val allowSinglePlatformJs: Boolean,
|
private val allowSinglePlatformJsBrowser: Boolean,
|
||||||
|
private val allowSinglePlatformJsNode: Boolean,
|
||||||
private val allowAndroid: Boolean,
|
private val allowAndroid: Boolean,
|
||||||
private val allowIos: Boolean,
|
private val allowIos: Boolean,
|
||||||
private val createTarget: (TargetConfigurator) -> Unit,
|
private val createTarget: (TargetConfigurator) -> Unit,
|
||||||
@@ -42,10 +43,8 @@ class CreateModuleOrTargetPopup private constructor(
|
|||||||
if (allowMultiplatform) +MppModuleConfigurator
|
if (allowMultiplatform) +MppModuleConfigurator
|
||||||
+JvmSinglePlatformModuleConfigurator
|
+JvmSinglePlatformModuleConfigurator
|
||||||
if (allowAndroid) +AndroidSinglePlatformModuleConfigurator
|
if (allowAndroid) +AndroidSinglePlatformModuleConfigurator
|
||||||
if (allowSinglePlatformJs) {
|
if (allowSinglePlatformJsBrowser) +BrowserJsSinglePlatformModuleConfigurator
|
||||||
+BrowserJsSinglePlatformModuleConfigurator
|
if (allowSinglePlatformJsNode) +NodeJsSinglePlatformModuleConfigurator
|
||||||
+NodeJsSinglePlatformModuleConfigurator
|
|
||||||
}
|
|
||||||
if (allowIos) +IOSSinglePlatformModuleConfigurator
|
if (allowIos) +IOSSinglePlatformModuleConfigurator
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
@@ -108,7 +107,8 @@ class CreateModuleOrTargetPopup private constructor(
|
|||||||
fun create(
|
fun create(
|
||||||
target: Module?,
|
target: Module?,
|
||||||
allowMultiplatform: Boolean,
|
allowMultiplatform: Boolean,
|
||||||
allowSinglePlatformJs: Boolean,
|
allowSinglePlatformJsBrowser: Boolean,
|
||||||
|
allowSinglePlatformJsNode: Boolean,
|
||||||
allowAndroid: Boolean,
|
allowAndroid: Boolean,
|
||||||
allowIos: Boolean,
|
allowIos: Boolean,
|
||||||
createTarget: (TargetConfigurator) -> Unit,
|
createTarget: (TargetConfigurator) -> Unit,
|
||||||
@@ -116,7 +116,8 @@ class CreateModuleOrTargetPopup private constructor(
|
|||||||
) = CreateModuleOrTargetPopup(
|
) = CreateModuleOrTargetPopup(
|
||||||
target = target,
|
target = target,
|
||||||
allowMultiplatform = allowMultiplatform,
|
allowMultiplatform = allowMultiplatform,
|
||||||
allowSinglePlatformJs = allowSinglePlatformJs,
|
allowSinglePlatformJsBrowser = allowSinglePlatformJsBrowser,
|
||||||
|
allowSinglePlatformJsNode = allowSinglePlatformJsNode,
|
||||||
allowAndroid = allowAndroid,
|
allowAndroid = allowAndroid,
|
||||||
allowIos = allowIos,
|
allowIos = allowIos,
|
||||||
createTarget = createTarget,
|
createTarget = createTarget,
|
||||||
|
|||||||
+2
-1
@@ -37,7 +37,8 @@ class ModulesEditorComponent(
|
|||||||
moduleCreator.create(
|
moduleCreator.create(
|
||||||
target = null, // The empty tree case
|
target = null, // The empty tree case
|
||||||
allowMultiplatform = isMppProject,
|
allowMultiplatform = isMppProject,
|
||||||
allowSinglePlatformJs = isMppProject,
|
allowSinglePlatformJsBrowser = isMppProject,
|
||||||
|
allowSinglePlatformJsNode = isMppProject,
|
||||||
allowAndroid = isMppProject,
|
allowAndroid = isMppProject,
|
||||||
allowIos = isMppProject,
|
allowIos = isMppProject,
|
||||||
allModules = value ?: emptyList(),
|
allModules = value ?: emptyList(),
|
||||||
|
|||||||
+20
-7
@@ -5,10 +5,7 @@ import com.intellij.openapi.actionSystem.ActionToolbarPosition
|
|||||||
import com.intellij.openapi.ui.Messages
|
import com.intellij.openapi.ui.Messages
|
||||||
import com.intellij.ui.ToolbarDecorator
|
import com.intellij.ui.ToolbarDecorator
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.KotlinNewProjectWizardBundle
|
import org.jetbrains.kotlin.tools.projectWizard.KotlinNewProjectWizardBundle
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.AndroidSinglePlatformModuleConfigurator
|
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.*
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.IOSSinglePlatformModuleConfigurator
|
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.BrowserJsSinglePlatformModuleConfigurator
|
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.MppModuleConfigurator
|
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.withAllSubModules
|
import org.jetbrains.kotlin.tools.projectWizard.plugins.kotlin.withAllSubModules
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Module
|
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.Module
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.ModuleKind
|
import org.jetbrains.kotlin.tools.projectWizard.settings.buildsystem.ModuleKind
|
||||||
@@ -36,9 +33,16 @@ class ModulesEditorToolbarDecorator(
|
|||||||
allowMultiplatform = isMultiplatformProject()
|
allowMultiplatform = isMultiplatformProject()
|
||||||
&& isRootModule
|
&& isRootModule
|
||||||
&& allModules.none { it.configurator == MppModuleConfigurator },
|
&& allModules.none { it.configurator == MppModuleConfigurator },
|
||||||
allowSinglePlatformJs = isMultiplatformProject()
|
allowSinglePlatformJsBrowser = allowSinglePlatformJs(
|
||||||
&& isRootModule
|
configurator = BrowserJsSinglePlatformModuleConfigurator,
|
||||||
&& allModules.none { it.configurator == BrowserJsSinglePlatformModuleConfigurator },
|
allModules = allModules,
|
||||||
|
isRootModule = isRootModule
|
||||||
|
),
|
||||||
|
allowSinglePlatformJsNode = allowSinglePlatformJs(
|
||||||
|
configurator = NodeJsSinglePlatformModuleConfigurator,
|
||||||
|
allModules = allModules,
|
||||||
|
isRootModule = isRootModule
|
||||||
|
),
|
||||||
allowAndroid = isRootModule
|
allowAndroid = isRootModule
|
||||||
&& isMultiplatformProject()
|
&& isMultiplatformProject()
|
||||||
&& allModules.none { it.configurator == AndroidSinglePlatformModuleConfigurator },
|
&& allModules.none { it.configurator == AndroidSinglePlatformModuleConfigurator },
|
||||||
@@ -108,6 +112,15 @@ class ModulesEditorToolbarDecorator(
|
|||||||
setMoveUpAction(null)
|
setMoveUpAction(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun allowSinglePlatformJs(
|
||||||
|
configurator: JsSinglePlatformModuleConfigurator,
|
||||||
|
allModules: List<Module>,
|
||||||
|
isRootModule: Boolean
|
||||||
|
) =
|
||||||
|
isMultiplatformProject()
|
||||||
|
&& isRootModule
|
||||||
|
&& allModules.none { it.configurator == configurator }
|
||||||
|
|
||||||
private val selectedModule
|
private val selectedModule
|
||||||
get() = tree.selectedSettingItem.safeAs<Module>()
|
get() = tree.selectedSettingItem.safeAs<Module>()
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -35,7 +35,8 @@ class NewModuleCreator {
|
|||||||
fun create(
|
fun create(
|
||||||
target: Module?,
|
target: Module?,
|
||||||
allowMultiplatform: Boolean,
|
allowMultiplatform: Boolean,
|
||||||
allowSinglePlatformJs: Boolean,
|
allowSinglePlatformJsBrowser: Boolean,
|
||||||
|
allowSinglePlatformJsNode: Boolean,
|
||||||
allowAndroid: Boolean,
|
allowAndroid: Boolean,
|
||||||
allowIos: Boolean,
|
allowIos: Boolean,
|
||||||
allModules: List<Module>,
|
allModules: List<Module>,
|
||||||
@@ -43,7 +44,8 @@ class NewModuleCreator {
|
|||||||
) = CreateModuleOrTargetPopup.create(
|
) = CreateModuleOrTargetPopup.create(
|
||||||
target = target,
|
target = target,
|
||||||
allowMultiplatform = allowMultiplatform,
|
allowMultiplatform = allowMultiplatform,
|
||||||
allowSinglePlatformJs = allowSinglePlatformJs,
|
allowSinglePlatformJsBrowser = allowSinglePlatformJsBrowser,
|
||||||
|
allowSinglePlatformJsNode = allowSinglePlatformJsNode,
|
||||||
allowAndroid = allowAndroid,
|
allowAndroid = allowAndroid,
|
||||||
allowIos = allowIos,
|
allowIos = allowIos,
|
||||||
createTarget = { targetConfigurator ->
|
createTarget = { targetConfigurator ->
|
||||||
|
|||||||
+1
-1
@@ -90,7 +90,7 @@ enum class JsTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class JsSinglePlatformModuleConfigurator(
|
abstract class JsSinglePlatformModuleConfigurator(
|
||||||
private val jsTarget: JsTarget
|
jsTarget: JsTarget
|
||||||
) : JSConfigurator, ModuleConfiguratorWithTests, SinglePlatformModuleConfigurator,
|
) : JSConfigurator, ModuleConfiguratorWithTests, SinglePlatformModuleConfigurator,
|
||||||
ModuleConfiguratorWithSettings {
|
ModuleConfiguratorWithSettings {
|
||||||
override fun getConfiguratorSettings(): List<ModuleConfiguratorSetting<*, *>> =
|
override fun getConfiguratorSettings(): List<ModuleConfiguratorSetting<*, *>> =
|
||||||
|
|||||||
Reference in New Issue
Block a user