[JS IR] webpackConfigAppliers as internal to not break Gradle lambda serialization in some cases
[JS IR] Add synthetic config and webpack config is nested object ^KT-43535 fixed
This commit is contained in:
+2
-2
@@ -45,10 +45,10 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
|
|
||||||
override fun commonWebpackConfig(body: KotlinWebpackConfig.() -> Unit) {
|
override fun commonWebpackConfig(body: KotlinWebpackConfig.() -> Unit) {
|
||||||
webpackTaskConfigurations.add {
|
webpackTaskConfigurations.add {
|
||||||
webpackConfigAppliers.add(body)
|
webpackConfigApplier(body)
|
||||||
}
|
}
|
||||||
runTaskConfigurations.add {
|
runTaskConfigurations.add {
|
||||||
webpackConfigAppliers.add(body)
|
webpackConfigApplier(body)
|
||||||
}
|
}
|
||||||
testTask {
|
testTask {
|
||||||
onTestFrameworkSet {
|
onTestFrameworkSet {
|
||||||
|
|||||||
+2
-2
@@ -51,10 +51,10 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
|
|
||||||
override fun commonWebpackConfig(body: KotlinWebpackConfig.() -> Unit) {
|
override fun commonWebpackConfig(body: KotlinWebpackConfig.() -> Unit) {
|
||||||
webpackTaskConfigurations.add {
|
webpackTaskConfigurations.add {
|
||||||
webpackConfigAppliers.add(body)
|
webpackConfigApplier(body)
|
||||||
}
|
}
|
||||||
runTaskConfigurations.add {
|
runTaskConfigurations.add {
|
||||||
webpackConfigAppliers.add(body)
|
webpackConfigApplier(body)
|
||||||
}
|
}
|
||||||
testTask {
|
testTask {
|
||||||
onTestFrameworkSet {
|
onTestFrameworkSet {
|
||||||
|
|||||||
+9
-2
@@ -185,8 +185,15 @@ constructor(
|
|||||||
@Internal
|
@Internal
|
||||||
var generateConfigOnly: Boolean = false
|
var generateConfigOnly: Boolean = false
|
||||||
|
|
||||||
@Input
|
@Nested
|
||||||
val webpackConfigAppliers: MutableList<(KotlinWebpackConfig) -> Unit> =
|
val synthConfig = KotlinWebpackConfig()
|
||||||
|
|
||||||
|
fun webpackConfigApplier(body: KotlinWebpackConfig.() -> Unit) {
|
||||||
|
synthConfig.body()
|
||||||
|
webpackConfigAppliers.add(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val webpackConfigAppliers: MutableList<(KotlinWebpackConfig) -> Unit> =
|
||||||
mutableListOf()
|
mutableListOf()
|
||||||
|
|
||||||
private fun createRunner(): KotlinWebpackRunner {
|
private fun createRunner(): KotlinWebpackRunner {
|
||||||
|
|||||||
+51
@@ -8,6 +8,10 @@
|
|||||||
package org.jetbrains.kotlin.gradle.targets.js.webpack
|
package org.jetbrains.kotlin.gradle.targets.js.webpack
|
||||||
|
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
|
import org.gradle.api.tasks.Input
|
||||||
|
import org.gradle.api.tasks.Internal
|
||||||
|
import org.gradle.api.tasks.Nested
|
||||||
|
import org.gradle.api.tasks.Optional
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.NpmVersions
|
import org.jetbrains.kotlin.gradle.targets.js.NpmVersions
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.RequiredKotlinJsDependency
|
import org.jetbrains.kotlin.gradle.targets.js.RequiredKotlinJsDependency
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.appendConfigsFromDir
|
import org.jetbrains.kotlin.gradle.targets.js.appendConfigsFromDir
|
||||||
@@ -21,24 +25,71 @@ import java.io.StringWriter
|
|||||||
|
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
data class KotlinWebpackConfig(
|
data class KotlinWebpackConfig(
|
||||||
|
@Input
|
||||||
var mode: Mode = Mode.DEVELOPMENT,
|
var mode: Mode = Mode.DEVELOPMENT,
|
||||||
|
@Internal
|
||||||
var entry: File? = null,
|
var entry: File? = null,
|
||||||
|
@Nested
|
||||||
|
@Optional
|
||||||
var output: KotlinWebpackOutput? = null,
|
var output: KotlinWebpackOutput? = null,
|
||||||
|
@Internal
|
||||||
var outputPath: File? = null,
|
var outputPath: File? = null,
|
||||||
|
@Input
|
||||||
|
@Optional
|
||||||
var outputFileName: String? = entry?.name,
|
var outputFileName: String? = entry?.name,
|
||||||
|
@Internal
|
||||||
var configDirectory: File? = null,
|
var configDirectory: File? = null,
|
||||||
|
@Internal
|
||||||
var bundleAnalyzerReportDir: File? = null,
|
var bundleAnalyzerReportDir: File? = null,
|
||||||
|
@Internal
|
||||||
var reportEvaluatedConfigFile: File? = null,
|
var reportEvaluatedConfigFile: File? = null,
|
||||||
|
@Input
|
||||||
|
@Optional
|
||||||
var devServer: DevServer? = null,
|
var devServer: DevServer? = null,
|
||||||
|
@Nested
|
||||||
var cssSupport: KotlinWebpackCssSupport = KotlinWebpackCssSupport(),
|
var cssSupport: KotlinWebpackCssSupport = KotlinWebpackCssSupport(),
|
||||||
|
@Input
|
||||||
|
@Optional
|
||||||
var devtool: String? = WebpackDevtool.EVAL_SOURCE_MAP,
|
var devtool: String? = WebpackDevtool.EVAL_SOURCE_MAP,
|
||||||
|
@Input
|
||||||
var showProgress: Boolean = false,
|
var showProgress: Boolean = false,
|
||||||
|
@Input
|
||||||
var sourceMaps: Boolean = false,
|
var sourceMaps: Boolean = false,
|
||||||
|
@Input
|
||||||
var export: Boolean = true,
|
var export: Boolean = true,
|
||||||
|
@Input
|
||||||
var progressReporter: Boolean = false,
|
var progressReporter: Boolean = false,
|
||||||
|
@Input
|
||||||
|
@Optional
|
||||||
var progressReporterPathFilter: String? = null,
|
var progressReporterPathFilter: String? = null,
|
||||||
|
@Input
|
||||||
var resolveFromModulesFirst: Boolean = false
|
var resolveFromModulesFirst: Boolean = false
|
||||||
) {
|
) {
|
||||||
|
@get:Input
|
||||||
|
@get:Optional
|
||||||
|
val entryInput: String?
|
||||||
|
get() = entry?.absoluteFile?.normalize()?.absolutePath
|
||||||
|
|
||||||
|
@get:Input
|
||||||
|
@get:Optional
|
||||||
|
val outputPathInput: String?
|
||||||
|
get() = outputPath?.absoluteFile?.normalize()?.absolutePath
|
||||||
|
|
||||||
|
@get:Input
|
||||||
|
@get:Optional
|
||||||
|
val configDirectoryInput: String?
|
||||||
|
get() = configDirectory?.absoluteFile?.normalize()?.absolutePath
|
||||||
|
|
||||||
|
@get:Input
|
||||||
|
@get:Optional
|
||||||
|
val bundleAnalyzerReportDirInput: String?
|
||||||
|
get() = bundleAnalyzerReportDir?.absoluteFile?.normalize()?.absolutePath
|
||||||
|
|
||||||
|
@get:Input
|
||||||
|
@get:Optional
|
||||||
|
val reportEvaluatedConfigFileInput: String?
|
||||||
|
get() = reportEvaluatedConfigFile?.absoluteFile?.normalize()?.absolutePath
|
||||||
|
|
||||||
fun getRequiredDependencies(versions: NpmVersions) =
|
fun getRequiredDependencies(versions: NpmVersions) =
|
||||||
mutableSetOf<RequiredKotlinJsDependency>().also {
|
mutableSetOf<RequiredKotlinJsDependency>().also {
|
||||||
it.add(versions.kotlinJsTestRunner)
|
it.add(versions.kotlinJsTestRunner)
|
||||||
|
|||||||
Reference in New Issue
Block a user