[Gradle, JS] Common webpack's configurations
This commit is contained in:
+14
-4
@@ -33,6 +33,8 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
KotlinJsSubTarget(target, "browser"),
|
KotlinJsSubTarget(target, "browser"),
|
||||||
KotlinJsBrowserDsl {
|
KotlinJsBrowserDsl {
|
||||||
|
|
||||||
|
private val commonWebpackConfigurations: MutableList<KotlinWebpack.() -> Unit> = mutableListOf()
|
||||||
|
private val commonRunConfigurations: MutableList<KotlinWebpack.() -> Unit> = mutableListOf()
|
||||||
private val dceConfigurations: MutableList<KotlinJsDce.() -> Unit> = mutableListOf()
|
private val dceConfigurations: MutableList<KotlinJsDce.() -> Unit> = mutableListOf()
|
||||||
|
|
||||||
private lateinit var buildVariants: NamedDomainObjectContainer<BuildVariant>
|
private lateinit var buildVariants: NamedDomainObjectContainer<BuildVariant>
|
||||||
@@ -47,11 +49,11 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun runTask(body: KotlinWebpack.() -> Unit) {
|
override fun runTask(body: KotlinWebpack.() -> Unit) {
|
||||||
TODO()
|
commonRunConfigurations.add(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun webpackTask(body: KotlinWebpack.() -> Unit) {
|
override fun webpackTask(body: KotlinWebpack.() -> Unit) {
|
||||||
TODO()
|
commonWebpackConfigurations.add(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExperimentalDce
|
@ExperimentalDce
|
||||||
@@ -116,6 +118,10 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
it.dependsOn(compileKotlinTask)
|
it.dependsOn(compileKotlinTask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commonRunConfigurations.forEach { configure ->
|
||||||
|
it.configure()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dceTaskProvider.configure {
|
dceTaskProvider.configure {
|
||||||
@@ -171,6 +177,10 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
it.dependsOn(compileKotlinTask)
|
it.dependsOn(compileKotlinTask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commonWebpackConfigurations.forEach { configure ->
|
||||||
|
it.configure()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dceTaskProvider.configure {
|
dceTaskProvider.configure {
|
||||||
@@ -198,8 +208,8 @@ open class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) :
|
|||||||
val kotlinTask = compilation.compileKotlinTask
|
val kotlinTask = compilation.compileKotlinTask
|
||||||
|
|
||||||
return project.registerTask(dceTaskName) {
|
return project.registerTask(dceTaskName) {
|
||||||
dceConfigurations.forEach { configuration ->
|
dceConfigurations.forEach { configure ->
|
||||||
it.configuration()
|
it.configure()
|
||||||
}
|
}
|
||||||
|
|
||||||
it.dependsOn(kotlinTask)
|
it.dependsOn(kotlinTask)
|
||||||
|
|||||||
+2
-2
@@ -56,8 +56,8 @@ open class KotlinWebpack : DefaultTask(), RequiresNpmDependencies {
|
|||||||
var entry: File? = null
|
var entry: File? = null
|
||||||
get() = field ?: compilation.compileKotlinTask.outputFile
|
get() = field ?: compilation.compileKotlinTask.outputFile
|
||||||
|
|
||||||
@Input
|
@get:Internal
|
||||||
var resolveFromModulesFirst: Boolean = false
|
internal var resolveFromModulesFirst: Boolean = false
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val runtimeClasspath: FileCollection
|
val runtimeClasspath: FileCollection
|
||||||
|
|||||||
Reference in New Issue
Block a user