mirror of https://github.com/sbt/sbt.git
only write resulting Analysis back if compilation was performed
This commit is contained in:
parent
5f047f4439
commit
b601804046
|
|
@ -9,7 +9,7 @@ import java.io.File
|
|||
|
||||
object IncrementalCompile
|
||||
{
|
||||
def apply(sources: Set[File], entry: String => Option[File], compile: (Set[File], xsbti.AnalysisCallback) => Unit, previous: Analysis, forEntry: File => Option[Analysis], outputPath: File): Analysis =
|
||||
def apply(sources: Set[File], entry: String => Option[File], compile: (Set[File], xsbti.AnalysisCallback) => Unit, previous: Analysis, forEntry: File => Option[Analysis], outputPath: File): (Boolean, Analysis) =
|
||||
{
|
||||
val current = Stamps.initial(Stamp.exists, Stamp.hash, Stamp.lastModified)
|
||||
val internalMap = (f: File) => previous.relations.produced(f).headOption
|
||||
|
|
|
|||
|
|
@ -12,12 +12,13 @@ import java.io.File
|
|||
object Incremental
|
||||
{
|
||||
def println(s: String) = if(java.lang.Boolean.getBoolean("xsbt.inc.debug")) System.out.println(s) else ()
|
||||
def compile(sources: Set[File], entry: String => Option[File], previous: Analysis, current: ReadStamps, forEntry: File => Option[Analysis], doCompile: Set[File] => Analysis)(implicit equivS: Equiv[Stamp]): Analysis =
|
||||
def compile(sources: Set[File], entry: String => Option[File], previous: Analysis, current: ReadStamps, forEntry: File => Option[Analysis], doCompile: Set[File] => Analysis)(implicit equivS: Equiv[Stamp]): (Boolean, Analysis) =
|
||||
{
|
||||
val initialChanges = changedInitial(entry, sources, previous, current, forEntry)
|
||||
val initialInv = invalidateInitial(previous.relations, initialChanges)
|
||||
println("Initially invalidated: " + initialInv)
|
||||
cycle(initialInv, previous, doCompile)
|
||||
val analysis = cycle(initialInv, previous, doCompile)
|
||||
(!initialInv.isEmpty, analysis)
|
||||
}
|
||||
|
||||
// TODO: the Analysis for the last successful compilation should get returned + Boolean indicating success
|
||||
|
|
|
|||
|
|
@ -34,11 +34,12 @@ class AggressiveCompile(cacheDirectory: File)
|
|||
{
|
||||
val (previousAnalysis, previousSetup) = extract(store.get())
|
||||
val config = new CompileConfiguration(sources, classpath, javaSrcBases, previousAnalysis, previousSetup, setup, analysis.get _, maxErrors, compiler, javac)
|
||||
val result = compile2(config)
|
||||
store.set(result, setup)
|
||||
val (modified, result) = compile2(config)
|
||||
if(modified)
|
||||
store.set(result, setup)
|
||||
result
|
||||
}
|
||||
def compile2(config: CompileConfiguration)(implicit log: Logger, equiv: Equiv[CompileSetup]): Analysis =
|
||||
def compile2(config: CompileConfiguration)(implicit log: Logger, equiv: Equiv[CompileSetup]): (Boolean, Analysis) =
|
||||
{
|
||||
import config._
|
||||
import currentSetup._
|
||||
|
|
|
|||
Loading…
Reference in New Issue