[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
|
it.destinationDir
|
||||||
.resolve(binary.linkTask.get().outputFile.name)
|
.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.bin = "webpack-dev-server/bin/webpack-dev-server.js"
|
||||||
task.description = "start ${mode.name.toLowerCase()} webpack dev server"
|
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.outputs.upToDateWhen { false }
|
||||||
|
|
||||||
|
task.commonConfigure(
|
||||||
|
compilation = compilation,
|
||||||
|
mode = mode,
|
||||||
|
entryFileProvider = entryFileProvider,
|
||||||
|
configurationActions = commonRunConfigurations,
|
||||||
|
nodeJs = nodeJs
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == KotlinJsBinaryMode.DEVELOPMENT) {
|
if (mode == KotlinJsBinaryMode.DEVELOPMENT) {
|
||||||
@@ -156,13 +157,6 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
listOf(compilation)
|
listOf(compilation)
|
||||||
) { task ->
|
) { task ->
|
||||||
val entryFileProvider = binary.linkTask.map { it.outputFile }
|
val entryFileProvider = binary.linkTask.map { it.outputFile }
|
||||||
task.commonConfigure(
|
|
||||||
compilation = compilation,
|
|
||||||
mode = mode,
|
|
||||||
entryFileProvider = entryFileProvider,
|
|
||||||
configurationActions = commonWebpackConfigurations,
|
|
||||||
nodeJs = nodeJs
|
|
||||||
)
|
|
||||||
|
|
||||||
task.dependsOn(
|
task.dependsOn(
|
||||||
distributeResourcesTask
|
distributeResourcesTask
|
||||||
@@ -170,6 +164,14 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
|
|
||||||
task.description = "build webpack ${mode.name.toLowerCase()} bundle"
|
task.description = "build webpack ${mode.name.toLowerCase()} bundle"
|
||||||
task._destinationDirectory = distribution.directory
|
task._destinationDirectory = distribution.directory
|
||||||
|
|
||||||
|
task.commonConfigure(
|
||||||
|
compilation = compilation,
|
||||||
|
mode = mode,
|
||||||
|
entryFileProvider = entryFileProvider,
|
||||||
|
configurationActions = commonWebpackConfigurations,
|
||||||
|
nodeJs = nodeJs
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == KotlinJsBinaryMode.PRODUCTION) {
|
if (mode == KotlinJsBinaryMode.PRODUCTION) {
|
||||||
|
|||||||
+21
-23
@@ -110,8 +110,18 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
RUN_TASK_NAME
|
RUN_TASK_NAME
|
||||||
),
|
),
|
||||||
listOf(compilation)
|
listOf(compilation)
|
||||||
) {
|
) { task ->
|
||||||
it.commonConfigure(
|
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,
|
compilation = compilation,
|
||||||
dceTaskProvider = dceTaskProvider,
|
dceTaskProvider = dceTaskProvider,
|
||||||
devDceTaskProvider = devDceTaskProvider,
|
devDceTaskProvider = devDceTaskProvider,
|
||||||
@@ -119,16 +129,6 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
configurationActions = commonRunConfigurations,
|
configurationActions = commonRunConfigurations,
|
||||||
nodeJs = nodeJs
|
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) {
|
if (type == KotlinJsBinaryMode.DEVELOPMENT) {
|
||||||
@@ -173,8 +173,15 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
|
|
||||||
),
|
),
|
||||||
listOf(compilation)
|
listOf(compilation)
|
||||||
) {
|
) { task ->
|
||||||
it.commonConfigure(
|
task.dependsOn(
|
||||||
|
distributeResourcesTask
|
||||||
|
)
|
||||||
|
|
||||||
|
task.description = "build webpack ${type.name.toLowerCase()} bundle"
|
||||||
|
task._destinationDirectory = distribution.directory
|
||||||
|
|
||||||
|
task.commonConfigure(
|
||||||
compilation = compilation,
|
compilation = compilation,
|
||||||
dceTaskProvider = dceTaskProvider,
|
dceTaskProvider = dceTaskProvider,
|
||||||
devDceTaskProvider = devDceTaskProvider,
|
devDceTaskProvider = devDceTaskProvider,
|
||||||
@@ -182,15 +189,6 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
configurationActions = commonWebpackConfigurations,
|
configurationActions = commonWebpackConfigurations,
|
||||||
nodeJs = nodeJs
|
nodeJs = nodeJs
|
||||||
)
|
)
|
||||||
|
|
||||||
it.dependsOn(
|
|
||||||
distributeResourcesTask
|
|
||||||
)
|
|
||||||
|
|
||||||
it.configureOptimization(type)
|
|
||||||
|
|
||||||
it.description = "build webpack ${type.name.toLowerCase()} bundle"
|
|
||||||
it._destinationDirectory = distribution.directory
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == KotlinJsBinaryMode.PRODUCTION) {
|
if (type == KotlinJsBinaryMode.PRODUCTION) {
|
||||||
|
|||||||
Reference in New Issue
Block a user