[Gradle] Add a property to control if the IC caches in-memory wrapper is enabled
#KT-56052 In Progress
This commit is contained in:
committed by
Space Team
parent
e7e5a3488b
commit
3ed651a7a6
+1
@@ -298,6 +298,7 @@ internal class GradleKotlinCompilerWork @Inject constructor(
|
||||
kotlinScriptExtensions = kotlinScriptExtensions,
|
||||
withAbiSnapshot = icEnv.withAbiSnapshot,
|
||||
preciseCompilationResultsBackup = icEnv.preciseCompilationResultsBackup,
|
||||
keepIncrementalCompilationCachesInMemory = icEnv.keepIncrementalCompilationCachesInMemory
|
||||
)
|
||||
|
||||
log.info("Options for KOTLIN DAEMON: $compilationOptions")
|
||||
|
||||
+2
-1
@@ -20,8 +20,9 @@ internal class IncrementalCompilationEnvironment(
|
||||
val multiModuleICSettings: MultiModuleICSettings,
|
||||
val withAbiSnapshot: Boolean = false,
|
||||
val preciseCompilationResultsBackup: Boolean = false,
|
||||
val keepIncrementalCompilationCachesInMemory: Boolean = false,
|
||||
) : Serializable {
|
||||
companion object {
|
||||
const val serialVersionUID: Long = 2
|
||||
const val serialVersionUID: Long = 3
|
||||
}
|
||||
}
|
||||
+8
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessageOutputStream
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.Companion.jsCompilerProperty
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_JS_STDLIB_DOM_API_INCLUDED
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_ABI_SNAPSHOT
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_COMPILER_KEEP_INCREMENTAL_COMPILATION_CACHES_IN_MEMORY
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_COMPILER_USE_PRECISE_COMPILATION_RESULTS_BACKUP
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_JS_KARMA_BROWSERS
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ANDROID_GRADLE_PLUGIN_COMPATIBILITY_NO_WARN
|
||||
@@ -511,6 +512,12 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
val preciseCompilationResultsBackup: Boolean
|
||||
get() = booleanProperty(KOTLIN_COMPILER_USE_PRECISE_COMPILATION_RESULTS_BACKUP) ?: false
|
||||
|
||||
/**
|
||||
* This property should be enabled together with [preciseCompilationResultsBackup]
|
||||
*/
|
||||
val keepIncrementalCompilationCachesInMemory: Boolean
|
||||
get() = booleanProperty(KOTLIN_COMPILER_KEEP_INCREMENTAL_COMPILATION_CACHES_IN_MEMORY) ?: false
|
||||
|
||||
/**
|
||||
* Retrieves a comma-separated list of browsers to use when running karma tests for [target]
|
||||
* @see KOTLIN_JS_KARMA_BROWSERS
|
||||
@@ -593,6 +600,7 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
const val KOTLIN_OPTIONS_SUPPRESS_FREEARGS_MODIFICATION_WARNING = "kotlin.options.suppressFreeCompilerArgsModificationWarning"
|
||||
const val KOTLIN_NATIVE_USE_XCODE_MESSAGE_STYLE = "kotlin.native.useXcodeMessageStyle"
|
||||
const val KOTLIN_COMPILER_USE_PRECISE_COMPILATION_RESULTS_BACKUP = "kotlin.compiler.preciseCompilationResultsBackup"
|
||||
const val KOTLIN_COMPILER_KEEP_INCREMENTAL_COMPILATION_CACHES_IN_MEMORY = "kotlin.compiler.keepIncrementalCompilationCachesInMemory"
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
+3
@@ -191,6 +191,9 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments> @Inject constr
|
||||
@get:Internal
|
||||
internal abstract val preciseCompilationResultsBackup: Property<Boolean>
|
||||
|
||||
@get:Internal
|
||||
internal abstract val keepIncrementalCompilationCachesInMemory: Property<Boolean>
|
||||
|
||||
/** Task outputs that we don't want to include in [TaskOutputsBackup] (see [TaskOutputsBackup.outputsToRestore] for more info). */
|
||||
@get:Internal
|
||||
internal abstract val taskOutputsBackupExcludes: SetProperty<File>
|
||||
|
||||
+1
@@ -300,6 +300,7 @@ abstract class Kotlin2JsCompile @Inject constructor(
|
||||
taskBuildCacheableOutputDirectory.get().asFile,
|
||||
multiModuleICSettings = multiModuleICSettings,
|
||||
preciseCompilationResultsBackup = preciseCompilationResultsBackup.get(),
|
||||
keepIncrementalCompilationCachesInMemory = keepIncrementalCompilationCachesInMemory.get(),
|
||||
)
|
||||
} else null
|
||||
|
||||
|
||||
+1
@@ -278,6 +278,7 @@ abstract class KotlinCompile @Inject constructor(
|
||||
multiModuleICSettings = multiModuleICSettings,
|
||||
withAbiSnapshot = useKotlinAbiSnapshot.get(),
|
||||
preciseCompilationResultsBackup = preciseCompilationResultsBackup.get(),
|
||||
keepIncrementalCompilationCachesInMemory = keepIncrementalCompilationCachesInMemory.get(),
|
||||
)
|
||||
} else null
|
||||
|
||||
|
||||
+6
@@ -100,6 +100,12 @@ internal abstract class AbstractKotlinCompileConfig<TASK : AbstractKotlinCompile
|
||||
task.taskOutputsBackupExcludes.addAll(task.preciseCompilationResultsBackup.map {
|
||||
if (it) listOf(task.destinationDirectory.get().asFile, task.taskBuildLocalStateDirectory.get().asFile) else emptyList()
|
||||
})
|
||||
task.keepIncrementalCompilationCachesInMemory
|
||||
.convention(task.preciseCompilationResultsBackup.map { it && propertiesProvider.keepIncrementalCompilationCachesInMemory })
|
||||
.finalizeValueOnRead()
|
||||
task.taskOutputsBackupExcludes.addAll(task.keepIncrementalCompilationCachesInMemory.map {
|
||||
if (it) listOf(task.taskBuildCacheableOutputDirectory.get().asFile) else emptyList()
|
||||
})
|
||||
|
||||
task.incremental = false
|
||||
task.useModuleDetection.convention(false)
|
||||
|
||||
Reference in New Issue
Block a user