mirror of https://github.com/sbt/sbt.git
fix product tracking and handling of removed sources
This commit is contained in:
parent
540ab7e470
commit
3c4e5c4f54
|
|
@ -106,7 +106,7 @@ object Incremental
|
||||||
{
|
{
|
||||||
val srcChanges = changes.internalSrc
|
val srcChanges = changes.internalSrc
|
||||||
println("Initial source changes: \n\tremoved:" + srcChanges.removed + "\n\tadded: " + srcChanges.added + "\n\tmodified: " + srcChanges.changed)
|
println("Initial source changes: \n\tremoved:" + srcChanges.removed + "\n\tadded: " + srcChanges.added + "\n\tmodified: " + srcChanges.changed)
|
||||||
val srcDirect = srcChanges.removed.flatMap(previous.usesInternalSrc) ++ srcChanges.added ++ srcChanges.changed
|
val srcDirect = srcChanges.removed ++ srcChanges.removed.flatMap(previous.usesInternalSrc) ++ srcChanges.added ++ srcChanges.changed
|
||||||
println("Initial source direct: " + srcDirect)
|
println("Initial source direct: " + srcDirect)
|
||||||
val byProduct = changes.removedProducts.flatMap(previous.produced)
|
val byProduct = changes.removedProducts.flatMap(previous.produced)
|
||||||
println("Initial by product: " + byProduct)
|
println("Initial by product: " + byProduct)
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,10 @@ object Stamp
|
||||||
|
|
||||||
object Stamps
|
object Stamps
|
||||||
{
|
{
|
||||||
|
/** Creates a ReadStamps instance that will calculate and cache the stamp for sources and binaries
|
||||||
|
* on the first request according to the provided `srcStamp` and `binStamp` functions. Each
|
||||||
|
* stamp is calculated separately on demand.
|
||||||
|
* The stamp for a product is always recalculated. */
|
||||||
def initial(prodStamp: File => Stamp, srcStamp: File => Stamp, binStamp: File => Stamp): ReadStamps = new InitialStamps(prodStamp, srcStamp, binStamp)
|
def initial(prodStamp: File => Stamp, srcStamp: File => Stamp, binStamp: File => Stamp): ReadStamps = new InitialStamps(prodStamp, srcStamp, binStamp)
|
||||||
|
|
||||||
def empty: Stamps =
|
def empty: Stamps =
|
||||||
|
|
@ -117,12 +121,11 @@ private class MStamps(val products: Map[File, Stamp], val sources: Map[File, Sta
|
||||||
private class InitialStamps(prodStamp: File => Stamp, srcStamp: File => Stamp, binStamp: File => Stamp) extends ReadStamps
|
private class InitialStamps(prodStamp: File => Stamp, srcStamp: File => Stamp, binStamp: File => Stamp) extends ReadStamps
|
||||||
{
|
{
|
||||||
import collection.mutable.{HashMap, Map}
|
import collection.mutable.{HashMap, Map}
|
||||||
// cached stamps
|
// cached stamps for files that do not change during compilation
|
||||||
private val products: Map[File, Stamp] = new HashMap
|
|
||||||
private val sources: Map[File, Stamp] = new HashMap
|
private val sources: Map[File, Stamp] = new HashMap
|
||||||
private val binaries: Map[File, Stamp] = new HashMap
|
private val binaries: Map[File, Stamp] = new HashMap
|
||||||
|
|
||||||
def product(prod: File): Stamp = synchronized { products.getOrElseUpdate(prod, prodStamp(prod)) }
|
def product(prod: File): Stamp = prodStamp(prod)
|
||||||
def internalSource(src: File): Stamp = synchronized { sources.getOrElseUpdate(src, srcStamp(src)) }
|
def internalSource(src: File): Stamp = synchronized { sources.getOrElseUpdate(src, srcStamp(src)) }
|
||||||
def binary(bin: File): Stamp = synchronized { binaries.getOrElseUpdate(bin, binStamp(bin)) }
|
def binary(bin: File): Stamp = synchronized { binaries.getOrElseUpdate(bin, binStamp(bin)) }
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue