Avoid rebuilds after changes of layouts xml-files
This commit makes IC react more granularly on these changes Precisely, it marks dirty only kt-files that having lookups into synthetic package built upon a changed layout-file #KT-21622 Fixed
This commit is contained in:
+13
-3
@@ -212,10 +212,9 @@ class IncrementalJvmCompilerRunner(
|
||||
}
|
||||
}
|
||||
|
||||
if ((changedFiles.modified + changedFiles.removed).any { it.extension.toLowerCase() == "xml" }) {
|
||||
return CompilationMode.Rebuild { "XML resource files were changed" }
|
||||
}
|
||||
val androidLayoutChanges = processLookupSymbolsForAndroidLayouts(changedFiles)
|
||||
|
||||
markDirtyBy(androidLayoutChanges)
|
||||
markDirtyBy(classpathChanges.lookupSymbols)
|
||||
markDirtyBy(classpathChanges.fqNames)
|
||||
|
||||
@@ -260,6 +259,17 @@ class IncrementalJvmCompilerRunner(
|
||||
}
|
||||
}
|
||||
|
||||
private fun processLookupSymbolsForAndroidLayouts(changedFiles: ChangedFiles.Known): Collection<LookupSymbol> {
|
||||
val result = mutableListOf<LookupSymbol>()
|
||||
for (file in changedFiles.modified + changedFiles.removed) {
|
||||
if (file.extension.toLowerCase() != "xml") continue
|
||||
val layoutName = file.name.substringBeforeLast('.')
|
||||
result.add(LookupSymbol(ANDROID_LAYOUT_CONTENT_LOOKUP_NAME, layoutName))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
private fun getClasspathChanges(
|
||||
modifiedClasspath: List<File>,
|
||||
lastBuildInfo: BuildInfo?
|
||||
|
||||
Reference in New Issue
Block a user