mirror of https://github.com/sbt/sbt.git
Move condition out of SameAPI.
It was tenuously relying on the caller short-circuiting with `shortcutSameSource`.
This commit is contained in:
parent
a1cc62a598
commit
17eeec6876
|
|
@ -44,12 +44,7 @@ object TopLevel
|
|||
object SameAPI
|
||||
{
|
||||
def apply(a: Source, b: Source): Boolean =
|
||||
{
|
||||
// Never consider a file containing macros as having the same API as the previous run.
|
||||
val hasMacro = a.hasMacro || b.hasMacro
|
||||
|
||||
!hasMacro && a.apiHash == b.apiHash && (a.hash.length > 0 && b.hash.length > 0) && apply(a.api, b.api)
|
||||
}
|
||||
a.apiHash == b.apiHash && (a.hash.length > 0 && b.hash.length > 0) && apply(a.api, b.api)
|
||||
|
||||
def apply(a: SourceAPI, b: SourceAPI): Boolean =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,7 +59,12 @@ object Incremental
|
|||
|
||||
new APIChanges(modifiedAPIs, changedNames)
|
||||
}
|
||||
def sameSource(a: Source, b: Source): Boolean = shortcutSameSource(a, b) || SameAPI(a,b)
|
||||
def sameSource(a: Source, b: Source): Boolean = {
|
||||
// Clients of a modified source file (ie, one that doesn't satisfy `shortcutSameSource`) containing macros must be recompiled.
|
||||
val hasMacro = a.hasMacro || b.hasMacro
|
||||
shortcutSameSource(a, b) || (!hasMacro && SameAPI(a,b))
|
||||
}
|
||||
|
||||
def shortcutSameSource(a: Source, b: Source): Boolean = !a.hash.isEmpty && !b.hash.isEmpty && sameCompilation(a.compilation, b.compilation) && (a.hash deepEquals b.hash)
|
||||
def sameCompilation(a: Compilation, b: Compilation): Boolean = a.startTime == b.startTime && a.target == b.target
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue