[Gradle, JS] Add typescript optionally
This commit is contained in:
committed by
Space Team
parent
8363b0e9cf
commit
5a7b4294c5
+4
@@ -187,4 +187,8 @@ constructor(
|
||||
override fun useEsModules() {
|
||||
error("ES modules are not supported in legacy JS compiler. Please, use IR one instead.")
|
||||
}
|
||||
|
||||
override fun generateTypeScriptDefinitions() {
|
||||
project.logger.warn("Legacy compiler does not support generation of TypeScript Definitions")
|
||||
}
|
||||
}
|
||||
+2
@@ -55,6 +55,8 @@ interface KotlinJsTargetDsl : KotlinTarget {
|
||||
fun useCommonJs()
|
||||
fun useEsModules()
|
||||
|
||||
fun generateTypeScriptDefinitions()
|
||||
|
||||
val binaries: KotlinJsBinaryContainer
|
||||
|
||||
@Deprecated(
|
||||
|
||||
+13
@@ -384,4 +384,17 @@ constructor(
|
||||
sourceMap = true
|
||||
sourceMapEmbedSources = "never"
|
||||
}
|
||||
|
||||
override fun generateTypeScriptDefinitions() {
|
||||
compilations
|
||||
.all {
|
||||
binaries
|
||||
.withType(JsIrBinary::class.java)
|
||||
.all {
|
||||
it.linkTask.configure { linkTask ->
|
||||
linkTask.compilerOptions.freeCompilerArgs.add(GENERATE_D_TS)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -61,15 +61,13 @@ internal open class KotlinJsIrLinkConfig(
|
||||
configureOptions(
|
||||
compilation,
|
||||
ENABLE_DCE,
|
||||
GENERATE_D_TS,
|
||||
MINIMIZED_MEMBER_NAMES
|
||||
)
|
||||
}
|
||||
|
||||
KotlinJsBinaryMode.DEVELOPMENT -> {
|
||||
configureOptions(
|
||||
compilation,
|
||||
GENERATE_D_TS
|
||||
compilation
|
||||
)
|
||||
}
|
||||
else -> throw InvalidUserDataException(
|
||||
|
||||
Reference in New Issue
Block a user