[Gradle, JS] Provide js compilations parameters to link tasks
#KT-36796 fixed
This commit is contained in:
+18
-4
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.gradle.targets.js.JsAggregatingExecutionSource
|
|||||||
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsProducingType
|
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsProducingType
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsReportAggregatingTestRun
|
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsReportAggregatingTestRun
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.*
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.*
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@@ -129,11 +130,24 @@ constructor(
|
|||||||
|
|
||||||
fun useCommonJs() {
|
fun useCommonJs() {
|
||||||
compilations.all {
|
compilations.all {
|
||||||
it.compileKotlinTask.kotlinOptions {
|
it.compileKotlinTask.configureCommonJsOptions()
|
||||||
moduleKind = "commonjs"
|
|
||||||
sourceMap = true
|
listOf(
|
||||||
sourceMapEmbedSources = null
|
it.productionLinkTask,
|
||||||
|
it.developmentLinkTask
|
||||||
|
).forEach {
|
||||||
|
it.configure { linkTask ->
|
||||||
|
linkTask.configureCommonJsOptions()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun Kotlin2JsCompile.configureCommonJsOptions() {
|
||||||
|
kotlinOptions {
|
||||||
|
moduleKind = "commonjs"
|
||||||
|
sourceMap = true
|
||||||
|
sourceMapEmbedSources = null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+9
@@ -72,6 +72,15 @@ open class KotlinJsIrTargetConfigurator(kotlinPluginVersion: String) :
|
|||||||
PRODUCE_UNZIPPED_KLIB
|
PRODUCE_UNZIPPED_KLIB
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listOf(
|
||||||
|
it.productionLinkTask,
|
||||||
|
it.developmentLinkTask
|
||||||
|
).forEach {
|
||||||
|
it.configure { linkTask ->
|
||||||
|
linkTask.kotlinOptions.configureOptions()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user