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")
|
||||
@GradleTest
|
||||
fun testIncrementalCompilationAfterCacheHit(gradleVersion: GradleVersion) {
|
||||
project("incrementalMultiproject", gradleVersion, buildOptions = defaultBuildOptions.copy(useICClasspathSnapshot = true)) {
|
||||
project("incrementalMultiproject", gradleVersion, buildOptions = defaultBuildOptions.copy(useICClasspathSnapshot = true, useGradleClasspathSnapshot = false)) {
|
||||
enableLocalBuildCache(localBuildCacheDir)
|
||||
build("assemble")
|
||||
build("clean", "assemble") {
|
||||
@@ -159,7 +159,7 @@ class BuildCacheIT : KGPBaseTest() {
|
||||
|
||||
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)})
|
||||
assertOutputContains("Incremental compilation with ABI snapshot enabled")
|
||||
}
|
||||
|
||||
+3
-2
@@ -306,10 +306,11 @@ class BuildCacheRelocationIT : KGPBaseTest() {
|
||||
}
|
||||
|
||||
@JvmGradlePluginTests
|
||||
@DisplayName("Kotlin incremental compilation should work correctly")
|
||||
@DisplayName("Kotlin incremental compilation should work correctly after cache hint")
|
||||
@GradleTest
|
||||
fun testKotlinIncrementalCompilation(gradleVersion: GradleVersion) {
|
||||
checkKotlinIncrementalCompilationAfterCacheHit(gradleVersion) {
|
||||
val options = defaultBuildOptions.copy(useGradleClasspathSnapshot = false)
|
||||
checkKotlinIncrementalCompilationAfterCacheHit(gradleVersion, options) {
|
||||
assertNonIncrementalCompilation()
|
||||
}
|
||||
}
|
||||
|
||||
+172
-78
@@ -40,6 +40,98 @@ class IncrementalCompilationJsMultiProjectIT : BaseIncrementalCompilationMultiPr
|
||||
|
||||
//compileKotlin2Js's modification doe not work
|
||||
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
|
||||
@@ -56,11 +148,10 @@ open class IncrementalCompilationJvmMultiProjectIT : BaseIncrementalCompilationM
|
||||
override val defaultProjectName: String = "incrementalMultiproject"
|
||||
|
||||
@DisplayName("'inspectClassesForKotlinIC' task is added to execution plan")
|
||||
@GradleTest
|
||||
open fun testInspectClassesForKotlinICTask(gradleVersion: GradleVersion) {
|
||||
defaultProject(gradleVersion) {
|
||||
build("assemble") {
|
||||
assertTasksExecuted(
|
||||
assertTasksSkipped(
|
||||
":lib:inspectClassesForKotlinIC",
|
||||
":app:inspectClassesForKotlinIC"
|
||||
)
|
||||
@@ -89,18 +180,15 @@ open class IncrementalCompilationJvmMultiProjectIT : BaseIncrementalCompilationM
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName(
|
||||
"checks that multi-project ic is disabled when there is a task that outputs to javaDestination dir " +
|
||||
"that is not JavaCompile or KotlinCompile"
|
||||
)
|
||||
@DisplayName("Compile lib with Groovy")
|
||||
@GradleTest
|
||||
open fun testCompileLibWithGroovy(gradleVersion: GradleVersion) {
|
||||
testCompileLibWithGroovy_doTest(gradleVersion) { project, result ->
|
||||
val expectedSources = project.subProject("app").projectPath.resolve("src").allKotlinSources +
|
||||
listOf(project.subProject("lib").kotlinSourcesDir().resolve("bar/A.kt"))
|
||||
result.assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||
result.assertTasksUpToDate(":app:$compileKotlinTaskName") // App compilation has 'compile avoidance'
|
||||
|
||||
assertCompiledKotlinSources(
|
||||
expectedSources.map { it.relativeTo(project.projectPath) },
|
||||
project.getExpectedKotlinSourcesForDefaultProject(libSources = listOf("bar/A.kt")),
|
||||
result.output
|
||||
)
|
||||
}
|
||||
@@ -189,15 +277,16 @@ class IncrementalCompilationFirJvmMultiProjectIT : IncrementalCompilationJvmMult
|
||||
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")
|
||||
@GradleTest
|
||||
override fun testInspectClassesForKotlinICTask(gradleVersion: GradleVersion) {
|
||||
defaultProject(gradleVersion) {
|
||||
build("assemble") {
|
||||
assertTasksSkipped(
|
||||
assertTasksExecuted(
|
||||
":lib: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
|
||||
override fun testNonAbiChangeInLib_changeMethodBody(gradleVersion: GradleVersion) {
|
||||
defaultProject(gradleVersion) {
|
||||
@@ -214,17 +304,17 @@ class IncrementalCompilationClasspathSnapshotJvmMultiProjectIT : IncrementalComp
|
||||
changeMethodBodyInLib()
|
||||
|
||||
build("assemble") {
|
||||
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||
assertTasksUpToDate(":app:$compileKotlinTaskName")
|
||||
assertCompiledKotlinSources(
|
||||
getExpectedKotlinSourcesForDefaultProject(libSources = listOf("bar/A.kt")),
|
||||
getExpectedKotlinSourcesForDefaultProject(
|
||||
libSources = listOf("bar/A.kt")
|
||||
),
|
||||
output
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("Add dependency in lib subproject")
|
||||
@DisplayName("Add new dependency in lib project")
|
||||
@GradleTest
|
||||
override fun testAddDependencyInLib(gradleVersion: GradleVersion) {
|
||||
defaultProject(gradleVersion) {
|
||||
@@ -235,15 +325,18 @@ class IncrementalCompilationClasspathSnapshotJvmMultiProjectIT : IncrementalComp
|
||||
build("assemble") {
|
||||
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||
assertTasksUpToDate(":app:$compileKotlinTaskName")
|
||||
// Lib compilation is incremental (no files are recompiled)
|
||||
assertCompiledKotlinSources(emptyList(), output)
|
||||
assertCompiledKotlinSources(
|
||||
subProject("lib").projectPath.resolve("src").allKotlinSources.relativizeTo(projectPath),
|
||||
output
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("after lib project clean")
|
||||
@DisplayName("ABI change in lib after lib clean")
|
||||
@GradleTest
|
||||
override fun testAbiChangeInLib_afterLibClean(gradleVersion: GradleVersion) {
|
||||
// To see if app compilation can be incremental after non-incremental lib compilation
|
||||
defaultProject(gradleVersion) {
|
||||
build("assemble")
|
||||
|
||||
@@ -251,44 +344,67 @@ class IncrementalCompilationClasspathSnapshotJvmMultiProjectIT : IncrementalComp
|
||||
changeMethodSignatureInLib()
|
||||
|
||||
build("assemble") {
|
||||
val expectedSources = getExpectedKotlinSourcesForDefaultProject(
|
||||
appSources = listOf("foo/AA.kt", "foo/AAA.kt", "foo/BB.kt", "foo/fooUseA.kt")
|
||||
) + subProject("lib").projectPath.resolve("src").allKotlinSources.map { it.relativeTo(projectPath) }
|
||||
|
||||
assertCompiledKotlinSources(expectedSources, output)
|
||||
assertCompiledKotlinSources(
|
||||
subProject("lib")
|
||||
.projectPath
|
||||
.resolve("src")
|
||||
.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
|
||||
override fun testCompileLibWithGroovy(gradleVersion: GradleVersion) {
|
||||
testCompileLibWithGroovy_doTest(gradleVersion) { project, result ->
|
||||
result.assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||
result.assertTasksUpToDate(":app:$compileKotlinTaskName") // App compilation has 'compile avoidance'
|
||||
val expectedSources = project.subProject("app").projectPath.resolve("src").allKotlinSources +
|
||||
listOf(project.subProject("lib").kotlinSourcesDir().resolve("bar/A.kt"))
|
||||
|
||||
assertCompiledKotlinSources(
|
||||
project.getExpectedKotlinSourcesForDefaultProject(libSources = listOf("bar/A.kt")),
|
||||
expectedSources.map { it.relativeTo(project.projectPath) },
|
||||
result.output
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("Lib: after cleaning lib project")
|
||||
|
||||
@DisplayName("Lib with abi snapshot: after clean build")
|
||||
@GradleTest
|
||||
override fun testAbiChangeInLib_afterLibClean_withAbiSnapshot(gradleVersion: GradleVersion) {
|
||||
defaultProject(gradleVersion) {
|
||||
defaultProject(
|
||||
gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(useGradleClasspathSnapshot = true)
|
||||
) {
|
||||
build("assemble")
|
||||
|
||||
build(":lib:clean")
|
||||
changeMethodSignatureInLib()
|
||||
|
||||
build("assemble") {
|
||||
val expectedSources = getExpectedKotlinSourcesForDefaultProject(
|
||||
appSources = listOf("foo/AA.kt", "foo/AAA.kt", "foo/BB.kt", "foo/fooUseA.kt")
|
||||
) + subProject("lib").projectPath.resolve("src").allKotlinSources.map { it.relativeTo(projectPath) }
|
||||
|
||||
assertCompiledKotlinSources(expectedSources, output)
|
||||
// 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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
open fun testNonAbiChangeInLib_changeMethodBody(gradleVersion: GradleVersion) {
|
||||
defaultProject(gradleVersion) {
|
||||
@@ -389,17 +505,17 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
|
||||
changeMethodBodyInLib()
|
||||
|
||||
build("assemble") {
|
||||
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||
assertTasksUpToDate(":app:$compileKotlinTaskName")
|
||||
assertCompiledKotlinSources(
|
||||
getExpectedKotlinSourcesForDefaultProject(
|
||||
libSources = listOf("bar/A.kt")
|
||||
),
|
||||
getExpectedKotlinSourcesForDefaultProject(libSources = listOf("bar/A.kt")),
|
||||
output
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("Add new dependency in lib project")
|
||||
@DisplayName("Add dependency in lib subproject")
|
||||
@GradleTest
|
||||
open fun testAddDependencyInLib(gradleVersion: GradleVersion) {
|
||||
defaultProject(gradleVersion) {
|
||||
@@ -410,10 +526,8 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
|
||||
build("assemble") {
|
||||
assertTasksExecuted(":lib:$compileKotlinTaskName")
|
||||
assertTasksUpToDate(":app:$compileKotlinTaskName")
|
||||
assertCompiledKotlinSources(
|
||||
subProject("lib").projectPath.resolve("src").allKotlinSources.relativizeTo(projectPath),
|
||||
output
|
||||
)
|
||||
// Lib compilation is incremental (no files are recompiled)
|
||||
assertCompiledKotlinSources(emptyList(), output)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -430,10 +544,9 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("ABI change in lib after lib clean")
|
||||
@DisplayName("after lib project clean")
|
||||
@GradleTest
|
||||
open fun testAbiChangeInLib_afterLibClean(gradleVersion: GradleVersion) {
|
||||
// To see if app compilation can be incremental after non-incremental lib compilation
|
||||
defaultProject(gradleVersion) {
|
||||
build("assemble")
|
||||
|
||||
@@ -441,19 +554,11 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
|
||||
changeMethodSignatureInLib()
|
||||
|
||||
build("assemble") {
|
||||
assertCompiledKotlinSources(
|
||||
subProject("lib")
|
||||
.projectPath
|
||||
.resolve("src")
|
||||
.allKotlinSources
|
||||
.relativizeTo(projectPath) +
|
||||
subProject("app")
|
||||
.projectPath
|
||||
.resolve("src")
|
||||
.allKotlinSources
|
||||
.relativizeTo(projectPath),
|
||||
output
|
||||
)
|
||||
val expectedSources = getExpectedKotlinSourcesForDefaultProject(
|
||||
appSources = listOf("foo/AA.kt", "foo/AAA.kt", "foo/BB.kt", "foo/fooUseA.kt")
|
||||
) + subProject("lib").projectPath.resolve("src").allKotlinSources.map { it.relativeTo(projectPath) }
|
||||
|
||||
assertCompiledKotlinSources(expectedSources, output)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -595,32 +700,21 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("Lib with abi snapshot: after clean build")
|
||||
@DisplayName("Lib: after cleaning lib project")
|
||||
@GradleTest
|
||||
open fun testAbiChangeInLib_afterLibClean_withAbiSnapshot(gradleVersion: GradleVersion) {
|
||||
defaultProject(
|
||||
gradleVersion,
|
||||
buildOptions = defaultBuildOptions.copy(useGradleClasspathSnapshot = true)
|
||||
) {
|
||||
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
|
||||
)
|
||||
val expectedSources = getExpectedKotlinSourcesForDefaultProject(
|
||||
appSources = listOf("foo/AA.kt", "foo/AAA.kt", "foo/BB.kt", "foo/fooUseA.kt")
|
||||
) + subProject("lib").projectPath.resolve("src").allKotlinSources.map { it.relativeTo(projectPath) }
|
||||
|
||||
assertCompiledKotlinSources(expectedSources, output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+35
-43
@@ -92,11 +92,11 @@ open class IncrementalJavaChangeDefaultIT : IncrementalCompilationJavaChangesBas
|
||||
}
|
||||
|
||||
@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
|
||||
override fun testAbiChangeInLib_changeMethodSignature(gradleVersion: GradleVersion) {
|
||||
defaultProject(gradleVersion) {
|
||||
@@ -105,12 +105,18 @@ class IncrementalJavaChangeClasspathSnapshotIT : IncrementalJavaChangeDefaultIT(
|
||||
javaClassInLib.modify(changeMethodSignature)
|
||||
|
||||
build("assemble") {
|
||||
// Fewer Kotlin files are recompiled
|
||||
val expectedSources = sourceFilesRelativeToProject(
|
||||
listOf("foo/JavaClassChild.kt", "foo/useJavaClass.kt"),
|
||||
val expectedToCompileSources = sourceFilesRelativeToProject(
|
||||
listOf(
|
||||
"foo/JavaClassChild.kt",
|
||||
"foo/useJavaClass.kt",
|
||||
"foo/useJavaClassFooMethodUsage.kt"
|
||||
),
|
||||
subProjectName = "app"
|
||||
)
|
||||
assertCompiledKotlinSources(expectedSources, output)
|
||||
assertCompiledKotlinSources(
|
||||
expectedToCompileSources,
|
||||
output
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,9 +130,19 @@ class IncrementalJavaChangeClasspathSnapshotIT : IncrementalJavaChangeDefaultIT(
|
||||
javaClassInLib.modify(changeMethodBody)
|
||||
|
||||
build("assemble") {
|
||||
assertTasksExecuted(":lib:compileKotlin")
|
||||
assertTasksUpToDate(":app:compileKotlin") // App compilation has 'compile avoidance'
|
||||
assertCompiledKotlinSources(emptyList(), output)
|
||||
val expectedToCompileSources = sourceFilesRelativeToProject(
|
||||
listOf(
|
||||
"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(
|
||||
listOf(
|
||||
"foo/TrackedJavaClassChild.kt",
|
||||
"foo/useTrackedJavaClass.kt",
|
||||
"foo/useTrackedJavaClassFooMethodUsage.kt"
|
||||
"foo/useTrackedJavaClass.kt"
|
||||
),
|
||||
subProjectName = "app"
|
||||
) + sourceFilesRelativeToProject(
|
||||
@@ -208,13 +223,6 @@ open class IncrementalJavaChangeDisablePreciseIT : IncrementalCompilationJavaCha
|
||||
|
||||
build("assemble") {
|
||||
val expectedSources = sourceFilesRelativeToProject(
|
||||
listOf(
|
||||
"foo/TrackedJavaClassChild.kt",
|
||||
"foo/useTrackedJavaClass.kt",
|
||||
"foo/useTrackedJavaClassFooMethodUsage.kt"
|
||||
),
|
||||
subProjectName = "app"
|
||||
) + sourceFilesRelativeToProject(
|
||||
listOf("bar/useTrackedJavaClassSameModule.kt"),
|
||||
subProjectName = "lib"
|
||||
)
|
||||
@@ -243,7 +251,7 @@ abstract class IncrementalCompilationJavaChangesBase(
|
||||
protected val changeMethodSignature: (String) -> String = { it.replace("String getString", "Object getString") }
|
||||
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
|
||||
open fun testAbiChangeInLib_changeMethodSignature(gradleVersion: GradleVersion) {
|
||||
defaultProject(gradleVersion) {
|
||||
@@ -252,18 +260,12 @@ abstract class IncrementalCompilationJavaChangesBase(
|
||||
javaClassInLib.modify(changeMethodSignature)
|
||||
|
||||
build("assemble") {
|
||||
val expectedToCompileSources = sourceFilesRelativeToProject(
|
||||
listOf(
|
||||
"foo/JavaClassChild.kt",
|
||||
"foo/useJavaClass.kt",
|
||||
"foo/useJavaClassFooMethodUsage.kt"
|
||||
),
|
||||
// Fewer Kotlin files are recompiled
|
||||
val expectedSources = sourceFilesRelativeToProject(
|
||||
listOf("foo/JavaClassChild.kt", "foo/useJavaClass.kt"),
|
||||
subProjectName = "app"
|
||||
)
|
||||
assertCompiledKotlinSources(
|
||||
expectedToCompileSources,
|
||||
output
|
||||
)
|
||||
assertCompiledKotlinSources(expectedSources, output)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,19 +279,9 @@ abstract class IncrementalCompilationJavaChangesBase(
|
||||
javaClassInLib.modify(changeMethodBody)
|
||||
|
||||
build("assemble") {
|
||||
val expectedToCompileSources = sourceFilesRelativeToProject(
|
||||
listOf(
|
||||
"foo/JavaClassChild.kt",
|
||||
"foo/useJavaClass.kt",
|
||||
"foo/useJavaClassFooMethodUsage.kt"
|
||||
),
|
||||
subProjectName = "app"
|
||||
)
|
||||
|
||||
assertCompiledKotlinSources(
|
||||
expectedToCompileSources,
|
||||
output
|
||||
)
|
||||
assertTasksExecuted(":lib:compileKotlin")
|
||||
assertTasksUpToDate(":app:compileKotlin") // App compilation has 'compile avoidance'
|
||||
assertCompiledKotlinSources(emptyList(), output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -34,8 +34,8 @@ class JavaUpToDateIT : KGPBaseTest() {
|
||||
}
|
||||
|
||||
build("build") {
|
||||
assertTasksExecuted(":compileKotlin", ":compileTestKotlin")
|
||||
assertTasksUpToDate(":compileJava", ":compileTestJava")
|
||||
assertTasksExecuted(":compileKotlin")
|
||||
assertTasksUpToDate(":compileJava", ":compileTestJava", ":compileTestKotlin")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,8 +56,8 @@ class JavaUpToDateIT : KGPBaseTest() {
|
||||
kotlinSourcesDir().resolve("foo/MainKotlinClass.kt").modify { "\n$it" }
|
||||
|
||||
build("build") {
|
||||
assertTasksExecuted(":compileKotlin", ":compileTestKotlin")
|
||||
assertTasksUpToDate(":compileJava", ":compileTestJava")
|
||||
assertTasksExecuted(":compileKotlin")
|
||||
assertTasksUpToDate(":compileJava", ":compileTestJava", ":compileTestKotlin")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -636,8 +636,7 @@ open class Kapt3IT : Kapt3BaseIT() {
|
||||
|
||||
build("build") {
|
||||
assertTasksExecuted(
|
||||
":example:kaptKotlin",
|
||||
":example:kaptGenerateStubsKotlin"
|
||||
":example:kaptKotlin"
|
||||
)
|
||||
|
||||
assertOutputContains("Additional warning message from AP")
|
||||
@@ -738,9 +737,9 @@ open class Kapt3IT : Kapt3BaseIT() {
|
||||
libClassKt.modify { it.checkedReplace(original, replacement1) }
|
||||
|
||||
build("assemble") {
|
||||
assertTasksUpToDate(":app:kaptGenerateStubsKotlin")
|
||||
assertTasksExecuted(
|
||||
":lib:compileKotlin",
|
||||
":app:kaptGenerateStubsKotlin",
|
||||
":app:kaptKotlin"
|
||||
)
|
||||
}
|
||||
@@ -762,8 +761,8 @@ open class Kapt3IT : Kapt3BaseIT() {
|
||||
|
||||
libClassKt.modify { it.checkedReplace(replacement1, replacement2) }
|
||||
build("assemble") {
|
||||
assertTasksExecuted(":lib:compileKotlin", ":app:kaptGenerateStubsKotlin")
|
||||
assertTasksUpToDate(":app:kaptKotlin")
|
||||
assertTasksExecuted(":lib:compileKotlin")
|
||||
assertTasksUpToDate(":app:kaptKotlin", ":app:kaptGenerateStubsKotlin")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -766,7 +766,10 @@ class KotlinGradleIT : KGPBaseTest() {
|
||||
|
||||
buildGradle.modify {
|
||||
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
|
||||
}
|
||||
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.
|
||||
// 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.
|
||||
val gradleProperty = booleanProperty(CompilerSystemProperties.COMPILE_INCREMENTAL_WITH_ARTIFACT_TRANSFORM.property) ?: false
|
||||
val systemProperty = CompilerSystemProperties.COMPILE_INCREMENTAL_WITH_ARTIFACT_TRANSFORM.value.toBooleanLenient() ?: false
|
||||
return gradleProperty || systemProperty
|
||||
|
||||
val gradleProperty = booleanProperty(CompilerSystemProperties.COMPILE_INCREMENTAL_WITH_ARTIFACT_TRANSFORM.property)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user