diff --git a/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala b/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala index 8fafc985b..01619430f 100644 --- a/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala +++ b/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala @@ -24,6 +24,8 @@ class BaseCompilerSpec extends BridgeProviderSpecification { def assertExists(p: Path) = assert(Files.exists(p), s"$p does not exist") + def assertNotExists(p: Path) = assert(Files.notExists(p), s"$p exist") + def lastClasses(a: Analysis) = { a.compilations.allCompilations.map { c => a.apis.internal.collect { diff --git a/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala b/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala index 5e2038ebe..c812e6898 100644 --- a/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala +++ b/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala @@ -120,6 +120,21 @@ class IncrementalCompilerSpec extends BaseCompilerSpec { } finally comp.close() } + it should "delete all products if extra changes" in withTmpDir { tempDir => + val comp = + ProjectSetup.simple(tempDir.toPath, Seq(SourceFiles.Good, SourceFiles.Foo)).createCompiler() + val comp2 = + ProjectSetup.simple(tempDir.toPath, Seq(SourceFiles.Foo)).createCompiler() + try { + val cacheFile = tempDir / "target" / "inc_compile.zip" + val fileStore = AnalysisStore.getCachedStore(FileAnalysisStore.binary(cacheFile)) + comp.doCompileWithStore(fileStore) + val newSetup = comp2.setup.withExtra(Array()) + comp2.doCompileWithStore(fileStore, _.withSetup(newSetup)) + assertNotExists(comp.output / "pkg" / "Good$.class") + } finally comp.close() + } + it should "not trigger full compilation for small Scala changes in a mixed project" in withTmpDir { tmp => val project = VirtualSubproject(tmp.toPath / "p1")