Enable new incremental compilation by default
#KT-53832 Fixed
This commit is contained in:
+2
-2
@@ -148,7 +148,7 @@ class BuildCacheIT : KGPBaseTest() {
|
|||||||
@DisplayName("Restore from build cache should not break incremental compilation")
|
@DisplayName("Restore from build cache should not break incremental compilation")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
fun testIncrementalCompilationAfterCacheHit(gradleVersion: GradleVersion) {
|
fun testIncrementalCompilationAfterCacheHit(gradleVersion: GradleVersion) {
|
||||||
project("incrementalMultiproject", gradleVersion, buildOptions = defaultBuildOptions.copy(useICClasspathSnapshot = true)) {
|
project("incrementalMultiproject", gradleVersion, buildOptions = defaultBuildOptions.copy(useICClasspathSnapshot = true, useGradleClasspathSnapshot = false)) {
|
||||||
enableLocalBuildCache(localBuildCacheDir)
|
enableLocalBuildCache(localBuildCacheDir)
|
||||||
build("assemble")
|
build("assemble")
|
||||||
build("clean", "assemble") {
|
build("clean", "assemble") {
|
||||||
@@ -159,7 +159,7 @@ class BuildCacheIT : KGPBaseTest() {
|
|||||||
|
|
||||||
bKtSourceFile.modify { it.replace("fun b() {}", "fun b() {}\nfun b2() {}") }
|
bKtSourceFile.modify { it.replace("fun b() {}", "fun b() {}\nfun b2() {}") }
|
||||||
|
|
||||||
build("assemble", buildOptions = defaultBuildOptions.copy(useICClasspathSnapshot = true, logLevel = LogLevel.DEBUG)) {
|
build("assemble", buildOptions = defaultBuildOptions.copy(useICClasspathSnapshot = true, useGradleClasspathSnapshot = false, logLevel = LogLevel.DEBUG)) {
|
||||||
assertIncrementalCompilation(expectedCompiledKotlinFiles = setOf(bKtSourceFile).map { it.relativeTo(projectPath)})
|
assertIncrementalCompilation(expectedCompiledKotlinFiles = setOf(bKtSourceFile).map { it.relativeTo(projectPath)})
|
||||||
assertOutputContains("Incremental compilation with ABI snapshot enabled")
|
assertOutputContains("Incremental compilation with ABI snapshot enabled")
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -306,10 +306,11 @@ class BuildCacheRelocationIT : KGPBaseTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmGradlePluginTests
|
@JvmGradlePluginTests
|
||||||
@DisplayName("Kotlin incremental compilation should work correctly")
|
@DisplayName("Kotlin incremental compilation should work correctly after cache hint")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
fun testKotlinIncrementalCompilation(gradleVersion: GradleVersion) {
|
fun testKotlinIncrementalCompilation(gradleVersion: GradleVersion) {
|
||||||
checkKotlinIncrementalCompilationAfterCacheHit(gradleVersion) {
|
val options = defaultBuildOptions.copy(useGradleClasspathSnapshot = false)
|
||||||
|
checkKotlinIncrementalCompilationAfterCacheHit(gradleVersion, options) {
|
||||||
assertNonIncrementalCompilation()
|
assertNonIncrementalCompilation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+172
-78
@@ -40,6 +40,98 @@ class IncrementalCompilationJsMultiProjectIT : BaseIncrementalCompilationMultiPr
|
|||||||
|
|
||||||
//compileKotlin2Js's modification doe not work
|
//compileKotlin2Js's modification doe not work
|
||||||
override fun testFailureHandling_ToolError(gradleVersion: GradleVersion) {}
|
override fun testFailureHandling_ToolError(gradleVersion: GradleVersion) {}
|
||||||
|
|
||||||
|
@DisplayName("Add new dependency in lib project")
|
||||||
|
@GradleTest
|
||||||
|
override fun testAddDependencyInLib(gradleVersion: GradleVersion) {
|
||||||
|
defaultProject(gradleVersion) {
|
||||||
|
build("assemble")
|
||||||
|
|
||||||
|
testAddDependencyInLib_modifyProject()
|
||||||
|
|
||||||
|
build("assemble") {
|
||||||
|
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||||
|
assertTasksUpToDate(":app:$compileKotlinTaskName")
|
||||||
|
assertCompiledKotlinSources(
|
||||||
|
subProject("lib").projectPath.resolve("src").allKotlinSources.relativizeTo(projectPath),
|
||||||
|
output
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DisplayName("ABI change in lib after lib clean")
|
||||||
|
@GradleTest
|
||||||
|
override fun testAbiChangeInLib_afterLibClean(gradleVersion: GradleVersion) {
|
||||||
|
defaultProject(gradleVersion) {
|
||||||
|
build("assemble")
|
||||||
|
|
||||||
|
build(":lib:clean")
|
||||||
|
changeMethodSignatureInLib()
|
||||||
|
|
||||||
|
build("assemble") {
|
||||||
|
assertCompiledKotlinSources(
|
||||||
|
subProject("lib")
|
||||||
|
.projectPath
|
||||||
|
.resolve("src")
|
||||||
|
.allKotlinSources
|
||||||
|
.relativizeTo(projectPath) +
|
||||||
|
subProject("app")
|
||||||
|
.projectPath
|
||||||
|
.resolve("src")
|
||||||
|
.allKotlinSources
|
||||||
|
.relativizeTo(projectPath),
|
||||||
|
output
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DisplayName("Lib: change method body with non-ABI change")
|
||||||
|
@GradleTest
|
||||||
|
override fun testNonAbiChangeInLib_changeMethodBody(gradleVersion: GradleVersion) {
|
||||||
|
defaultProject(gradleVersion) {
|
||||||
|
build("assemble")
|
||||||
|
|
||||||
|
changeMethodBodyInLib()
|
||||||
|
|
||||||
|
build("assemble") {
|
||||||
|
assertCompiledKotlinSources(
|
||||||
|
getExpectedKotlinSourcesForDefaultProject(
|
||||||
|
libSources = listOf("bar/A.kt")
|
||||||
|
),
|
||||||
|
output
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DisplayName("Lib: after cleaning lib project")
|
||||||
|
@GradleTest
|
||||||
|
override fun testAbiChangeInLib_afterLibClean_withAbiSnapshot(gradleVersion: GradleVersion) {
|
||||||
|
defaultProject(gradleVersion) {
|
||||||
|
build("assemble")
|
||||||
|
|
||||||
|
build(":lib:clean")
|
||||||
|
changeMethodSignatureInLib()
|
||||||
|
|
||||||
|
build("assemble") {
|
||||||
|
// TODO: With ABI snapshot, app compilation should be incremental, currently it is not.
|
||||||
|
assertCompiledKotlinSources(
|
||||||
|
(subProject("lib")
|
||||||
|
.projectPath
|
||||||
|
.resolve("src")
|
||||||
|
.allKotlinSources +
|
||||||
|
subProject("app")
|
||||||
|
.projectPath
|
||||||
|
.resolve("src")
|
||||||
|
.allKotlinSources)
|
||||||
|
.map { it.relativeTo(projectPath) },
|
||||||
|
output
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmGradlePluginTests
|
@JvmGradlePluginTests
|
||||||
@@ -56,11 +148,10 @@ open class IncrementalCompilationJvmMultiProjectIT : BaseIncrementalCompilationM
|
|||||||
override val defaultProjectName: String = "incrementalMultiproject"
|
override val defaultProjectName: String = "incrementalMultiproject"
|
||||||
|
|
||||||
@DisplayName("'inspectClassesForKotlinIC' task is added to execution plan")
|
@DisplayName("'inspectClassesForKotlinIC' task is added to execution plan")
|
||||||
@GradleTest
|
|
||||||
open fun testInspectClassesForKotlinICTask(gradleVersion: GradleVersion) {
|
open fun testInspectClassesForKotlinICTask(gradleVersion: GradleVersion) {
|
||||||
defaultProject(gradleVersion) {
|
defaultProject(gradleVersion) {
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
assertTasksExecuted(
|
assertTasksSkipped(
|
||||||
":lib:inspectClassesForKotlinIC",
|
":lib:inspectClassesForKotlinIC",
|
||||||
":app:inspectClassesForKotlinIC"
|
":app:inspectClassesForKotlinIC"
|
||||||
)
|
)
|
||||||
@@ -89,18 +180,15 @@ open class IncrementalCompilationJvmMultiProjectIT : BaseIncrementalCompilationM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName(
|
@DisplayName("Compile lib with Groovy")
|
||||||
"checks that multi-project ic is disabled when there is a task that outputs to javaDestination dir " +
|
|
||||||
"that is not JavaCompile or KotlinCompile"
|
|
||||||
)
|
|
||||||
@GradleTest
|
@GradleTest
|
||||||
open fun testCompileLibWithGroovy(gradleVersion: GradleVersion) {
|
open fun testCompileLibWithGroovy(gradleVersion: GradleVersion) {
|
||||||
testCompileLibWithGroovy_doTest(gradleVersion) { project, result ->
|
testCompileLibWithGroovy_doTest(gradleVersion) { project, result ->
|
||||||
val expectedSources = project.subProject("app").projectPath.resolve("src").allKotlinSources +
|
result.assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||||
listOf(project.subProject("lib").kotlinSourcesDir().resolve("bar/A.kt"))
|
result.assertTasksUpToDate(":app:$compileKotlinTaskName") // App compilation has 'compile avoidance'
|
||||||
|
|
||||||
assertCompiledKotlinSources(
|
assertCompiledKotlinSources(
|
||||||
expectedSources.map { it.relativeTo(project.projectPath) },
|
project.getExpectedKotlinSourcesForDefaultProject(libSources = listOf("bar/A.kt")),
|
||||||
result.output
|
result.output
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -189,15 +277,16 @@ class IncrementalCompilationFirJvmMultiProjectIT : IncrementalCompilationJvmMult
|
|||||||
override val defaultBuildOptions: BuildOptions = super.defaultBuildOptions.copy(useFir = true)
|
override val defaultBuildOptions: BuildOptions = super.defaultBuildOptions.copy(useFir = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
class IncrementalCompilationClasspathSnapshotJvmMultiProjectIT : IncrementalCompilationJvmMultiProjectIT() {
|
class IncrementalCompilationOldICJvmMultiProjectIT : IncrementalCompilationJvmMultiProjectIT() {
|
||||||
|
|
||||||
override val defaultBuildOptions = super.defaultBuildOptions.copy(useGradleClasspathSnapshot = true)
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(useGradleClasspathSnapshot = false)
|
||||||
|
|
||||||
@DisplayName("'inspectClassesForKotlinIC' task is added to execution plan")
|
@DisplayName("'inspectClassesForKotlinIC' task is added to execution plan")
|
||||||
|
@GradleTest
|
||||||
override fun testInspectClassesForKotlinICTask(gradleVersion: GradleVersion) {
|
override fun testInspectClassesForKotlinICTask(gradleVersion: GradleVersion) {
|
||||||
defaultProject(gradleVersion) {
|
defaultProject(gradleVersion) {
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
assertTasksSkipped(
|
assertTasksExecuted(
|
||||||
":lib:inspectClassesForKotlinIC",
|
":lib:inspectClassesForKotlinIC",
|
||||||
":app:inspectClassesForKotlinIC"
|
":app:inspectClassesForKotlinIC"
|
||||||
)
|
)
|
||||||
@@ -205,7 +294,8 @@ class IncrementalCompilationClasspathSnapshotJvmMultiProjectIT : IncrementalComp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("Lib: Non ABI change in method body")
|
|
||||||
|
@DisplayName("Lib: change method body with non-ABI change")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
override fun testNonAbiChangeInLib_changeMethodBody(gradleVersion: GradleVersion) {
|
override fun testNonAbiChangeInLib_changeMethodBody(gradleVersion: GradleVersion) {
|
||||||
defaultProject(gradleVersion) {
|
defaultProject(gradleVersion) {
|
||||||
@@ -214,17 +304,17 @@ class IncrementalCompilationClasspathSnapshotJvmMultiProjectIT : IncrementalComp
|
|||||||
changeMethodBodyInLib()
|
changeMethodBodyInLib()
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
|
||||||
assertTasksUpToDate(":app:$compileKotlinTaskName")
|
|
||||||
assertCompiledKotlinSources(
|
assertCompiledKotlinSources(
|
||||||
getExpectedKotlinSourcesForDefaultProject(libSources = listOf("bar/A.kt")),
|
getExpectedKotlinSourcesForDefaultProject(
|
||||||
|
libSources = listOf("bar/A.kt")
|
||||||
|
),
|
||||||
output
|
output
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("Add dependency in lib subproject")
|
@DisplayName("Add new dependency in lib project")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
override fun testAddDependencyInLib(gradleVersion: GradleVersion) {
|
override fun testAddDependencyInLib(gradleVersion: GradleVersion) {
|
||||||
defaultProject(gradleVersion) {
|
defaultProject(gradleVersion) {
|
||||||
@@ -235,15 +325,18 @@ class IncrementalCompilationClasspathSnapshotJvmMultiProjectIT : IncrementalComp
|
|||||||
build("assemble") {
|
build("assemble") {
|
||||||
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||||
assertTasksUpToDate(":app:$compileKotlinTaskName")
|
assertTasksUpToDate(":app:$compileKotlinTaskName")
|
||||||
// Lib compilation is incremental (no files are recompiled)
|
assertCompiledKotlinSources(
|
||||||
assertCompiledKotlinSources(emptyList(), output)
|
subProject("lib").projectPath.resolve("src").allKotlinSources.relativizeTo(projectPath),
|
||||||
|
output
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("after lib project clean")
|
@DisplayName("ABI change in lib after lib clean")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
override fun testAbiChangeInLib_afterLibClean(gradleVersion: GradleVersion) {
|
override fun testAbiChangeInLib_afterLibClean(gradleVersion: GradleVersion) {
|
||||||
|
// To see if app compilation can be incremental after non-incremental lib compilation
|
||||||
defaultProject(gradleVersion) {
|
defaultProject(gradleVersion) {
|
||||||
build("assemble")
|
build("assemble")
|
||||||
|
|
||||||
@@ -251,44 +344,67 @@ class IncrementalCompilationClasspathSnapshotJvmMultiProjectIT : IncrementalComp
|
|||||||
changeMethodSignatureInLib()
|
changeMethodSignatureInLib()
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
val expectedSources = getExpectedKotlinSourcesForDefaultProject(
|
assertCompiledKotlinSources(
|
||||||
appSources = listOf("foo/AA.kt", "foo/AAA.kt", "foo/BB.kt", "foo/fooUseA.kt")
|
subProject("lib")
|
||||||
) + subProject("lib").projectPath.resolve("src").allKotlinSources.map { it.relativeTo(projectPath) }
|
.projectPath
|
||||||
|
.resolve("src")
|
||||||
assertCompiledKotlinSources(expectedSources, output)
|
.allKotlinSources
|
||||||
|
.relativizeTo(projectPath) +
|
||||||
|
subProject("app")
|
||||||
|
.projectPath
|
||||||
|
.resolve("src")
|
||||||
|
.allKotlinSources
|
||||||
|
.relativizeTo(projectPath),
|
||||||
|
output
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("Compile lib with Groovy")
|
@DisplayName(
|
||||||
|
"checks that multi-project ic is disabled when there is a task that outputs to javaDestination dir " +
|
||||||
|
"that is not JavaCompile or KotlinCompile"
|
||||||
|
)
|
||||||
@GradleTest
|
@GradleTest
|
||||||
override fun testCompileLibWithGroovy(gradleVersion: GradleVersion) {
|
override fun testCompileLibWithGroovy(gradleVersion: GradleVersion) {
|
||||||
testCompileLibWithGroovy_doTest(gradleVersion) { project, result ->
|
testCompileLibWithGroovy_doTest(gradleVersion) { project, result ->
|
||||||
result.assertTasksExecuted(":lib:$compileKotlinTaskName")
|
val expectedSources = project.subProject("app").projectPath.resolve("src").allKotlinSources +
|
||||||
result.assertTasksUpToDate(":app:$compileKotlinTaskName") // App compilation has 'compile avoidance'
|
listOf(project.subProject("lib").kotlinSourcesDir().resolve("bar/A.kt"))
|
||||||
|
|
||||||
assertCompiledKotlinSources(
|
assertCompiledKotlinSources(
|
||||||
project.getExpectedKotlinSourcesForDefaultProject(libSources = listOf("bar/A.kt")),
|
expectedSources.map { it.relativeTo(project.projectPath) },
|
||||||
result.output
|
result.output
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("Lib: after cleaning lib project")
|
|
||||||
|
@DisplayName("Lib with abi snapshot: after clean build")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
override fun testAbiChangeInLib_afterLibClean_withAbiSnapshot(gradleVersion: GradleVersion) {
|
override fun testAbiChangeInLib_afterLibClean_withAbiSnapshot(gradleVersion: GradleVersion) {
|
||||||
defaultProject(gradleVersion) {
|
defaultProject(
|
||||||
|
gradleVersion,
|
||||||
|
buildOptions = defaultBuildOptions.copy(useGradleClasspathSnapshot = true)
|
||||||
|
) {
|
||||||
build("assemble")
|
build("assemble")
|
||||||
|
|
||||||
build(":lib:clean")
|
build(":lib:clean")
|
||||||
changeMethodSignatureInLib()
|
changeMethodSignatureInLib()
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
val expectedSources = getExpectedKotlinSourcesForDefaultProject(
|
// TODO: With ABI snapshot, app compilation should be incremental, currently it is not.
|
||||||
appSources = listOf("foo/AA.kt", "foo/AAA.kt", "foo/BB.kt", "foo/fooUseA.kt")
|
assertCompiledKotlinSources(
|
||||||
) + subProject("lib").projectPath.resolve("src").allKotlinSources.map { it.relativeTo(projectPath) }
|
(subProject("lib")
|
||||||
|
.projectPath
|
||||||
assertCompiledKotlinSources(expectedSources, output)
|
.resolve("src")
|
||||||
|
.allKotlinSources +
|
||||||
|
subProject("app")
|
||||||
|
.projectPath
|
||||||
|
.resolve("src")
|
||||||
|
.allKotlinSources)
|
||||||
|
.map { it.relativeTo(projectPath) },
|
||||||
|
output
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -380,7 +496,7 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("Lib: change method body with non-ABI change")
|
@DisplayName("Lib: Non ABI change in method body")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
open fun testNonAbiChangeInLib_changeMethodBody(gradleVersion: GradleVersion) {
|
open fun testNonAbiChangeInLib_changeMethodBody(gradleVersion: GradleVersion) {
|
||||||
defaultProject(gradleVersion) {
|
defaultProject(gradleVersion) {
|
||||||
@@ -389,17 +505,17 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
|
|||||||
changeMethodBodyInLib()
|
changeMethodBodyInLib()
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
|
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||||
|
assertTasksUpToDate(":app:$compileKotlinTaskName")
|
||||||
assertCompiledKotlinSources(
|
assertCompiledKotlinSources(
|
||||||
getExpectedKotlinSourcesForDefaultProject(
|
getExpectedKotlinSourcesForDefaultProject(libSources = listOf("bar/A.kt")),
|
||||||
libSources = listOf("bar/A.kt")
|
|
||||||
),
|
|
||||||
output
|
output
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("Add new dependency in lib project")
|
@DisplayName("Add dependency in lib subproject")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
open fun testAddDependencyInLib(gradleVersion: GradleVersion) {
|
open fun testAddDependencyInLib(gradleVersion: GradleVersion) {
|
||||||
defaultProject(gradleVersion) {
|
defaultProject(gradleVersion) {
|
||||||
@@ -410,10 +526,8 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
|
|||||||
build("assemble") {
|
build("assemble") {
|
||||||
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||||
assertTasksUpToDate(":app:$compileKotlinTaskName")
|
assertTasksUpToDate(":app:$compileKotlinTaskName")
|
||||||
assertCompiledKotlinSources(
|
// Lib compilation is incremental (no files are recompiled)
|
||||||
subProject("lib").projectPath.resolve("src").allKotlinSources.relativizeTo(projectPath),
|
assertCompiledKotlinSources(emptyList(), output)
|
||||||
output
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -430,10 +544,9 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("ABI change in lib after lib clean")
|
@DisplayName("after lib project clean")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
open fun testAbiChangeInLib_afterLibClean(gradleVersion: GradleVersion) {
|
open fun testAbiChangeInLib_afterLibClean(gradleVersion: GradleVersion) {
|
||||||
// To see if app compilation can be incremental after non-incremental lib compilation
|
|
||||||
defaultProject(gradleVersion) {
|
defaultProject(gradleVersion) {
|
||||||
build("assemble")
|
build("assemble")
|
||||||
|
|
||||||
@@ -441,19 +554,11 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
|
|||||||
changeMethodSignatureInLib()
|
changeMethodSignatureInLib()
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
assertCompiledKotlinSources(
|
val expectedSources = getExpectedKotlinSourcesForDefaultProject(
|
||||||
subProject("lib")
|
appSources = listOf("foo/AA.kt", "foo/AAA.kt", "foo/BB.kt", "foo/fooUseA.kt")
|
||||||
.projectPath
|
) + subProject("lib").projectPath.resolve("src").allKotlinSources.map { it.relativeTo(projectPath) }
|
||||||
.resolve("src")
|
|
||||||
.allKotlinSources
|
assertCompiledKotlinSources(expectedSources, output)
|
||||||
.relativizeTo(projectPath) +
|
|
||||||
subProject("app")
|
|
||||||
.projectPath
|
|
||||||
.resolve("src")
|
|
||||||
.allKotlinSources
|
|
||||||
.relativizeTo(projectPath),
|
|
||||||
output
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -595,32 +700,21 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("Lib with abi snapshot: after clean build")
|
@DisplayName("Lib: after cleaning lib project")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
open fun testAbiChangeInLib_afterLibClean_withAbiSnapshot(gradleVersion: GradleVersion) {
|
open fun testAbiChangeInLib_afterLibClean_withAbiSnapshot(gradleVersion: GradleVersion) {
|
||||||
defaultProject(
|
defaultProject(gradleVersion) {
|
||||||
gradleVersion,
|
|
||||||
buildOptions = defaultBuildOptions.copy(useGradleClasspathSnapshot = true)
|
|
||||||
) {
|
|
||||||
build("assemble")
|
build("assemble")
|
||||||
|
|
||||||
build(":lib:clean")
|
build(":lib:clean")
|
||||||
changeMethodSignatureInLib()
|
changeMethodSignatureInLib()
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
// TODO: With ABI snapshot, app compilation should be incremental, currently it is not.
|
val expectedSources = getExpectedKotlinSourcesForDefaultProject(
|
||||||
assertCompiledKotlinSources(
|
appSources = listOf("foo/AA.kt", "foo/AAA.kt", "foo/BB.kt", "foo/fooUseA.kt")
|
||||||
(subProject("lib")
|
) + subProject("lib").projectPath.resolve("src").allKotlinSources.map { it.relativeTo(projectPath) }
|
||||||
.projectPath
|
|
||||||
.resolve("src")
|
assertCompiledKotlinSources(expectedSources, output)
|
||||||
.allKotlinSources +
|
|
||||||
subProject("app")
|
|
||||||
.projectPath
|
|
||||||
.resolve("src")
|
|
||||||
.allKotlinSources)
|
|
||||||
.map { it.relativeTo(projectPath) },
|
|
||||||
output
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-43
@@ -92,11 +92,11 @@ open class IncrementalJavaChangeDefaultIT : IncrementalCompilationJavaChangesBas
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("Incremental compilation via classpath snapshots with default precise java tracking")
|
@DisplayName("Incremental compilation via classpath snapshots with default precise java tracking")
|
||||||
class IncrementalJavaChangeClasspathSnapshotIT : IncrementalJavaChangeDefaultIT() {
|
class IncrementalJavaChangeOldICIT : IncrementalJavaChangeDefaultIT() {
|
||||||
|
|
||||||
override val defaultBuildOptions = super.defaultBuildOptions.copy(useGradleClasspathSnapshot = true)
|
override val defaultBuildOptions = super.defaultBuildOptions.copy(useGradleClasspathSnapshot = false)
|
||||||
|
|
||||||
@DisplayName("Lib: tracked method signature ABI change")
|
@DisplayName("Lib: method signature ABI change")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
override fun testAbiChangeInLib_changeMethodSignature(gradleVersion: GradleVersion) {
|
override fun testAbiChangeInLib_changeMethodSignature(gradleVersion: GradleVersion) {
|
||||||
defaultProject(gradleVersion) {
|
defaultProject(gradleVersion) {
|
||||||
@@ -105,12 +105,18 @@ class IncrementalJavaChangeClasspathSnapshotIT : IncrementalJavaChangeDefaultIT(
|
|||||||
javaClassInLib.modify(changeMethodSignature)
|
javaClassInLib.modify(changeMethodSignature)
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
// Fewer Kotlin files are recompiled
|
val expectedToCompileSources = sourceFilesRelativeToProject(
|
||||||
val expectedSources = sourceFilesRelativeToProject(
|
listOf(
|
||||||
listOf("foo/JavaClassChild.kt", "foo/useJavaClass.kt"),
|
"foo/JavaClassChild.kt",
|
||||||
|
"foo/useJavaClass.kt",
|
||||||
|
"foo/useJavaClassFooMethodUsage.kt"
|
||||||
|
),
|
||||||
subProjectName = "app"
|
subProjectName = "app"
|
||||||
)
|
)
|
||||||
assertCompiledKotlinSources(expectedSources, output)
|
assertCompiledKotlinSources(
|
||||||
|
expectedToCompileSources,
|
||||||
|
output
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,9 +130,19 @@ class IncrementalJavaChangeClasspathSnapshotIT : IncrementalJavaChangeDefaultIT(
|
|||||||
javaClassInLib.modify(changeMethodBody)
|
javaClassInLib.modify(changeMethodBody)
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
assertTasksExecuted(":lib:compileKotlin")
|
val expectedToCompileSources = sourceFilesRelativeToProject(
|
||||||
assertTasksUpToDate(":app:compileKotlin") // App compilation has 'compile avoidance'
|
listOf(
|
||||||
assertCompiledKotlinSources(emptyList(), output)
|
"foo/JavaClassChild.kt",
|
||||||
|
"foo/useJavaClass.kt",
|
||||||
|
"foo/useJavaClassFooMethodUsage.kt"
|
||||||
|
),
|
||||||
|
subProjectName = "app"
|
||||||
|
)
|
||||||
|
|
||||||
|
assertCompiledKotlinSources(
|
||||||
|
expectedToCompileSources,
|
||||||
|
output
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,8 +201,7 @@ open class IncrementalJavaChangeDisablePreciseIT : IncrementalCompilationJavaCha
|
|||||||
val expectedSources = sourceFilesRelativeToProject(
|
val expectedSources = sourceFilesRelativeToProject(
|
||||||
listOf(
|
listOf(
|
||||||
"foo/TrackedJavaClassChild.kt",
|
"foo/TrackedJavaClassChild.kt",
|
||||||
"foo/useTrackedJavaClass.kt",
|
"foo/useTrackedJavaClass.kt"
|
||||||
"foo/useTrackedJavaClassFooMethodUsage.kt"
|
|
||||||
),
|
),
|
||||||
subProjectName = "app"
|
subProjectName = "app"
|
||||||
) + sourceFilesRelativeToProject(
|
) + sourceFilesRelativeToProject(
|
||||||
@@ -208,13 +223,6 @@ open class IncrementalJavaChangeDisablePreciseIT : IncrementalCompilationJavaCha
|
|||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
val expectedSources = sourceFilesRelativeToProject(
|
val expectedSources = sourceFilesRelativeToProject(
|
||||||
listOf(
|
|
||||||
"foo/TrackedJavaClassChild.kt",
|
|
||||||
"foo/useTrackedJavaClass.kt",
|
|
||||||
"foo/useTrackedJavaClassFooMethodUsage.kt"
|
|
||||||
),
|
|
||||||
subProjectName = "app"
|
|
||||||
) + sourceFilesRelativeToProject(
|
|
||||||
listOf("bar/useTrackedJavaClassSameModule.kt"),
|
listOf("bar/useTrackedJavaClassSameModule.kt"),
|
||||||
subProjectName = "lib"
|
subProjectName = "lib"
|
||||||
)
|
)
|
||||||
@@ -243,7 +251,7 @@ abstract class IncrementalCompilationJavaChangesBase(
|
|||||||
protected val changeMethodSignature: (String) -> String = { it.replace("String getString", "Object getString") }
|
protected val changeMethodSignature: (String) -> String = { it.replace("String getString", "Object getString") }
|
||||||
protected val changeMethodBody: (String) -> String = { it.replace("Hello, World!", "Hello, World!!!!") }
|
protected val changeMethodBody: (String) -> String = { it.replace("Hello, World!", "Hello, World!!!!") }
|
||||||
|
|
||||||
@DisplayName("Lib: method signature ABI change")
|
@DisplayName("Lib: tracked method signature ABI change")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
open fun testAbiChangeInLib_changeMethodSignature(gradleVersion: GradleVersion) {
|
open fun testAbiChangeInLib_changeMethodSignature(gradleVersion: GradleVersion) {
|
||||||
defaultProject(gradleVersion) {
|
defaultProject(gradleVersion) {
|
||||||
@@ -252,18 +260,12 @@ abstract class IncrementalCompilationJavaChangesBase(
|
|||||||
javaClassInLib.modify(changeMethodSignature)
|
javaClassInLib.modify(changeMethodSignature)
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
val expectedToCompileSources = sourceFilesRelativeToProject(
|
// Fewer Kotlin files are recompiled
|
||||||
listOf(
|
val expectedSources = sourceFilesRelativeToProject(
|
||||||
"foo/JavaClassChild.kt",
|
listOf("foo/JavaClassChild.kt", "foo/useJavaClass.kt"),
|
||||||
"foo/useJavaClass.kt",
|
|
||||||
"foo/useJavaClassFooMethodUsage.kt"
|
|
||||||
),
|
|
||||||
subProjectName = "app"
|
subProjectName = "app"
|
||||||
)
|
)
|
||||||
assertCompiledKotlinSources(
|
assertCompiledKotlinSources(expectedSources, output)
|
||||||
expectedToCompileSources,
|
|
||||||
output
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -277,19 +279,9 @@ abstract class IncrementalCompilationJavaChangesBase(
|
|||||||
javaClassInLib.modify(changeMethodBody)
|
javaClassInLib.modify(changeMethodBody)
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
val expectedToCompileSources = sourceFilesRelativeToProject(
|
assertTasksExecuted(":lib:compileKotlin")
|
||||||
listOf(
|
assertTasksUpToDate(":app:compileKotlin") // App compilation has 'compile avoidance'
|
||||||
"foo/JavaClassChild.kt",
|
assertCompiledKotlinSources(emptyList(), output)
|
||||||
"foo/useJavaClass.kt",
|
|
||||||
"foo/useJavaClassFooMethodUsage.kt"
|
|
||||||
),
|
|
||||||
subProjectName = "app"
|
|
||||||
)
|
|
||||||
|
|
||||||
assertCompiledKotlinSources(
|
|
||||||
expectedToCompileSources,
|
|
||||||
output
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -34,8 +34,8 @@ class JavaUpToDateIT : KGPBaseTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build("build") {
|
build("build") {
|
||||||
assertTasksExecuted(":compileKotlin", ":compileTestKotlin")
|
assertTasksExecuted(":compileKotlin")
|
||||||
assertTasksUpToDate(":compileJava", ":compileTestJava")
|
assertTasksUpToDate(":compileJava", ":compileTestJava", ":compileTestKotlin")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,8 +56,8 @@ class JavaUpToDateIT : KGPBaseTest() {
|
|||||||
kotlinSourcesDir().resolve("foo/MainKotlinClass.kt").modify { "\n$it" }
|
kotlinSourcesDir().resolve("foo/MainKotlinClass.kt").modify { "\n$it" }
|
||||||
|
|
||||||
build("build") {
|
build("build") {
|
||||||
assertTasksExecuted(":compileKotlin", ":compileTestKotlin")
|
assertTasksExecuted(":compileKotlin")
|
||||||
assertTasksUpToDate(":compileJava", ":compileTestJava")
|
assertTasksUpToDate(":compileJava", ":compileTestJava", ":compileTestKotlin")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-5
@@ -636,8 +636,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
build("build") {
|
build("build") {
|
||||||
assertTasksExecuted(
|
assertTasksExecuted(
|
||||||
":example:kaptKotlin",
|
":example:kaptKotlin"
|
||||||
":example:kaptGenerateStubsKotlin"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
assertOutputContains("Additional warning message from AP")
|
assertOutputContains("Additional warning message from AP")
|
||||||
@@ -738,9 +737,9 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
libClassKt.modify { it.checkedReplace(original, replacement1) }
|
libClassKt.modify { it.checkedReplace(original, replacement1) }
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
|
assertTasksUpToDate(":app:kaptGenerateStubsKotlin")
|
||||||
assertTasksExecuted(
|
assertTasksExecuted(
|
||||||
":lib:compileKotlin",
|
":lib:compileKotlin",
|
||||||
":app:kaptGenerateStubsKotlin",
|
|
||||||
":app:kaptKotlin"
|
":app:kaptKotlin"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -762,8 +761,8 @@ open class Kapt3IT : Kapt3BaseIT() {
|
|||||||
|
|
||||||
libClassKt.modify { it.checkedReplace(replacement1, replacement2) }
|
libClassKt.modify { it.checkedReplace(replacement1, replacement2) }
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
assertTasksExecuted(":lib:compileKotlin", ":app:kaptGenerateStubsKotlin")
|
assertTasksExecuted(":lib:compileKotlin")
|
||||||
assertTasksUpToDate(":app:kaptKotlin")
|
assertTasksUpToDate(":app:kaptKotlin", ":app:kaptGenerateStubsKotlin")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -766,7 +766,10 @@ class KotlinGradleIT : KGPBaseTest() {
|
|||||||
|
|
||||||
buildGradle.modify {
|
buildGradle.modify {
|
||||||
val reorderedClasspath = run {
|
val reorderedClasspath = run {
|
||||||
val (kotlinCompilerEmbeddable, others) = classpath.partition { "kotlin-compiler-embeddable" in it }
|
val (kotlinCompilerEmbeddable, others) = classpath.partition { "kotlin-compiler-embeddable" in it ||
|
||||||
|
// build-common should be loaded prior compiler-embedable, otherwise we could depend on old version of
|
||||||
|
// serializer classes and fail with NSME
|
||||||
|
"kotlin-build-common" in it}
|
||||||
others + kotlinCompilerEmbeddable
|
others + kotlinCompilerEmbeddable
|
||||||
}
|
}
|
||||||
val newClasspathString = "classpath files(\n" + reorderedClasspath.joinToString(",\n") { "'$it'" } + "\n)"
|
val newClasspathString = "classpath files(\n" + reorderedClasspath.joinToString(",\n") { "'$it'" } + "\n)"
|
||||||
|
|||||||
+11
-3
@@ -158,9 +158,17 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
|||||||
// The feature should be controlled by a Gradle property.
|
// The feature should be controlled by a Gradle property.
|
||||||
// Currently, we also allow it to be controlled by a system property to make it easier to test the feature during development.
|
// Currently, we also allow it to be controlled by a system property to make it easier to test the feature during development.
|
||||||
// TODO: Remove the system property later.
|
// TODO: Remove the system property later.
|
||||||
val gradleProperty = booleanProperty(CompilerSystemProperties.COMPILE_INCREMENTAL_WITH_ARTIFACT_TRANSFORM.property) ?: false
|
|
||||||
val systemProperty = CompilerSystemProperties.COMPILE_INCREMENTAL_WITH_ARTIFACT_TRANSFORM.value.toBooleanLenient() ?: false
|
val gradleProperty = booleanProperty(CompilerSystemProperties.COMPILE_INCREMENTAL_WITH_ARTIFACT_TRANSFORM.property)
|
||||||
return gradleProperty || systemProperty
|
if (gradleProperty != null) {
|
||||||
|
return gradleProperty
|
||||||
|
}
|
||||||
|
val systemProperty = CompilerSystemProperties.COMPILE_INCREMENTAL_WITH_ARTIFACT_TRANSFORM.value?.toBooleanLenient()
|
||||||
|
if (systemProperty != null) {
|
||||||
|
return systemProperty
|
||||||
|
}
|
||||||
|
// Default value
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
val useKotlinAbiSnapshot: Boolean
|
val useKotlinAbiSnapshot: Boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user