[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() {
|
override fun useEsModules() {
|
||||||
error("ES modules are not supported in legacy JS compiler. Please, use IR one instead.")
|
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 useCommonJs()
|
||||||
fun useEsModules()
|
fun useEsModules()
|
||||||
|
|
||||||
|
fun generateTypeScriptDefinitions()
|
||||||
|
|
||||||
val binaries: KotlinJsBinaryContainer
|
val binaries: KotlinJsBinaryContainer
|
||||||
|
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
|
|||||||
+13
@@ -384,4 +384,17 @@ constructor(
|
|||||||
sourceMap = true
|
sourceMap = true
|
||||||
sourceMapEmbedSources = "never"
|
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(
|
configureOptions(
|
||||||
compilation,
|
compilation,
|
||||||
ENABLE_DCE,
|
ENABLE_DCE,
|
||||||
GENERATE_D_TS,
|
|
||||||
MINIMIZED_MEMBER_NAMES
|
MINIMIZED_MEMBER_NAMES
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
KotlinJsBinaryMode.DEVELOPMENT -> {
|
KotlinJsBinaryMode.DEVELOPMENT -> {
|
||||||
configureOptions(
|
configureOptions(
|
||||||
compilation,
|
compilation
|
||||||
GENERATE_D_TS
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
else -> throw InvalidUserDataException(
|
else -> throw InvalidUserDataException(
|
||||||
|
|||||||
Reference in New Issue
Block a user