[Wizard, JS] Change js compiler default
^KT-41656 fixed
This commit is contained in:
+2
-2
@@ -11,12 +11,12 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
kotlin {
|
kotlin {
|
||||||
js('nodeJs') {
|
js('nodeJs', LEGACY) {
|
||||||
nodejs {
|
nodejs {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
js('browser') {
|
js('browser', LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
webpackTask {
|
webpackTask {
|
||||||
|
|||||||
+2
-2
@@ -11,12 +11,12 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
kotlin {
|
kotlin {
|
||||||
js("nodeJs") {
|
js("nodeJs", LEGACY) {
|
||||||
nodejs {
|
nodejs {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
js("browser") {
|
js("browser", LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
webpackTask {
|
webpackTask {
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ kotlin {
|
|||||||
kotlinOptions.jvmTarget = '9'
|
kotlinOptions.jvmTarget = '9'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
js('a') {
|
js('a', LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
webpackTask {
|
webpackTask {
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ kotlin {
|
|||||||
kotlinOptions.jvmTarget = "9"
|
kotlinOptions.jvmTarget = "9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
js("a") {
|
js("a", LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
webpackTask {
|
webpackTask {
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ dependencies {
|
|||||||
testImplementation 'org.jetbrains.kotlin:kotlin-test-js'
|
testImplementation 'org.jetbrains.kotlin:kotlin-test-js'
|
||||||
}
|
}
|
||||||
kotlin {
|
kotlin {
|
||||||
js {
|
js(LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
webpackTask {
|
webpackTask {
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ dependencies {
|
|||||||
testImplementation(kotlin("test-js"))
|
testImplementation(kotlin("test-js"))
|
||||||
}
|
}
|
||||||
kotlin {
|
kotlin {
|
||||||
js {
|
js(LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
webpackTask {
|
webpackTask {
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ dependencies {
|
|||||||
testImplementation 'org.jetbrains.kotlin:kotlin-test-js'
|
testImplementation 'org.jetbrains.kotlin:kotlin-test-js'
|
||||||
}
|
}
|
||||||
kotlin {
|
kotlin {
|
||||||
js {
|
js(LEGACY) {
|
||||||
nodejs {
|
nodejs {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ dependencies {
|
|||||||
testImplementation(kotlin("test-js"))
|
testImplementation(kotlin("test-js"))
|
||||||
}
|
}
|
||||||
kotlin {
|
kotlin {
|
||||||
js {
|
js(LEGACY) {
|
||||||
nodejs {
|
nodejs {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ dependencies {
|
|||||||
testImplementation 'org.jetbrains.kotlin:kotlin-test-js'
|
testImplementation 'org.jetbrains.kotlin:kotlin-test-js'
|
||||||
}
|
}
|
||||||
kotlin {
|
kotlin {
|
||||||
js {
|
js(LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
webpackTask {
|
webpackTask {
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ dependencies {
|
|||||||
testImplementation(kotlin("test-js"))
|
testImplementation(kotlin("test-js"))
|
||||||
}
|
}
|
||||||
kotlin {
|
kotlin {
|
||||||
js {
|
js(LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
webpackTask {
|
webpackTask {
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
withJava()
|
withJava()
|
||||||
}
|
}
|
||||||
js {
|
js(LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
webpackTask {
|
webpackTask {
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
withJava()
|
withJava()
|
||||||
}
|
}
|
||||||
js {
|
js(LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
binaries.executable()
|
binaries.executable()
|
||||||
webpackTask {
|
webpackTask {
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ kotlin {
|
|||||||
kotlinOptions.jvmTarget = '1.8'
|
kotlinOptions.jvmTarget = '1.8'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
js {
|
js(LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
testTask {
|
testTask {
|
||||||
useKarma {
|
useKarma {
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ kotlin {
|
|||||||
kotlinOptions.jvmTarget = "1.8"
|
kotlinOptions.jvmTarget = "1.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
js {
|
js(LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
testTask {
|
testTask {
|
||||||
useKarma {
|
useKarma {
|
||||||
|
|||||||
+10
-6
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.gradle.GradleIRLi
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.gradle.irsList
|
import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.gradle.irsList
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.BrowserJsSinglePlatformModuleConfigurator.settingsValue
|
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.BrowserJsSinglePlatformModuleConfigurator.settingsValue
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JSConfigurator.Companion.isApplication
|
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JSConfigurator.Companion.isApplication
|
||||||
|
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JSConfigurator.Companion.jsCompilerParam
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsBrowserBasedConfigurator.Companion.browserSubTarget
|
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsBrowserBasedConfigurator.Companion.browserSubTarget
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsBrowserBasedConfigurator.Companion.cssSupport
|
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsBrowserBasedConfigurator.Companion.cssSupport
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsNodeBasedConfigurator.Companion.nodejsSubTarget
|
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsNodeBasedConfigurator.Companion.nodejsSubTarget
|
||||||
@@ -44,7 +45,6 @@ interface JSConfigurator : ModuleConfiguratorWithModuleType, ModuleConfiguratorW
|
|||||||
GradlePlugin.gradleProperties
|
GradlePlugin.gradleProperties
|
||||||
.addValues(
|
.addValues(
|
||||||
"kotlin.js.generate.executable.default" to "false",
|
"kotlin.js.generate.executable.default" to "false",
|
||||||
"kotlin.js.compiler" to JsCompiler.IR.text.toLowerCase()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun getConfiguratorSettings(): List<ModuleConfiguratorSetting<*, *>> =
|
override fun getConfiguratorSettings(): List<ModuleConfiguratorSetting<*, *>> =
|
||||||
@@ -72,7 +72,7 @@ interface JSConfigurator : ModuleConfiguratorWithModuleType, ModuleConfiguratorW
|
|||||||
KotlinNewProjectWizardBundle.message("module.configurator.js.target.settings.compiler"),
|
KotlinNewProjectWizardBundle.message("module.configurator.js.target.settings.compiler"),
|
||||||
GenerationPhase.PROJECT_GENERATION
|
GenerationPhase.PROJECT_GENERATION
|
||||||
) {
|
) {
|
||||||
defaultValue = value(JsCompiler.IR)
|
defaultValue = value(JsCompiler.LEGACY)
|
||||||
filter = filter@{ reference, compilerCandidate ->
|
filter = filter@{ reference, compilerCandidate ->
|
||||||
when {
|
when {
|
||||||
reference !is ModuleConfiguratorSettingReference<*, *> -> false
|
reference !is ModuleConfiguratorSettingReference<*, *> -> false
|
||||||
@@ -84,6 +84,11 @@ interface JSConfigurator : ModuleConfiguratorWithModuleType, ModuleConfiguratorW
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun Reader.jsCompilerParam(
|
||||||
|
module: Module
|
||||||
|
): String? =
|
||||||
|
settingValue(module, compiler)?.text
|
||||||
|
|
||||||
fun Reader.isApplication(module: Module): Boolean =
|
fun Reader.isApplication(module: Module): Boolean =
|
||||||
settingsValue(module, kind) == JsTargetKind.APPLICATION
|
settingsValue(module, kind) == JsTargetKind.APPLICATION
|
||||||
}
|
}
|
||||||
@@ -156,10 +161,9 @@ abstract class JsSinglePlatformModuleConfigurator :
|
|||||||
module: Module
|
module: Module
|
||||||
): List<BuildSystemIR> = irsList {
|
): List<BuildSystemIR> = irsList {
|
||||||
"kotlin" {
|
"kotlin" {
|
||||||
val compiler = reader.settingsValue(module, JSConfigurator.compiler)
|
val param = reader.jsCompilerParam(module)
|
||||||
val param = if (compiler != JsCompiler.IR) {
|
?.let { "($it)" } ?: ""
|
||||||
"(${compiler.text})"
|
|
||||||
} else ""
|
|
||||||
"js${param}" {
|
"js${param}" {
|
||||||
subTarget(module, reader)
|
subTarget(module, reader)
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-12
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.gradle.GradleStri
|
|||||||
import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.gradle.irsList
|
import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.gradle.irsList
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.gradle.multiplatform.DefaultTargetConfigurationIR
|
import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.gradle.multiplatform.DefaultTargetConfigurationIR
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.gradle.multiplatform.TargetAccessIR
|
import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.gradle.multiplatform.TargetAccessIR
|
||||||
|
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JSConfigurator.Companion.jsCompilerParam
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsBrowserBasedConfigurator.Companion.browserSubTarget
|
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsBrowserBasedConfigurator.Companion.browserSubTarget
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsBrowserBasedConfigurator.Companion.cssSupport
|
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsBrowserBasedConfigurator.Companion.cssSupport
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsNodeBasedConfigurator.Companion.nodejsSubTarget
|
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.JsNodeBasedConfigurator.Companion.nodejsSubTarget
|
||||||
@@ -79,16 +80,6 @@ internal fun Module.createTargetAccessIr(
|
|||||||
|
|
||||||
interface JsTargetConfigurator : JSConfigurator, TargetConfigurator, SingleCoexistenceTargetConfigurator, ModuleConfiguratorWithSettings
|
interface JsTargetConfigurator : JSConfigurator, TargetConfigurator, SingleCoexistenceTargetConfigurator, ModuleConfiguratorWithSettings
|
||||||
|
|
||||||
internal fun JsTargetConfigurator.jsCompilerParam(
|
|
||||||
reader: Reader,
|
|
||||||
module: Module
|
|
||||||
) =
|
|
||||||
reader.settingValue(module, JSConfigurator.compiler)?.let {
|
|
||||||
if (it != JsCompiler.IR) {
|
|
||||||
listOf(it.text)
|
|
||||||
} else emptyList()
|
|
||||||
} ?: emptyList()
|
|
||||||
|
|
||||||
enum class JsTargetKind(override val text: String) : DisplayableSettingItem {
|
enum class JsTargetKind(override val text: String) : DisplayableSettingItem {
|
||||||
LIBRARY(KotlinNewProjectWizardBundle.message("module.configurator.js.target.settings.kind.library")),
|
LIBRARY(KotlinNewProjectWizardBundle.message("module.configurator.js.target.settings.kind.library")),
|
||||||
APPLICATION(KotlinNewProjectWizardBundle.message("module.configurator.js.target.settings.kind.application"))
|
APPLICATION(KotlinNewProjectWizardBundle.message("module.configurator.js.target.settings.kind.application"))
|
||||||
@@ -119,7 +110,7 @@ object JsBrowserTargetConfigurator : JsTargetConfigurator, ModuleConfiguratorWit
|
|||||||
+DefaultTargetConfigurationIR(
|
+DefaultTargetConfigurationIR(
|
||||||
module.createTargetAccessIr(
|
module.createTargetAccessIr(
|
||||||
ModuleSubType.js,
|
ModuleSubType.js,
|
||||||
jsCompilerParam(this@createTargetIrs, module)
|
paramsWithJsCompiler(module)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
browserSubTarget(module, this@createTargetIrs)
|
browserSubTarget(module, this@createTargetIrs)
|
||||||
@@ -139,7 +130,7 @@ object JsNodeTargetConfigurator : JsTargetConfigurator {
|
|||||||
+DefaultTargetConfigurationIR(
|
+DefaultTargetConfigurationIR(
|
||||||
module.createTargetAccessIr(
|
module.createTargetAccessIr(
|
||||||
ModuleSubType.js,
|
ModuleSubType.js,
|
||||||
jsCompilerParam(this@createTargetIrs, module)
|
paramsWithJsCompiler(module)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
nodejsSubTarget(module, this@createTargetIrs)
|
nodejsSubTarget(module, this@createTargetIrs)
|
||||||
@@ -147,6 +138,10 @@ object JsNodeTargetConfigurator : JsTargetConfigurator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun Reader.paramsWithJsCompiler(module: Module): List<String> = jsCompilerParam(module)?.let {
|
||||||
|
listOf(it)
|
||||||
|
} ?: emptyList()
|
||||||
|
|
||||||
object CommonTargetConfigurator : TargetConfiguratorWithTests(), SimpleTargetConfigurator, SingleCoexistenceTargetConfigurator {
|
object CommonTargetConfigurator : TargetConfiguratorWithTests(), SimpleTargetConfigurator, SingleCoexistenceTargetConfigurator {
|
||||||
override val moduleSubType = ModuleSubType.common
|
override val moduleSubType = ModuleSubType.common
|
||||||
override val text: String = KotlinNewProjectWizardBundle.message("module.configurator.common")
|
override val text: String = KotlinNewProjectWizardBundle.message("module.configurator.common")
|
||||||
|
|||||||
Reference in New Issue
Block a user