[Gradle, JS] Common configure should be last otherwise user settings can
be overwrote ^KT-40320 fixed
This commit is contained in:
+16
-14
@@ -94,13 +94,6 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
it.destinationDir
|
||||
.resolve(binary.linkTask.get().outputFile.name)
|
||||
}
|
||||
task.commonConfigure(
|
||||
compilation = compilation,
|
||||
mode = mode,
|
||||
entryFileProvider = entryFileProvider,
|
||||
configurationActions = commonRunConfigurations,
|
||||
nodeJs = nodeJs
|
||||
)
|
||||
|
||||
task.bin = "webpack-dev-server/bin/webpack-dev-server.js"
|
||||
task.description = "start ${mode.name.toLowerCase()} webpack dev server"
|
||||
@@ -111,6 +104,14 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
)
|
||||
|
||||
task.outputs.upToDateWhen { false }
|
||||
|
||||
task.commonConfigure(
|
||||
compilation = compilation,
|
||||
mode = mode,
|
||||
entryFileProvider = entryFileProvider,
|
||||
configurationActions = commonRunConfigurations,
|
||||
nodeJs = nodeJs
|
||||
)
|
||||
}
|
||||
|
||||
if (mode == KotlinJsBinaryMode.DEVELOPMENT) {
|
||||
@@ -156,13 +157,6 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
listOf(compilation)
|
||||
) { task ->
|
||||
val entryFileProvider = binary.linkTask.map { it.outputFile }
|
||||
task.commonConfigure(
|
||||
compilation = compilation,
|
||||
mode = mode,
|
||||
entryFileProvider = entryFileProvider,
|
||||
configurationActions = commonWebpackConfigurations,
|
||||
nodeJs = nodeJs
|
||||
)
|
||||
|
||||
task.dependsOn(
|
||||
distributeResourcesTask
|
||||
@@ -170,6 +164,14 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
|
||||
task.description = "build webpack ${mode.name.toLowerCase()} bundle"
|
||||
task._destinationDirectory = distribution.directory
|
||||
|
||||
task.commonConfigure(
|
||||
compilation = compilation,
|
||||
mode = mode,
|
||||
entryFileProvider = entryFileProvider,
|
||||
configurationActions = commonWebpackConfigurations,
|
||||
nodeJs = nodeJs
|
||||
)
|
||||
}
|
||||
|
||||
if (mode == KotlinJsBinaryMode.PRODUCTION) {
|
||||
|
||||
+21
-23
@@ -110,8 +110,18 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
RUN_TASK_NAME
|
||||
),
|
||||
listOf(compilation)
|
||||
) {
|
||||
it.commonConfigure(
|
||||
) { task ->
|
||||
task.bin = "webpack-dev-server/bin/webpack-dev-server.js"
|
||||
task.description = "start ${type.name.toLowerCase()} webpack dev server"
|
||||
|
||||
task.devServer = KotlinWebpackConfig.DevServer(
|
||||
open = true,
|
||||
contentBase = listOf(compilation.output.resourcesDir.canonicalPath)
|
||||
)
|
||||
|
||||
task.outputs.upToDateWhen { false }
|
||||
|
||||
task.commonConfigure(
|
||||
compilation = compilation,
|
||||
dceTaskProvider = dceTaskProvider,
|
||||
devDceTaskProvider = devDceTaskProvider,
|
||||
@@ -119,16 +129,6 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
configurationActions = commonRunConfigurations,
|
||||
nodeJs = nodeJs
|
||||
)
|
||||
|
||||
it.bin = "webpack-dev-server/bin/webpack-dev-server.js"
|
||||
it.description = "start ${type.name.toLowerCase()} webpack dev server"
|
||||
|
||||
it.devServer = KotlinWebpackConfig.DevServer(
|
||||
open = true,
|
||||
contentBase = listOf(compilation.output.resourcesDir.canonicalPath)
|
||||
)
|
||||
|
||||
it.outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
if (type == KotlinJsBinaryMode.DEVELOPMENT) {
|
||||
@@ -173,8 +173,15 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
|
||||
),
|
||||
listOf(compilation)
|
||||
) {
|
||||
it.commonConfigure(
|
||||
) { task ->
|
||||
task.dependsOn(
|
||||
distributeResourcesTask
|
||||
)
|
||||
|
||||
task.description = "build webpack ${type.name.toLowerCase()} bundle"
|
||||
task._destinationDirectory = distribution.directory
|
||||
|
||||
task.commonConfigure(
|
||||
compilation = compilation,
|
||||
dceTaskProvider = dceTaskProvider,
|
||||
devDceTaskProvider = devDceTaskProvider,
|
||||
@@ -182,15 +189,6 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
||||
configurationActions = commonWebpackConfigurations,
|
||||
nodeJs = nodeJs
|
||||
)
|
||||
|
||||
it.dependsOn(
|
||||
distributeResourcesTask
|
||||
)
|
||||
|
||||
it.configureOptimization(type)
|
||||
|
||||
it.description = "build webpack ${type.name.toLowerCase()} bundle"
|
||||
it._destinationDirectory = distribution.directory
|
||||
}
|
||||
|
||||
if (type == KotlinJsBinaryMode.PRODUCTION) {
|
||||
|
||||
Reference in New Issue
Block a user