mirror of https://github.com/sbt/sbt.git
Provided details of why external binaries are detected as modified in incremental compiler debug output.
This commit is contained in:
parent
9ebb952525
commit
6b7fbfe779
|
|
@ -21,14 +21,14 @@ object Incremental
|
||||||
log: Logger,
|
log: Logger,
|
||||||
options: IncOptions)(implicit equivS: Equiv[Stamp]): (Boolean, Analysis) =
|
options: IncOptions)(implicit equivS: Equiv[Stamp]): (Boolean, Analysis) =
|
||||||
{
|
{
|
||||||
val initialChanges = changedInitial(entry, sources, previous, current, forEntry, options)
|
val initialChanges = changedInitial(entry, sources, previous, current, forEntry, options, log)
|
||||||
val binaryChanges = new DependencyChanges {
|
val binaryChanges = new DependencyChanges {
|
||||||
val modifiedBinaries = initialChanges.binaryDeps.toArray
|
val modifiedBinaries = initialChanges.binaryDeps.toArray
|
||||||
val modifiedClasses = initialChanges.external.modified.toArray
|
val modifiedClasses = initialChanges.external.modified.toArray
|
||||||
def isEmpty = modifiedBinaries.isEmpty && modifiedClasses.isEmpty
|
def isEmpty = modifiedBinaries.isEmpty && modifiedClasses.isEmpty
|
||||||
}
|
}
|
||||||
val initialInv = invalidateInitial(previous.relations, initialChanges, log)
|
val initialInv = invalidateInitial(previous.relations, initialChanges, log)
|
||||||
log.debug("Initially invalidated: " + initialInv)
|
log.debug("All initially invalidated sources: " + initialInv + "\n")
|
||||||
val analysis = manageClassfiles(options) { classfileManager =>
|
val analysis = manageClassfiles(options) { classfileManager =>
|
||||||
cycle(initialInv, sources, binaryChanges, previous, doCompile, classfileManager, 1, log, options)
|
cycle(initialInv, sources, binaryChanges, previous, doCompile, classfileManager, 1, log, options)
|
||||||
}
|
}
|
||||||
|
|
@ -125,14 +125,14 @@ object Incremental
|
||||||
}
|
}
|
||||||
|
|
||||||
def changedInitial(entry: String => Option[File], sources: Set[File], previousAnalysis: Analysis, current: ReadStamps,
|
def changedInitial(entry: String => Option[File], sources: Set[File], previousAnalysis: Analysis, current: ReadStamps,
|
||||||
forEntry: File => Option[Analysis], options: IncOptions)(implicit equivS: Equiv[Stamp]): InitialChanges =
|
forEntry: File => Option[Analysis], options: IncOptions, log: Logger)(implicit equivS: Equiv[Stamp]): InitialChanges =
|
||||||
{
|
{
|
||||||
val previous = previousAnalysis.stamps
|
val previous = previousAnalysis.stamps
|
||||||
val previousAPIs = previousAnalysis.apis
|
val previousAPIs = previousAnalysis.apis
|
||||||
|
|
||||||
val srcChanges = changes(previous.allInternalSources.toSet, sources, f => !equivS.equiv( previous.internalSource(f), current.internalSource(f) ) )
|
val srcChanges = changes(previous.allInternalSources.toSet, sources, f => !equivS.equiv( previous.internalSource(f), current.internalSource(f) ) )
|
||||||
val removedProducts = previous.allProducts.filter( p => !equivS.equiv( previous.product(p), current.product(p) ) ).toSet
|
val removedProducts = previous.allProducts.filter( p => !equivS.equiv( previous.product(p), current.product(p) ) ).toSet
|
||||||
val binaryDepChanges = previous.allBinaries.filter( externalBinaryModified(entry, forEntry, previous, current)).toSet
|
val binaryDepChanges = previous.allBinaries.filter( externalBinaryModified(entry, forEntry, previous, current, log)).toSet
|
||||||
val extChanges = changedIncremental(previousAPIs.allExternals, previousAPIs.externalAPI _, currentExternalAPI(entry, forEntry), options)
|
val extChanges = changedIncremental(previousAPIs.allExternals, previousAPIs.externalAPI _, currentExternalAPI(entry, forEntry), options)
|
||||||
|
|
||||||
InitialChanges(srcChanges, removedProducts, binaryDepChanges, extChanges )
|
InitialChanges(srcChanges, removedProducts, binaryDepChanges, extChanges )
|
||||||
|
|
@ -252,18 +252,38 @@ object Incremental
|
||||||
previous -- invalidatedSrcs
|
previous -- invalidatedSrcs
|
||||||
}
|
}
|
||||||
|
|
||||||
def externalBinaryModified(entry: String => Option[File], analysis: File => Option[Analysis], previous: Stamps, current: ReadStamps)(implicit equivS: Equiv[Stamp]): File => Boolean =
|
def externalBinaryModified(entry: String => Option[File], analysis: File => Option[Analysis], previous: Stamps, current: ReadStamps, log: Logger)(implicit equivS: Equiv[Stamp]): File => Boolean =
|
||||||
dependsOn =>
|
dependsOn =>
|
||||||
analysis(dependsOn).isEmpty &&
|
{
|
||||||
orTrue(
|
def inv(reason: String): Boolean = {
|
||||||
for {
|
log.debug("Invalidating " + dependsOn.getCanonicalPath + ": " + reason)
|
||||||
name <- previous.className(dependsOn)
|
true
|
||||||
e <- entry(name)
|
}
|
||||||
} yield {
|
def entryModified(className: String, classpathEntry: File): Boolean =
|
||||||
val resolved = Locate.resolve(e, name)
|
{
|
||||||
(resolved.getCanonicalPath != dependsOn.getCanonicalPath) || !equivS.equiv(previous.binary(dependsOn), current.binary(resolved))
|
val resolved = Locate.resolve(classpathEntry, className)
|
||||||
|
if(resolved.getCanonicalPath != dependsOn.getCanonicalPath)
|
||||||
|
inv("class " + className + " now provided by " + resolved.getCanonicalPath)
|
||||||
|
else {
|
||||||
|
val previousStamp = previous.binary(dependsOn)
|
||||||
|
val resolvedStamp = current.binary(resolved)
|
||||||
|
if(equivS.equiv(previousStamp, resolvedStamp))
|
||||||
|
false
|
||||||
|
else
|
||||||
|
inv("stamp changed from " + previousStamp + " to " + resolvedStamp)
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
|
||||||
|
analysis(dependsOn).isEmpty && {
|
||||||
|
previous.className(dependsOn) match {
|
||||||
|
case None => inv("no class name was mapped for it.")
|
||||||
|
case Some(name) => entry(name) match {
|
||||||
|
case None => inv("could not find class " + name + " on the classpath.")
|
||||||
|
case Some(e) => entryModified(name, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def currentExternalAPI(entry: String => Option[File], forEntry: File => Option[Analysis]): String => Source =
|
def currentExternalAPI(entry: String => Option[File], forEntry: File => Option[Analysis]): String => Source =
|
||||||
className =>
|
className =>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue