[Gradle, JS] Configure compiler args for produceKotlinLibrary in IR

This commit is contained in:
Ilya Goncharov
2019-12-24 16:26:20 +03:00
parent 0ff84eaa63
commit 6be8a83ff9
3 changed files with 22 additions and 0 deletions
@@ -76,6 +76,8 @@ interface KotlinJsIrSubTargetDsl {
}
}
fun produceKotlinLibrary()
val testRuns: NamedDomainObjectContainer<KotlinJsIrPlatformTestRun>
}
@@ -49,6 +49,24 @@ abstract class KotlinJsIrSubTarget(
}
}
override fun produceKotlinLibrary() {
target.compilations
.matching { it.name == KotlinCompilation.TEST_COMPILATION_NAME }
.all {
it.kotlinOptions {
freeCompilerArgs += listOf("-Xir-produce-klib-dir", "-Xir-produce-js")
}
}
target.compilations
.matching { it.name == KotlinCompilation.MAIN_COMPILATION_NAME }
.all {
it.kotlinOptions {
freeCompilerArgs += listOf("-Xir-produce-klib-dir")
}
}
}
override fun testTask(body: KotlinJsTest.() -> Unit) {
testRuns.getByName(KotlinTargetWithTests.DEFAULT_TEST_RUN_NAME).executionTask.configure(body)
}
@@ -57,6 +57,8 @@ open class KotlinJsIrTargetConfigurator(kotlinPluginVersion: String) :
moduleKind = "umd"
sourceMap = true
sourceMapEmbedSources = null
freeCompilerArgs += listOf("-Xir-only")
}
}
}