Enable JS IC by default

#KT-28842 Fixed
This commit is contained in:
Alexey Tsvetkov
2018-12-14 16:34:29 +03:00
parent ce9150f2b2
commit 2196d81322
9 changed files with 33 additions and 23 deletions
@@ -34,7 +34,7 @@ class KotlinCompilerWorkspaceSettings : PersistentStateComponent<KotlinCompilerW
* (name `preciseIncrementalEnabled` is kept for workspace file compatibility)
*/
var preciseIncrementalEnabled: Boolean = true
var incrementalCompilationForJsEnabled: Boolean = false
var incrementalCompilationForJsEnabled: Boolean = true
var enableDaemon: Boolean = true
override fun getState(): KotlinCompilerWorkspaceSettings {
@@ -145,7 +145,7 @@
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Enable incremental compilation (experimental)"/>
<text value="Enable incremental compilation"/>
</properties>
</component>
</children>
@@ -94,11 +94,6 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
LOG.debug("==========================================")
LOG.info("is Kotlin incremental compilation enabled for JVM: ${IncrementalCompilation.isEnabledForJvm()}")
LOG.info("is Kotlin incremental compilation enabled for JS: ${IncrementalCompilation.isEnabledForJs()}")
if (IncrementalCompilation.isEnabledForJs()) {
val messageCollector = MessageCollectorAdapter(context, null)
messageCollector.report(INFO, "Using experimental incremental compilation for Kotlin/JS")
}
LOG.info("is Kotlin compiler daemon enabled: ${isDaemonEnabled()}")
val historyLabel = context.getBuilderParameter("history label")
@@ -168,6 +168,7 @@ abstract class BaseGradleIT {
val withDaemon: Boolean = false,
val daemonOptionSupported: Boolean = true,
val incremental: Boolean? = null,
val incrementalJs: Boolean? = null,
val androidHome: File? = null,
val javaHome: File? = null,
val androidGradlePluginVersion: String? = null,
@@ -561,8 +562,8 @@ abstract class BaseGradleIT {
add("-Pkotlin_version=" + options.kotlinVersion)
options.incremental?.let {
add("-Pkotlin.incremental=$it")
add("-Pkotlin.incremental.js=$it")
}
options.incrementalJs?.let { add("-Pkotlin.incremental.js=$it") }
options.usePreciseJavaTracking?.let { add("-Pkotlin.incremental.usePreciseJavaTracking=$it") }
options.androidGradlePluginVersion?.let { add("-Pandroid_tools_version=$it") }
if (options.debug) {
@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.gradle
import org.jetbrains.kotlin.gradle.tasks.USING_INCREMENTAL_COMPILATION_MESSAGE
import org.jetbrains.kotlin.gradle.tasks.USING_JVM_INCREMENTAL_COMPILATION_MESSAGE
import org.jetbrains.kotlin.gradle.util.*
import org.junit.Assert
import org.junit.Test
@@ -139,7 +139,7 @@ open class Kapt3IT : Kapt3BaseIT() {
project.build("build", options = defaultBuildOptions().copy(incremental = false)) {
assertSuccessful()
assertTasksExecuted(":kaptGenerateStubsKotlin")
assertNotContains(USING_INCREMENTAL_COMPILATION_MESSAGE)
assertNotContains(USING_JVM_INCREMENTAL_COMPILATION_MESSAGE)
}
}
@@ -1,7 +1,7 @@
package org.jetbrains.kotlin.gradle
import org.gradle.api.logging.LogLevel
import org.jetbrains.kotlin.gradle.tasks.USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE
import org.jetbrains.kotlin.gradle.tasks.USING_JS_INCREMENTAL_COMPILATION_MESSAGE
import org.jetbrains.kotlin.gradle.util.getFileByName
import org.jetbrains.kotlin.gradle.util.getFilesByNames
import org.jetbrains.kotlin.gradle.util.modify
@@ -320,7 +320,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
fun testIncrementalCompilation() = Project("kotlin2JsICProject", GradleVersionRequired.AtLeast("4.0")).run {
build("build") {
assertSuccessful()
assertContains(USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE)
assertContains(USING_JS_INCREMENTAL_COMPILATION_MESSAGE)
assertCompiledKotlinSources(project.relativize(allKotlinFiles))
}
@@ -334,9 +334,19 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
}
build("build") {
assertSuccessful()
assertContains(USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE)
assertContains(USING_JS_INCREMENTAL_COMPILATION_MESSAGE)
val affectedFiles = project.projectDir.getFilesByNames("A.kt", "useAInLibMain.kt", "useAInAppMain.kt", "useAInAppTest.kt")
assertCompiledKotlinSources(project.relativize(affectedFiles))
}
}
@Test
fun testIncrementalCompilationDisabled() = Project("kotlin2JsICProject", GradleVersionRequired.AtLeast("4.0")).run {
val options = defaultBuildOptions().copy(incrementalJs = false)
build("build", options = options) {
assertSuccessful()
assertNotContains(USING_JS_INCREMENTAL_COMPILATION_MESSAGE)
}
}
}
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.gradle
import org.gradle.api.logging.LogLevel
import org.jetbrains.kotlin.gradle.plugin.CopyClassesToJavaOutputStatus
import org.jetbrains.kotlin.gradle.tasks.USING_INCREMENTAL_COMPILATION_MESSAGE
import org.jetbrains.kotlin.gradle.tasks.USING_JVM_INCREMENTAL_COMPILATION_MESSAGE
import org.jetbrains.kotlin.gradle.util.*
import org.junit.Test
import java.io.File
@@ -215,7 +215,7 @@ class KotlinGradleIT : BaseGradleIT() {
localPropertyFile.writeText("kotlin.incremental=true")
project.build("build") {
assertContains(USING_INCREMENTAL_COMPILATION_MESSAGE)
assertContains(USING_JVM_INCREMENTAL_COMPILATION_MESSAGE)
}
}
@@ -223,12 +223,12 @@ class KotlinGradleIT : BaseGradleIT() {
fun testIncrementalCompilationLogLevel() {
val infoProject = Project("kotlinProject", minLogLevel = LogLevel.INFO)
infoProject.build("build") {
assertContains(USING_INCREMENTAL_COMPILATION_MESSAGE)
assertContains(USING_JVM_INCREMENTAL_COMPILATION_MESSAGE)
}
val lifecycleProject = Project("kotlinProject", minLogLevel = LogLevel.LIFECYCLE)
lifecycleProject.build("build") {
assertNotContains(USING_INCREMENTAL_COMPILATION_MESSAGE)
assertNotContains(USING_JVM_INCREMENTAL_COMPILATION_MESSAGE)
}
}
@@ -45,8 +45,8 @@ import javax.inject.Inject
import kotlin.properties.Delegates
const val KOTLIN_BUILD_DIR_NAME = "kotlin"
const val USING_INCREMENTAL_COMPILATION_MESSAGE = "Using Kotlin incremental compilation"
const val USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE = "Using experimental Kotlin/JS incremental compilation"
const val USING_JVM_INCREMENTAL_COMPILATION_MESSAGE = "Using Kotlin/JVM incremental compilation"
const val USING_JS_INCREMENTAL_COMPILATION_MESSAGE = "Using Kotlin/JS incremental compilation"
abstract class AbstractKotlinCompileTool<T : CommonToolArguments>() : AbstractCompile(), CompilerArgumentAwareWithInput<T> {
private fun useCompilerClasspathConfigurationMessage(propertyName: String) {
@@ -392,7 +392,7 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
val compilerRunner = compilerRunner()
val icEnv = if (incremental) {
logger.info(USING_INCREMENTAL_COMPILATION_MESSAGE)
logger.info(USING_JVM_INCREMENTAL_COMPILATION_MESSAGE)
IncrementalCompilationEnvironment(
if (hasFilesInTaskBuildDirectory()) changedFiles else ChangedFiles.Unknown(),
taskBuildDirectory,
@@ -474,7 +474,12 @@ internal open class KotlinCompileCommonWithWorkers @Inject constructor(
}
@CacheableTask
open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(), KotlinJsCompile {
open class Kotlin2JsCompile : AbstractKotlinCompile<K2JSCompilerArguments>(), KotlinJsCompile {
init {
incremental = true
}
private val kotlinOptionsImpl = KotlinJsOptionsImpl()
override val kotlinOptions: KotlinJsOptions
@@ -546,7 +551,7 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
val compilerRunner = compilerRunner()
val icEnv = if (incremental) {
logger.warn(USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE)
logger.info(USING_JS_INCREMENTAL_COMPILATION_MESSAGE)
IncrementalCompilationEnvironment(
if (hasFilesInTaskBuildDirectory()) changedFiles else ChangedFiles.Unknown(),
taskBuildDirectory,