Add property for precise version of Java tracking in Gradle IC
The flag name is kotlin.incremental.usePreciseJavaTracking By default precise version is disabled #KT-17621 Fixed
This commit is contained in:
+3
-2
@@ -38,5 +38,6 @@ internal class GradleIncrementalCompilerEnvironment(
|
||||
val artifactDifferenceRegistryProvider: ArtifactDifferenceRegistryProvider? = null,
|
||||
val artifactFile: File? = null,
|
||||
val buildHistoryFile: File? = null,
|
||||
val friendBuildHistoryFile: File? = null
|
||||
) : GradleCompilerEnvironment(compilerClasspath, messageCollector, outputItemsCollector, compilerArgs)
|
||||
val friendBuildHistoryFile: File? = null,
|
||||
val usePreciseJavaTracking: Boolean = false
|
||||
) : GradleCompilerEnvironment(compilerClasspath, messageCollector, outputItemsCollector, compilerArgs)
|
||||
|
||||
+2
-1
@@ -257,7 +257,8 @@ internal class GradleCompilerRunner(private val project: Project) : KotlinCompil
|
||||
compilerMode = CompilerMode.INCREMENTAL_COMPILER,
|
||||
targetPlatform = targetPlatform,
|
||||
resultDifferenceFile = environment.buildHistoryFile,
|
||||
friendDifferenceFile = environment.friendBuildHistoryFile
|
||||
friendDifferenceFile = environment.friendBuildHistoryFile,
|
||||
usePreciseJavaTracking = environment.usePreciseJavaTracking
|
||||
)
|
||||
|
||||
log.info("Options for KOTLIN DAEMON: $compilationOptions")
|
||||
|
||||
+7
-2
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
|
||||
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import java.util.*
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
|
||||
fun mapKotlinTaskProperties(project: Project, task: AbstractKotlinCompile<*>) {
|
||||
PropertiesProvider(project).apply {
|
||||
@@ -30,6 +29,9 @@ fun mapKotlinTaskProperties(project: Project, task: AbstractKotlinCompile<*>) {
|
||||
|
||||
if (task is KotlinCompile) {
|
||||
incrementalJvm?.let { task.incremental = it }
|
||||
usePreciseJavaTracking?.let {
|
||||
task.usePreciseJavaTracking = it
|
||||
}
|
||||
}
|
||||
|
||||
if (task is Kotlin2JsCompile) {
|
||||
@@ -62,6 +64,9 @@ internal class PropertiesProvider(private val project: Project) {
|
||||
val incrementalMultiplatform: Boolean?
|
||||
get() = booleanProperty("kotlin.incremental.multiplatform")
|
||||
|
||||
val usePreciseJavaTracking: Boolean?
|
||||
get() = booleanProperty("kotlin.incremental.usePreciseJavaTracking")
|
||||
|
||||
private fun booleanProperty(propName: String): Boolean? =
|
||||
property(propName)?.toBoolean()
|
||||
|
||||
@@ -72,4 +77,4 @@ internal class PropertiesProvider(private val project: Project) {
|
||||
else {
|
||||
localProperties.getProperty(propName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-2
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.gradle.tasks
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.file.SourceDirectorySet
|
||||
import org.gradle.api.logging.Logger
|
||||
import org.gradle.api.plugins.BasePluginConvention
|
||||
import org.gradle.api.tasks.Input
|
||||
@@ -250,6 +249,13 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
||||
internal var artifactDifferenceRegistryProvider: ArtifactDifferenceRegistryProvider? = null
|
||||
internal var artifactFile: File? = null
|
||||
|
||||
@get:Input
|
||||
var usePreciseJavaTracking: Boolean = false
|
||||
set(value) {
|
||||
field = value
|
||||
logger.kotlinDebug { "Set $this.usePreciseJavaTracking=$value" }
|
||||
}
|
||||
|
||||
init {
|
||||
incremental = true
|
||||
}
|
||||
@@ -314,7 +320,9 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
||||
artifactDifferenceRegistryProvider,
|
||||
artifactFile = artifactFile,
|
||||
buildHistoryFile = buildHistoryFile,
|
||||
friendBuildHistoryFile = friendTask?.buildHistoryFile)
|
||||
friendBuildHistoryFile = friendTask?.buildHistoryFile,
|
||||
usePreciseJavaTracking = usePreciseJavaTracking
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user