KT-45777: Shrink classpath snapshot incrementally
Currently, we shrink classpath snapshots at 2 steps:
- Classpath diffing: Shrink the current classpath snapshot against
the previous lookup symbols
- Classpath snapshot saving: Shrink the current classpath snapshot
against the current lookup symbols
With this commit, the shrinking at the second step is now incremental.
The shrinking at the first step is still non-incremental.
This commit is contained in:
+4
-5
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.compilerRunner
|
||||
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.FileSystemOperations
|
||||
import org.gradle.api.logging.Logging
|
||||
@@ -45,7 +44,7 @@ internal class GradleCompilerRunnerWithWorkers(
|
||||
workQueue.submit(GradleKotlinCompilerWorkAction::class.java) { params ->
|
||||
params.compilerWorkArguments.set(workArgs)
|
||||
if (taskOutputsBackup != null) {
|
||||
params.taskOutputs.from(taskOutputsBackup.outputs)
|
||||
params.taskOutputs.set(taskOutputsBackup.outputs)
|
||||
params.buildDir.set(taskOutputsBackup.buildDirectory)
|
||||
params.snapshotsDir.set(taskOutputsBackup.snapshotsDir)
|
||||
params.metricsReporter.set(buildMetrics)
|
||||
@@ -66,8 +65,8 @@ internal class GradleCompilerRunnerWithWorkers(
|
||||
fileSystemOperations,
|
||||
parameters.buildDir,
|
||||
parameters.snapshotsDir,
|
||||
parameters.taskOutputs.files.toList(),
|
||||
emptyList(),
|
||||
parameters.taskOutputs.get(),
|
||||
outputsToExclude = emptyList(),
|
||||
logger
|
||||
)
|
||||
} else {
|
||||
@@ -98,7 +97,7 @@ internal class GradleCompilerRunnerWithWorkers(
|
||||
|
||||
internal interface GradleKotlinCompilerWorkParameters : WorkParameters {
|
||||
val compilerWorkArguments: Property<GradleKotlinCompilerWorkArguments>
|
||||
val taskOutputs: ConfigurableFileCollection
|
||||
val taskOutputs: ListProperty<File>
|
||||
val snapshotsDir: DirectoryProperty
|
||||
val buildDir: DirectoryProperty
|
||||
val metricsReporter: Property<BuildMetricsReporter>
|
||||
|
||||
+1
-2
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.gradle.report.data.BuildExecutionDataProcessor
|
||||
import org.jetbrains.kotlin.gradle.report.data.TaskExecutionData
|
||||
import org.jetbrains.kotlin.gradle.utils.Printer
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import kotlin.math.max
|
||||
|
||||
internal class PlainTextBuildReportWriter(
|
||||
@@ -102,7 +101,7 @@ internal class PlainTextBuildReportWriter(
|
||||
|
||||
p.withIndent("Build performance metrics:") {
|
||||
for (metric in BuildPerformanceMetric.values()) {
|
||||
p.println("${metric.name}: ${allBuildMetrics[metric]}")
|
||||
allBuildMetrics[metric]?.let { p.println("${metric.name}: $it") }
|
||||
}
|
||||
}
|
||||
p.println()
|
||||
|
||||
+2
-1
@@ -57,6 +57,7 @@ import org.jetbrains.kotlin.incremental.ChangedFiles
|
||||
import org.jetbrains.kotlin.incremental.ClasspathChanges
|
||||
import org.jetbrains.kotlin.incremental.ClasspathChanges.ClasspathSnapshotDisabled
|
||||
import org.jetbrains.kotlin.incremental.ClasspathChanges.ClasspathSnapshotEnabled.*
|
||||
import org.jetbrains.kotlin.incremental.ClasspathChanges.ClasspathSnapshotEnabled.IncrementalRun.*
|
||||
import org.jetbrains.kotlin.incremental.ClasspathSnapshotFiles
|
||||
import org.jetbrains.kotlin.incremental.IncrementalCompilerRunner
|
||||
import org.jetbrains.kotlin.library.impl.isKotlinLibrary
|
||||
@@ -852,7 +853,7 @@ abstract class KotlinCompile @Inject constructor(
|
||||
)
|
||||
when {
|
||||
!inputChanges.isIncremental -> NotAvailableForNonIncrementalRun(classpathSnapshotFiles)
|
||||
inputChanges.getFileChanges(classpathSnapshotProperties.classpathSnapshot).none() -> Empty(classpathSnapshotFiles)
|
||||
inputChanges.getFileChanges(classpathSnapshotProperties.classpathSnapshot).none() -> NoChanges(classpathSnapshotFiles)
|
||||
!classpathSnapshotFiles.shrunkPreviousClasspathSnapshotFile.exists() -> {
|
||||
// When this happens, it means that the classpath snapshot in the previous run was not saved for some reason. It's
|
||||
// likely that there were no source files to compile, so the task action was skipped (see
|
||||
|
||||
Reference in New Issue
Block a user