[Gradle, IC] Add gradle property to control precise compilation outputs backup
#KT-49785 In Progress
This commit is contained in:
committed by
Space Team
parent
6a91dd6bac
commit
20ed029ba5
+2
-1
@@ -294,7 +294,8 @@ internal class GradleKotlinCompilerWork @Inject constructor(
|
||||
multiModuleICSettings = icEnv.multiModuleICSettings,
|
||||
modulesInfo = incrementalModuleInfo!!,
|
||||
kotlinScriptExtensions = kotlinScriptExtensions,
|
||||
withAbiSnapshot = icEnv.withAbiSnapshot
|
||||
withAbiSnapshot = icEnv.withAbiSnapshot,
|
||||
preciseCompilationResultsBackup = icEnv.preciseCompilationResultsBackup,
|
||||
)
|
||||
|
||||
log.info("Options for KOTLIN DAEMON: $compilationOptions")
|
||||
|
||||
+3
-2
@@ -18,9 +18,10 @@ internal class IncrementalCompilationEnvironment(
|
||||
val usePreciseJavaTracking: Boolean = false,
|
||||
val disableMultiModuleIC: Boolean = false,
|
||||
val multiModuleICSettings: MultiModuleICSettings,
|
||||
val withAbiSnapshot: Boolean = false
|
||||
val withAbiSnapshot: Boolean = false,
|
||||
val preciseCompilationResultsBackup: Boolean = false,
|
||||
) : Serializable {
|
||||
companion object {
|
||||
const val serialVersionUID: Long = 1
|
||||
const val serialVersionUID: Long = 2
|
||||
}
|
||||
}
|
||||
+5
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.gradle.dsl.NativeCacheOrchestration
|
||||
import org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessageOutputStreamHandler.Companion.IGNORE_TCSM_OVERFLOW
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.Companion.jsCompilerProperty
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_ABI_SNAPSHOT
|
||||
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
|
||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_ANDROID_STYLE_NO_WARN
|
||||
@@ -483,6 +484,9 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
val kotlinDaemonUseFallbackStrategy: Boolean
|
||||
get() = booleanProperty("kotlin.daemon.useFallbackStrategy") ?: true
|
||||
|
||||
val preciseCompilationResultsBackup: Boolean
|
||||
get() = booleanProperty(KOTLIN_COMPILER_USE_PRECISE_COMPILATION_RESULTS_BACKUP) ?: false
|
||||
|
||||
/**
|
||||
* Retrieves a comma-separated list of browsers to use when running karma tests for [target]
|
||||
* @see KOTLIN_JS_KARMA_BROWSERS
|
||||
@@ -556,6 +560,7 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
const val KOTLIN_BUILD_REPORT_HTTP_URL = "kotlin.build.report.http.url"
|
||||
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"
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
+15
-4
@@ -381,10 +381,19 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments> @Inject constr
|
||||
|
||||
private val systemPropertiesService = CompilerSystemPropertiesService.registerIfAbsent(project.gradle)
|
||||
|
||||
@get:Internal
|
||||
internal abstract val preciseCompilationResultsBackup: Property<Boolean>
|
||||
|
||||
/** Task outputs that we don't want to include in [TaskOutputsBackup] (see [TaskOutputsBackup.outputsToRestore] for more info). */
|
||||
@get:Internal
|
||||
protected open val taskOutputsBackupExcludes: List<File>
|
||||
get() = listOf(destinationDirectory.get().asFile)
|
||||
get() {
|
||||
val list = mutableListOf<File>()
|
||||
if (preciseCompilationResultsBackup.get()) {
|
||||
list.add(destinationDirectory.get().asFile)
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
fun execute(inputChanges: InputChanges) {
|
||||
@@ -749,11 +758,12 @@ abstract class KotlinCompile @Inject constructor(
|
||||
usePreciseJavaTracking = usePreciseJavaTracking,
|
||||
disableMultiModuleIC = disableMultiModuleIC,
|
||||
multiModuleICSettings = multiModuleICSettings,
|
||||
withAbiSnapshot = useKotlinAbiSnapshot.get()
|
||||
withAbiSnapshot = useKotlinAbiSnapshot.get(),
|
||||
preciseCompilationResultsBackup = preciseCompilationResultsBackup.get(),
|
||||
)
|
||||
} else null
|
||||
|
||||
@Suppress("ConvertArgumentToSet", "DEPRECATION")
|
||||
@Suppress("ConvertArgumentToSet")
|
||||
val environment = GradleCompilerEnvironment(
|
||||
defaultCompilerClasspath, gradleMessageCollector, outputItemCollector,
|
||||
// In the incremental compiler, outputFiles will be cleaned on rebuild. However, because classpathSnapshotDir is not included in
|
||||
@@ -1175,7 +1185,8 @@ abstract class Kotlin2JsCompile @Inject constructor(
|
||||
getChangedFiles(inputChanges, incrementalProps),
|
||||
ClasspathChanges.NotAvailableForJSCompiler,
|
||||
taskBuildCacheableOutputDirectory.get().asFile,
|
||||
multiModuleICSettings = multiModuleICSettings
|
||||
multiModuleICSettings = multiModuleICSettings,
|
||||
preciseCompilationResultsBackup = preciseCompilationResultsBackup.get(),
|
||||
)
|
||||
} else null
|
||||
|
||||
|
||||
+4
@@ -77,6 +77,10 @@ internal abstract class AbstractKotlinCompileConfig<TASK : AbstractKotlinCompile
|
||||
.convention(propertiesProvider.kotlinOptionsSuppressFreeArgsModificationWarning)
|
||||
.finalizeValueOnRead()
|
||||
|
||||
task.preciseCompilationResultsBackup
|
||||
.convention(propertiesProvider.preciseCompilationResultsBackup)
|
||||
.finalizeValueOnRead()
|
||||
|
||||
task.incremental = false
|
||||
task.useModuleDetection.convention(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user