Gradle, ProcessedFilesCache: don't report on clashes with for targets with removed source
This commit is contained in:
+15
-2
@@ -153,6 +153,14 @@ internal open class ProcessedFilesCache(
|
|||||||
byTarget[target] = element
|
byTarget[target] = element
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun remove(element: Element) {
|
||||||
|
if (element.target != null) {
|
||||||
|
byTarget.remove(element.target)
|
||||||
|
}
|
||||||
|
|
||||||
|
byHash.values.removeIf { it == element }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Element(
|
class Element(
|
||||||
@@ -199,8 +207,13 @@ internal open class ProcessedFilesCache(
|
|||||||
val key = compute()?.relativeTo(targetDir)?.toString()
|
val key = compute()?.relativeTo(targetDir)?.toString()
|
||||||
val existedTarget = state.byTarget[key]
|
val existedTarget = state.byTarget[key]
|
||||||
if (key != null && existedTarget != null) {
|
if (key != null && existedTarget != null) {
|
||||||
if (existedTarget.src != file.canonicalPath) {
|
if (File(existedTarget.src).exists()) {
|
||||||
reportTargetClash(key, file, File(existedTarget.src))
|
if (existedTarget.src != file.canonicalPath) {
|
||||||
|
reportTargetClash(key, file, File(existedTarget.src))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
project.logger.warn("Removing cache for removed source `${existedTarget.src}`")
|
||||||
|
state.remove(existedTarget)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state[hash] = Element(file.canonicalPath, key)
|
state[hash] = Element(file.canonicalPath, key)
|
||||||
|
|||||||
Reference in New Issue
Block a user