[Gradle, JS] Extract ir compiler flags
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.gradle.targets.js.ir
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see [compiler/testData/cli/js/jsExtraHelp.out]
|
||||||
|
*/
|
||||||
|
|
||||||
|
const val DISABLE_PRE_IR = "-Xir-only"
|
||||||
|
const val ENABLE_DCE = "-Xir-dce"
|
||||||
|
|
||||||
|
const val GENERATE_D_TS = "-Xgenerate-dts"
|
||||||
|
|
||||||
|
const val PRODUCE_JS = "-Xir-produce-js"
|
||||||
|
const val PRODUCE_UNZIPPED_KLIB = "-Xir-produce-klib-dir"
|
||||||
|
const val PRODUCE_ZIPPED_KLIB = "-Xir-produce-klib-file"
|
||||||
+3
-7
@@ -54,11 +54,11 @@ abstract class KotlinJsIrSubTarget(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun produceKotlinLibrary() {
|
override fun produceKotlinLibrary() {
|
||||||
produceByFlags(PRODUCE_KLIB_DIR)
|
produceByFlags(PRODUCE_UNZIPPED_KLIB)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun produceJs() {
|
override fun produceJs() {
|
||||||
produceByFlags(PRODUCE_KLIB_DIR, PRODUCE_JS)
|
produceByFlags(PRODUCE_UNZIPPED_KLIB, PRODUCE_JS)
|
||||||
|
|
||||||
configureMain()
|
configureMain()
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ abstract class KotlinJsIrSubTarget(
|
|||||||
.matching { it.name == KotlinCompilation.TEST_COMPILATION_NAME }
|
.matching { it.name == KotlinCompilation.TEST_COMPILATION_NAME }
|
||||||
.all {
|
.all {
|
||||||
it.kotlinOptions {
|
it.kotlinOptions {
|
||||||
freeCompilerArgs += listOf(PRODUCE_KLIB_DIR, PRODUCE_JS)
|
freeCompilerArgs += listOf(PRODUCE_UNZIPPED_KLIB, PRODUCE_JS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,10 +167,6 @@ abstract class KotlinJsIrSubTarget(
|
|||||||
protected abstract fun configureMain(compilation: KotlinJsCompilation)
|
protected abstract fun configureMain(compilation: KotlinJsCompilation)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val PRODUCE_JS = "-Xir-produce-js"
|
|
||||||
const val PRODUCE_KLIB_FILE = "-Xir-produce-klib-file"
|
|
||||||
const val PRODUCE_KLIB_DIR = "-Xir-produce-klib-dir"
|
|
||||||
|
|
||||||
const val RUN_TASK_NAME = "run"
|
const val RUN_TASK_NAME = "run"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -58,7 +58,7 @@ open class KotlinJsIrTargetConfigurator(kotlinPluginVersion: String) :
|
|||||||
sourceMap = true
|
sourceMap = true
|
||||||
sourceMapEmbedSources = null
|
sourceMapEmbedSources = null
|
||||||
|
|
||||||
freeCompilerArgs += listOf("-Xir-only")
|
freeCompilerArgs += listOf(DISABLE_PRE_IR)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user