mirror of https://github.com/sbt/sbt.git
Introduce `IncrementalCommon.invalidateSource` method.
In addition to `invalidateSources` we introduce `invalidateSource` that invalidates dependencies of a single source. This is needed for the name hashing algorithm because its invalidation logic depends on information about API changes of each source file individually. The refactoring is done in `IncrementalCommon` class so it affects the default implementation as well. However, this refactoring does not affect the result of invalidation in the default implementation.
This commit is contained in:
parent
946fd53a73
commit
83a131e4f5
|
|
@ -316,13 +316,20 @@ private abstract class IncrementalCommon(log: Logger, options: IncOptions) {
|
|||
private[this] def invalidateSources(directDeps: File => Set[File], publicInherited: File => Set[File], changes: APIChanges[File]): Set[File] =
|
||||
{
|
||||
val initial = changes.allModified.toSet
|
||||
val all = (changes.apiChanges flatMap { change =>
|
||||
invalidateSource(directDeps, publicInherited, change)
|
||||
}).toSet
|
||||
includeInitialCond(initial, all, f => directDeps(f) ++ publicInherited(f))
|
||||
}
|
||||
|
||||
private[this] def invalidateSource(directDeps: File => Set[File], publicInherited: File => Set[File], change: APIChange[File]): Set[File] = {
|
||||
log.debug("Invalidating by inheritance (transitively)...")
|
||||
val transitiveInherited = transitiveDeps(initial)(publicInherited)
|
||||
val transitiveInherited = transitiveDeps(Set(change.modified))(publicInherited)
|
||||
log.debug("Invalidated by transitive public inheritance: " + transitiveInherited)
|
||||
val direct = transitiveInherited flatMap directDeps
|
||||
log.debug("Invalidated by direct dependency: " + direct)
|
||||
val all = transitiveInherited ++ direct
|
||||
includeInitialCond(initial, all, f => directDeps(f) ++ publicInherited(f))
|
||||
all
|
||||
}
|
||||
|
||||
/** Conditionally include initial sources that are dependencies of newly invalidated sources.
|
||||
|
|
|
|||
Loading…
Reference in New Issue