Fix changes in Android layout resources breaks incremental compilation
This only happens when project has 'kotlin-android-extensions' plugin applied and 'experimental = true' flag is set. On changes in android layout resources task was running full compilation instead running incrementally. ^KT-51177 Fixed
This commit is contained in:
+35
@@ -996,6 +996,41 @@ fun getSomething() = 10
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// KT-51177: when experimental flag is enabled
|
||||||
|
@Test
|
||||||
|
fun testIncrementalBuildAfterResourceChangeAndroidExtensions() {
|
||||||
|
val project = Project("AndroidExtensionsProject")
|
||||||
|
project.setupWorkingDir()
|
||||||
|
|
||||||
|
project.projectDir.resolve("app/build.gradle").appendText(
|
||||||
|
"""
|
||||||
|
|
|
||||||
|
|androidExtensions {
|
||||||
|
| experimental = true
|
||||||
|
|}
|
||||||
|
""".trimMargin()
|
||||||
|
)
|
||||||
|
|
||||||
|
project.build("assembleDebug") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertTasksExecuted(":app:compileDebugKotlin")
|
||||||
|
}
|
||||||
|
|
||||||
|
project.projectDir
|
||||||
|
.resolve("app/src/main/res/layout/activity_main.xml")
|
||||||
|
.modify {
|
||||||
|
it.replace("android:layout_width=\"wrap_content\"", "android:layout_width=\"match_parent\"")
|
||||||
|
}
|
||||||
|
|
||||||
|
project.build("assembleDebug") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertTasksExecuted(":app:compileDebugKotlin")
|
||||||
|
assertContainsRegex(
|
||||||
|
"compilerMode=INCREMENTAL_COMPILER.*areFileChangesKnown=true.*app/build/kotlin".toRegex()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testAndroidDaggerIC() {
|
fun testAndroidDaggerIC() {
|
||||||
val project = Project("AndroidDaggerProject")
|
val project = Project("AndroidDaggerProject")
|
||||||
|
|||||||
+1
@@ -204,6 +204,7 @@ class AndroidSubplugin :
|
|||||||
it.inputs.files(getLayoutDirectories(project, resDirectories))
|
it.inputs.files(getLayoutDirectories(project, resDirectories))
|
||||||
.withPathSensitivity(PathSensitivity.RELATIVE)
|
.withPathSensitivity(PathSensitivity.RELATIVE)
|
||||||
.withPropertyName("androidExtensionLayoutsFrom$name")
|
.withPropertyName("androidExtensionLayoutsFrom$name")
|
||||||
|
.skipWhenEmpty(true)
|
||||||
.run {
|
.run {
|
||||||
if (GradleVersion.current() >= GradleVersion.version("6.8")) {
|
if (GradleVersion.current() >= GradleVersion.version("6.8")) {
|
||||||
ignoreEmptyDirectories()
|
ignoreEmptyDirectories()
|
||||||
|
|||||||
Reference in New Issue
Block a user