KT-45777: Support compile avoidance
Test: Updated existing incremental compilation integration tests
This commit is contained in:
committed by
nataliya.valtman
parent
f400305cc6
commit
a6d0fcc676
+2
-2
@@ -159,7 +159,7 @@ class IncrementalCompilationClasspathSnapshotJvmMultiProjectIT : IncrementalComp
|
||||
modifyProject = changeMethodBodyInLib,
|
||||
assertResults = {
|
||||
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||
assertTasksExecuted(":app:$compileKotlinTaskName") // TODO: App compilation should have 'compile avoidance'
|
||||
assertTasksUpToDate(":app:$compileKotlinTaskName") // App compilation has 'compile avoidance'
|
||||
assertCompiledKotlinFiles(File(project.projectDir, "lib").getFilesByNames("A.kt"))
|
||||
}
|
||||
)
|
||||
@@ -198,7 +198,7 @@ class IncrementalCompilationClasspathSnapshotJvmMultiProjectIT : IncrementalComp
|
||||
override fun testCompileLibWithGroovy() {
|
||||
testCompileLibWithGroovy_doTest {
|
||||
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||
assertTasksExecuted(":app:$compileKotlinTaskName") // TODO: App compilation should have 'compile avoidance'
|
||||
assertTasksUpToDate(":app:$compileKotlinTaskName") // App compilation has 'compile avoidance'
|
||||
assertCompiledKotlinFiles(listOf(File(project.projectDir, "lib").getFileByName("A.kt")))
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ class IncrementalJavaChangeClasspathSnapshotIT : IncrementalJavaChangeDefaultIT(
|
||||
javaClassInLib, changeMethodBody,
|
||||
assertResults = {
|
||||
assertTasksExecuted(":lib:compileKotlin")
|
||||
assertTasksExecuted(":app:compileKotlin") // TODO: App compilation should have 'compile avoidance'
|
||||
assertTasksUpToDate(":app:compileKotlin") // App compilation has 'compile avoidance'
|
||||
assertCompiledKotlinFiles(emptyList())
|
||||
}
|
||||
)
|
||||
|
||||
+13
-1
@@ -547,6 +547,8 @@ abstract class KotlinCompile @Inject constructor(
|
||||
val classpathSnapshotDir = getClasspathSnapshotDir(task)
|
||||
task.classpathSnapshotProperties.classpathSnapshotDir.value(classpathSnapshotDir).disallowChanges()
|
||||
task.classpathSnapshotProperties.classpathSnapshotDirFileCollection.from(classpathSnapshotDir)
|
||||
} else {
|
||||
task.classpathSnapshotProperties.classpath.from(task.project.provider { task.classpath })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -578,6 +580,11 @@ abstract class KotlinCompile @Inject constructor(
|
||||
logger.kotlinDebug { "Set $this.usePreciseJavaTracking=$value" }
|
||||
}
|
||||
|
||||
@Internal // To support compile avoidance (ClasspathSnapshotProperties.classpathSnapshot will be used as input instead)
|
||||
override fun getClasspath(): FileCollection {
|
||||
return super.getClasspath()
|
||||
}
|
||||
|
||||
@get:Nested
|
||||
abstract val classpathSnapshotProperties: ClasspathSnapshotProperties
|
||||
|
||||
@@ -591,6 +598,11 @@ abstract class KotlinCompile @Inject constructor(
|
||||
@get:Optional // Set if useClasspathSnapshot == true
|
||||
abstract val classpathSnapshot: ConfigurableFileCollection
|
||||
|
||||
@get:Classpath
|
||||
@get:Incremental
|
||||
@get:Optional // Set if useClasspathSnapshot == false (to restore the existing classpath annotations when the feature is disabled)
|
||||
abstract val classpath: ConfigurableFileCollection
|
||||
|
||||
@get:OutputDirectory
|
||||
@get:Optional // Set if useClasspathSnapshot == true
|
||||
abstract val classpathSnapshotDir: DirectoryProperty
|
||||
@@ -663,7 +675,7 @@ abstract class KotlinCompile @Inject constructor(
|
||||
}
|
||||
|
||||
override val incrementalProps: List<FileCollection>
|
||||
get() = super.incrementalProps + listOf(classpathSnapshotProperties.classpathSnapshot)
|
||||
get() = listOf(stableSources, commonSourceSet, classpathSnapshotProperties.classpath, classpathSnapshotProperties.classpathSnapshot)
|
||||
|
||||
override fun getSourceRoots(): SourceRoots.ForJvm = jvmSourceRoots
|
||||
|
||||
|
||||
Reference in New Issue
Block a user