[Gradle, JS] KotlinJsType to KotlinJsMode
This commit is contained in:
+4
-5
@@ -16,7 +16,6 @@ import org.gradle.api.artifacts.maven.MavenResolver
|
||||
import org.gradle.api.attributes.Usage
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.file.SourceDirectorySet
|
||||
import org.gradle.api.logging.Logger
|
||||
import org.gradle.api.logging.Logging
|
||||
import org.gradle.api.plugins.InvalidPluginException
|
||||
import org.gradle.api.plugins.JavaPlugin
|
||||
@@ -41,7 +40,7 @@ import org.jetbrains.kotlin.gradle.logging.kotlinWarn
|
||||
import org.jetbrains.kotlin.gradle.model.builder.KotlinModelBuilder
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.*
|
||||
import org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode
|
||||
import org.jetbrains.kotlin.gradle.targets.js.ir.JsIrBinary
|
||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation
|
||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrLink
|
||||
@@ -337,7 +336,7 @@ internal class KotlinJsIrSourceSetProcessor(
|
||||
private fun registerJsLink(
|
||||
project: Project,
|
||||
taskName: String,
|
||||
type: KotlinJsBinaryType,
|
||||
mode: KotlinJsBinaryMode,
|
||||
configureAction: (Kotlin2JsCompile) -> Unit
|
||||
): TaskProvider<out KotlinJsIrLink> {
|
||||
return tasksProvider.registerKotlinJsIrTask(
|
||||
@@ -345,7 +344,7 @@ internal class KotlinJsIrSourceSetProcessor(
|
||||
taskName,
|
||||
kotlinCompilation
|
||||
) { task ->
|
||||
task.type = type
|
||||
task.mode = mode
|
||||
configureAction(task)
|
||||
}
|
||||
}
|
||||
@@ -363,7 +362,7 @@ internal class KotlinJsIrSourceSetProcessor(
|
||||
registerKotlinCompileTask(
|
||||
binary.linkTaskName
|
||||
) { project, name, action ->
|
||||
registerJsLink(project, name, binary.type) { compileTask ->
|
||||
registerJsLink(project, name, binary.mode) { compileTask ->
|
||||
action(compileTask)
|
||||
compileTask.dependsOn(kotlinTask)
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.targets.js.dsl
|
||||
|
||||
enum class KotlinJsBinaryType {
|
||||
enum class KotlinJsBinaryMode {
|
||||
PRODUCTION,
|
||||
DEVELOPMENT
|
||||
}
|
||||
+7
-7
@@ -9,20 +9,20 @@ import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsCompilation
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode
|
||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsBinaryContainer.Companion.generateBinaryName
|
||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||
|
||||
interface JsBinary {
|
||||
val compilation: KotlinJsCompilation
|
||||
val name: String
|
||||
val type: KotlinJsBinaryType
|
||||
val mode: KotlinJsBinaryMode
|
||||
}
|
||||
|
||||
sealed class JsIrBinary(
|
||||
override val compilation: KotlinJsCompilation,
|
||||
override val name: String,
|
||||
override val type: KotlinJsBinaryType
|
||||
override val mode: KotlinJsBinaryMode
|
||||
) : JsBinary {
|
||||
val linkTaskName: String = linkTaskName()
|
||||
|
||||
@@ -49,16 +49,16 @@ sealed class JsIrBinary(
|
||||
class Executable(
|
||||
compilation: KotlinJsCompilation,
|
||||
name: String,
|
||||
type: KotlinJsBinaryType
|
||||
mode: KotlinJsBinaryMode
|
||||
) : JsIrBinary(
|
||||
compilation,
|
||||
name,
|
||||
type
|
||||
mode
|
||||
) {
|
||||
val executeTaskBaseName: String =
|
||||
generateBinaryName(
|
||||
compilation,
|
||||
type,
|
||||
mode,
|
||||
null
|
||||
)
|
||||
}
|
||||
@@ -67,6 +67,6 @@ class Executable(
|
||||
internal val JsBinary.executeTaskBaseName: String
|
||||
get() = generateBinaryName(
|
||||
compilation,
|
||||
type,
|
||||
mode,
|
||||
null
|
||||
)
|
||||
+9
-9
@@ -69,7 +69,7 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
.all { binary ->
|
||||
binary as Executable
|
||||
|
||||
val type = binary.type
|
||||
val type = binary.mode
|
||||
|
||||
val runTask = registerSubTargetTask<KotlinWebpack>(
|
||||
disambiguateCamelCased(
|
||||
@@ -95,7 +95,7 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
it.outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
if (type == KotlinJsBinaryType.DEVELOPMENT) {
|
||||
if (type == KotlinJsBinaryMode.DEVELOPMENT) {
|
||||
target.runTask.dependsOn(runTask)
|
||||
commonRunTask.configure {
|
||||
it.dependsOn(runTask)
|
||||
@@ -129,7 +129,7 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
.all { binary ->
|
||||
binary as Executable
|
||||
|
||||
val type = binary.type
|
||||
val type = binary.mode
|
||||
val webpackTask = registerSubTargetTask<KotlinWebpack>(
|
||||
disambiguateCamelCased(
|
||||
binary.executeTaskBaseName,
|
||||
@@ -151,7 +151,7 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
it._destinationDirectory = distribution.directory
|
||||
}
|
||||
|
||||
if (type == KotlinJsBinaryType.PRODUCTION) {
|
||||
if (type == KotlinJsBinaryMode.PRODUCTION) {
|
||||
assembleTask.dependsOn(webpackTask)
|
||||
val webpackCommonTask = registerSubTargetTask<Task>(
|
||||
disambiguateCamelCased(WEBPACK_TASK_NAME)
|
||||
@@ -173,7 +173,7 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
binary: Executable,
|
||||
nodeJs: NodeJsRootExtension
|
||||
) {
|
||||
val type = binary.type
|
||||
val type = binary.mode
|
||||
|
||||
dependsOn(
|
||||
nodeJs.npmInstallTask,
|
||||
@@ -190,7 +190,7 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
}
|
||||
}
|
||||
|
||||
private fun KotlinWebpack.configureOptimization(kind: KotlinJsBinaryType) {
|
||||
private fun KotlinWebpack.configureOptimization(kind: KotlinJsBinaryMode) {
|
||||
mode = getByKind(
|
||||
kind = kind,
|
||||
releaseValue = Mode.PRODUCTION,
|
||||
@@ -205,12 +205,12 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
}
|
||||
|
||||
private fun <T> getByKind(
|
||||
kind: KotlinJsBinaryType,
|
||||
kind: KotlinJsBinaryMode,
|
||||
releaseValue: T,
|
||||
debugValue: T
|
||||
): T = when (kind) {
|
||||
KotlinJsBinaryType.PRODUCTION -> releaseValue
|
||||
KotlinJsBinaryType.DEVELOPMENT -> debugValue
|
||||
KotlinJsBinaryMode.PRODUCTION -> releaseValue
|
||||
KotlinJsBinaryMode.DEVELOPMENT -> debugValue
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
+16
-16
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -12,9 +12,9 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsCompilation
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinTargetWithBinaries
|
||||
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType.DEVELOPMENT
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType.PRODUCTION
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode.DEVELOPMENT
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode.PRODUCTION
|
||||
import org.jetbrains.kotlin.gradle.targets.js.subtargets.KotlinJsSubTarget
|
||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||
import javax.inject.Inject
|
||||
@@ -80,24 +80,24 @@ constructor(
|
||||
object : JsBinary {
|
||||
override val compilation: KotlinJsCompilation = compilation
|
||||
override val name: String = name
|
||||
override val type: KotlinJsBinaryType = type
|
||||
override val mode: KotlinJsBinaryMode = type
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
internal fun getIrBinaries(
|
||||
type: KotlinJsBinaryType
|
||||
mode: KotlinJsBinaryMode
|
||||
): DomainObjectSet<JsIrBinary> =
|
||||
withType(JsIrBinary::class.java)
|
||||
.matching { it.type == type }
|
||||
.matching { it.mode == mode }
|
||||
|
||||
private fun <T : JsBinary> createBinaries(
|
||||
compilation: KotlinJsCompilation,
|
||||
types: Collection<KotlinJsBinaryType> = listOf(PRODUCTION, DEVELOPMENT),
|
||||
modes: Collection<KotlinJsBinaryMode> = listOf(PRODUCTION, DEVELOPMENT),
|
||||
jsBinaryType: JsBinaryType,
|
||||
create: (compilation: KotlinJsCompilation, name: String, type: KotlinJsBinaryType) -> T
|
||||
create: (compilation: KotlinJsCompilation, name: String, mode: KotlinJsBinaryMode) -> T
|
||||
) {
|
||||
types.forEach {
|
||||
modes.forEach {
|
||||
createBinary(
|
||||
compilation,
|
||||
it,
|
||||
@@ -109,13 +109,13 @@ constructor(
|
||||
|
||||
private fun <T : JsBinary> createBinary(
|
||||
compilation: KotlinJsCompilation,
|
||||
type: KotlinJsBinaryType,
|
||||
mode: KotlinJsBinaryMode,
|
||||
jsBinaryType: JsBinaryType,
|
||||
create: (compilation: KotlinJsCompilation, name: String, type: KotlinJsBinaryType) -> T
|
||||
create: (compilation: KotlinJsCompilation, name: String, mode: KotlinJsBinaryMode) -> T
|
||||
) {
|
||||
val name = generateBinaryName(
|
||||
compilation,
|
||||
type,
|
||||
mode,
|
||||
jsBinaryType
|
||||
)
|
||||
|
||||
@@ -125,7 +125,7 @@ constructor(
|
||||
|
||||
binaryNames.add(name)
|
||||
|
||||
val binary = create(compilation, name, type)
|
||||
val binary = create(compilation, name, mode)
|
||||
add(binary)
|
||||
// Allow accessing binaries as properties of the container in Groovy DSL.
|
||||
if (this is ExtensionAware) {
|
||||
@@ -136,12 +136,12 @@ constructor(
|
||||
companion object {
|
||||
internal fun generateBinaryName(
|
||||
compilation: KotlinJsCompilation,
|
||||
type: KotlinJsBinaryType,
|
||||
mode: KotlinJsBinaryMode,
|
||||
jsBinaryType: JsBinaryType?
|
||||
) =
|
||||
lowerCamelCaseName(
|
||||
compilation.name.let { if (it == KotlinCompilation.MAIN_COMPILATION_NAME) null else it },
|
||||
type.name.toLowerCase(),
|
||||
mode.name.toLowerCase(),
|
||||
jsBinaryType?.name?.toLowerCase()
|
||||
)
|
||||
}
|
||||
|
||||
+6
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -11,9 +11,9 @@ import org.gradle.api.tasks.*
|
||||
import org.gradle.api.tasks.incremental.IncrementalTaskInputs
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsOptions
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType.DEVELOPMENT
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType.PRODUCTION
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode.DEVELOPMENT
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode.PRODUCTION
|
||||
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
||||
import org.jetbrains.kotlin.gradle.utils.newFileProperty
|
||||
import java.io.File
|
||||
@@ -21,7 +21,7 @@ import java.io.File
|
||||
@CacheableTask
|
||||
open class KotlinJsIrLink : Kotlin2JsCompile() {
|
||||
@Input
|
||||
lateinit var type: KotlinJsBinaryType
|
||||
lateinit var mode: KotlinJsBinaryMode
|
||||
|
||||
// Not check sources, only klib module
|
||||
@Internal
|
||||
@@ -56,7 +56,7 @@ open class KotlinJsIrLink : Kotlin2JsCompile() {
|
||||
}
|
||||
|
||||
override fun setupCompilerArgs(args: K2JSCompilerArguments, defaultsOnly: Boolean, ignoreClasspathResolutionErrors: Boolean) {
|
||||
when (type) {
|
||||
when (mode) {
|
||||
PRODUCTION -> {
|
||||
kotlinOptions.configureOptions(ENABLE_DCE, GENERATE_D_TS)
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetWithTests
|
||||
import org.jetbrains.kotlin.gradle.plugin.whenEvaluated
|
||||
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsPlatformTestRun
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsSubTargetDsl
|
||||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmResolverPlugin
|
||||
@@ -102,7 +102,7 @@ abstract class KotlinJsIrSubTarget(
|
||||
testJs.description = testTaskDescription
|
||||
|
||||
val testExecutableTask = compilation.binaries.getIrBinaries(
|
||||
KotlinJsBinaryType.DEVELOPMENT
|
||||
KotlinJsBinaryMode.DEVELOPMENT
|
||||
).single().linkTask
|
||||
|
||||
testJs.inputFileProperty.set(
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@
|
||||
package org.jetbrains.kotlin.gradle.targets.js.ir
|
||||
|
||||
import org.gradle.language.base.plugins.LifecycleBasePlugin
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryType
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBinaryMode
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsNodeDsl
|
||||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsExec
|
||||
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
|
||||
@@ -31,7 +31,7 @@ open class KotlinNodeJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
override fun configureRun(
|
||||
compilation: KotlinJsIrCompilation
|
||||
) {
|
||||
compilation.binaries.getIrBinaries(KotlinJsBinaryType.DEVELOPMENT)
|
||||
compilation.binaries.getIrBinaries(KotlinJsBinaryMode.DEVELOPMENT)
|
||||
.all { developmentExecutable ->
|
||||
val runTaskHolder = NodeJsExec.create(compilation, disambiguateCamelCased(RUN_TASK_NAME)) {
|
||||
group = taskGroupName
|
||||
@@ -45,7 +45,7 @@ open class KotlinNodeJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
override fun configureBuild(
|
||||
compilation: KotlinJsIrCompilation
|
||||
) {
|
||||
compilation.binaries.getIrBinaries(KotlinJsBinaryType.PRODUCTION)
|
||||
compilation.binaries.getIrBinaries(KotlinJsBinaryMode.PRODUCTION)
|
||||
.all { productionExecutable ->
|
||||
val assembleTask = project.tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME)
|
||||
assembleTask.dependsOn(productionExecutable.linkTask)
|
||||
|
||||
+15
-15
@@ -100,7 +100,7 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
|
||||
compilation.binaries
|
||||
.all { binary ->
|
||||
val type = binary.type
|
||||
val type = binary.mode
|
||||
|
||||
val runTask = registerSubTargetTask<KotlinWebpack>(
|
||||
disambiguateCamelCased(
|
||||
@@ -112,7 +112,7 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
compilation = compilation,
|
||||
dceTaskProvider = dceTaskProvider,
|
||||
devDceTaskProvider = devDceTaskProvider,
|
||||
type = type,
|
||||
mode = type,
|
||||
nodeJs = nodeJs
|
||||
)
|
||||
|
||||
@@ -128,7 +128,7 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
it.outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
if (type == KotlinJsBinaryType.DEVELOPMENT) {
|
||||
if (type == KotlinJsBinaryMode.DEVELOPMENT) {
|
||||
target.runTask.dependsOn(runTask)
|
||||
commonRunTask.configure {
|
||||
it.dependsOn(runTask)
|
||||
@@ -161,7 +161,7 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
|
||||
compilation.binaries
|
||||
.all { binary ->
|
||||
val type = binary.type
|
||||
val type = binary.mode
|
||||
|
||||
val webpackTask = registerSubTargetTask<KotlinWebpack>(
|
||||
disambiguateCamelCased(
|
||||
@@ -174,7 +174,7 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
compilation = compilation,
|
||||
dceTaskProvider = dceTaskProvider,
|
||||
devDceTaskProvider = devDceTaskProvider,
|
||||
type = type,
|
||||
mode = type,
|
||||
nodeJs = nodeJs
|
||||
)
|
||||
|
||||
@@ -189,7 +189,7 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
it._destinationDirectory = distribution.directory
|
||||
}
|
||||
|
||||
if (type == KotlinJsBinaryType.PRODUCTION) {
|
||||
if (type == KotlinJsBinaryMode.PRODUCTION) {
|
||||
assembleTask.dependsOn(webpackTask)
|
||||
val webpackCommonTask = registerSubTargetTask<Task>(
|
||||
disambiguateCamelCased(WEBPACK_TASK_NAME)
|
||||
@@ -210,7 +210,7 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
compilation: KotlinJsCompilation,
|
||||
dceTaskProvider: TaskProvider<KotlinJsDceTask>,
|
||||
devDceTaskProvider: TaskProvider<KotlinJsDceTask>,
|
||||
type: KotlinJsBinaryType,
|
||||
mode: KotlinJsBinaryMode,
|
||||
nodeJs: NodeJsRootExtension
|
||||
) {
|
||||
dependsOn(
|
||||
@@ -218,7 +218,7 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
target.project.tasks.named(compilation.processResourcesTaskName)
|
||||
)
|
||||
|
||||
configureOptimization(type)
|
||||
configureOptimization(mode)
|
||||
|
||||
devServer = KotlinWebpackConfig.DevServer(
|
||||
open = true,
|
||||
@@ -227,9 +227,9 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
|
||||
outputs.upToDateWhen { false }
|
||||
|
||||
val actualDceTaskProvider = when (type) {
|
||||
KotlinJsBinaryType.PRODUCTION -> dceTaskProvider
|
||||
KotlinJsBinaryType.DEVELOPMENT -> devDceTaskProvider
|
||||
val actualDceTaskProvider = when (mode) {
|
||||
KotlinJsBinaryMode.PRODUCTION -> dceTaskProvider
|
||||
KotlinJsBinaryMode.DEVELOPMENT -> devDceTaskProvider
|
||||
}
|
||||
|
||||
entryProperty.set(
|
||||
@@ -283,7 +283,7 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
}
|
||||
}
|
||||
|
||||
private fun KotlinWebpack.configureOptimization(kind: KotlinJsBinaryType) {
|
||||
private fun KotlinWebpack.configureOptimization(kind: KotlinJsBinaryMode) {
|
||||
mode = getByKind(
|
||||
kind = kind,
|
||||
releaseValue = Mode.PRODUCTION,
|
||||
@@ -298,12 +298,12 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
}
|
||||
|
||||
private fun <T> getByKind(
|
||||
kind: KotlinJsBinaryType,
|
||||
kind: KotlinJsBinaryMode,
|
||||
releaseValue: T,
|
||||
debugValue: T
|
||||
): T = when (kind) {
|
||||
KotlinJsBinaryType.PRODUCTION -> releaseValue
|
||||
KotlinJsBinaryType.DEVELOPMENT -> debugValue
|
||||
KotlinJsBinaryMode.PRODUCTION -> releaseValue
|
||||
KotlinJsBinaryMode.DEVELOPMENT -> debugValue
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
Reference in New Issue
Block a user