KT-37587 Karma. Support dynamically created webpack configs
This commit is contained in:
committed by
Ilya Goncharov
parent
7736e5f4a7
commit
4cd4dfee25
+2
-2
@@ -154,7 +154,7 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) :
|
|||||||
requiredDependencies.add(versions.webpack)
|
requiredDependencies.add(versions.webpack)
|
||||||
|
|
||||||
val webpackConfigWriter = KotlinWebpackConfig(
|
val webpackConfigWriter = KotlinWebpackConfig(
|
||||||
configDirectory = project.projectDir.resolve("webpack.config.d").takeIf { it.isDirectory },
|
configDirectory = project.projectDir.resolve("webpack.config.d"),
|
||||||
sourceMaps = true,
|
sourceMaps = true,
|
||||||
devtool = null,
|
devtool = null,
|
||||||
export = false,
|
export = false,
|
||||||
@@ -455,4 +455,4 @@ class KotlinKarma(override val compilation: KotlinJsCompilation) :
|
|||||||
const val CHROME_BIN = "CHROME_BIN"
|
const val CHROME_BIN = "CHROME_BIN"
|
||||||
const val CHROME_CANARY_BIN = "CHROME_CANARY_BIN"
|
const val CHROME_CANARY_BIN = "CHROME_CANARY_BIN"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -108,7 +108,7 @@ open class KotlinWebpack : DefaultTask(), RequiresNpmDependencies {
|
|||||||
get() = destinationDirectory.resolve(outputFileName)
|
get() = destinationDirectory.resolve(outputFileName)
|
||||||
|
|
||||||
open val configDirectory: File?
|
open val configDirectory: File?
|
||||||
@Optional @InputDirectory get() = project.projectDir.resolve("webpack.config.d").takeIf { it.isDirectory }
|
@Optional @InputDirectory get() = project.projectDir.resolve("webpack.config.d")
|
||||||
|
|
||||||
@Input
|
@Input
|
||||||
var report: Boolean = false
|
var report: Boolean = false
|
||||||
@@ -197,4 +197,4 @@ open class KotlinWebpack : DefaultTask(), RequiresNpmDependencies {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -141,7 +141,7 @@ data class KotlinWebpackConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun Appendable.appendFromConfigDir() {
|
private fun Appendable.appendFromConfigDir() {
|
||||||
if (configDirectory == null) return
|
if (configDirectory == null || !configDirectory.isDirectory) return
|
||||||
|
|
||||||
appendln()
|
appendln()
|
||||||
appendConfigsFromDir(configDirectory)
|
appendConfigsFromDir(configDirectory)
|
||||||
@@ -275,4 +275,4 @@ data class KotlinWebpackConfig(
|
|||||||
private fun json(obj: Any) = StringWriter().also {
|
private fun json(obj: Any) = StringWriter().also {
|
||||||
GsonBuilder().setPrettyPrinting().create().toJson(obj, it)
|
GsonBuilder().setPrettyPrinting().create().toJson(obj, it)
|
||||||
}.toString()
|
}.toString()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user