From 946fd53a73a9fb247c5917e37bd1a30ed83ba073 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Thu, 5 Dec 2013 23:08:21 +0100 Subject: [PATCH] Introduce abstract `IncrementalCommon` class. Introduce an abstract `IncrementalCommon class that holds the implementation of incremental compiler that was previously done in `Incremental` class. Also, introduce `IncrementalDefaultImpl` that inherits from IncrementalCommon. This is the first step to introduce a design where most of incremental compiler's logic lives in IncrementalCommon and we have two subclasses: 1. Default, which holds implementation specific to the old algorithm known from sbt 0.13.0 2. NameHashing, which holds implementation specific to the name hashing algorithm This commit is purely a refactoring and does not change any behavior. --- compile/inc/src/main/scala/sbt/inc/Incremental.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/inc/src/main/scala/sbt/inc/Incremental.scala b/compile/inc/src/main/scala/sbt/inc/Incremental.scala index a55021c87..fe4f03861 100644 --- a/compile/inc/src/main/scala/sbt/inc/Incremental.scala +++ b/compile/inc/src/main/scala/sbt/inc/Incremental.scala @@ -21,7 +21,7 @@ object Incremental log: Logger, options: IncOptions)(implicit equivS: Equiv[Stamp]): (Boolean, Analysis) = { - val incremental = new Incremental(log, options) + val incremental = new IncrementalDefaultImpl(log, options) val initialChanges = incremental.changedInitial(entry, sources, previous, current, forEntry) val binaryChanges = new DependencyChanges { val modifiedBinaries = initialChanges.binaryDeps.toArray @@ -62,7 +62,7 @@ object Incremental } -private class Incremental(log: Logger, options: IncOptions) { +private abstract class IncrementalCommon(log: Logger, options: IncOptions) { val incDebugProp = "xsbt.inc.debug" private def incDebug(options: IncOptions): Boolean = options.relationsDebug || java.lang.Boolean.getBoolean(incDebugProp) @@ -449,3 +449,5 @@ private class Incremental(log: Logger, options: IncOptions) { def properSubPkg(testParent: Seq[String], testSub: Seq[String]) = testParent.length < testSub.length && testSub.startsWith(testParent) def pkgs(api: Source) = names(api :: Nil).map(pkg)*/ } + +private final class IncrementalDefaultImpl(log: Logger, options: IncOptions) extends IncrementalCommon(log, options)