From 5ea8f880346f4b36b3a61f87d6fd97e10bcbd535 Mon Sep 17 00:00:00 2001 From: friendseeker <66892505+Friendseeker@users.noreply.github.com> Date: Thu, 30 Nov 2023 12:29:24 -0800 Subject: [PATCH 1/2] Delete products when dropping analysis --- .../scala/sbt/internal/inc/IncrementalCompilerImpl.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala b/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala index 272647bae..cd1922688 100644 --- a/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala +++ b/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala @@ -541,8 +541,13 @@ class IncrementalCompilerImpl extends IncrementalCompiler { previousSetup match { // The dummy output needs to be changed to .jar for this to work again. // case _ if compileToJarSwitchedOn(mixedCompiler.config) => Analysis.empty - case Some(prev) if equiv.equiv(prev, currentSetup) => previousAnalysis - case Some(prev) if !equivPairs.equiv(prev.extra, currentSetup.extra) => Analysis.empty + case Some(prev) if equiv.equiv(prev, currentSetup) => previousAnalysis + case Some(prev) if !equivPairs.equiv(prev.extra, currentSetup.extra) => + val classFileManager = + ClassFileManager.getClassFileManager(incOptions, output, outputJarContent) + val products = previousAnalysis.asInstanceOf[Analysis].relations.allProducts + classFileManager.delete(products.map(converter.toVirtualFile).toArray) + Analysis.empty case _ => val srcs = config.sources.toSet Incremental.prune(srcs, previousAnalysis, output, outputJarContent, converter, incOptions) From 20aff0ef55b747081ba9b0a6f1e36406a64c5b55 Mon Sep 17 00:00:00 2001 From: friendseeker <66892505+Friendseeker@users.noreply.github.com> Date: Thu, 30 Nov 2023 12:49:11 -0800 Subject: [PATCH 2/2] Add missing import --- .../main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala b/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala index cd1922688..8f071923b 100644 --- a/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala +++ b/zinc/src/main/scala/sbt/internal/inc/IncrementalCompilerImpl.scala @@ -543,6 +543,7 @@ class IncrementalCompilerImpl extends IncrementalCompiler { // case _ if compileToJarSwitchedOn(mixedCompiler.config) => Analysis.empty case Some(prev) if equiv.equiv(prev, currentSetup) => previousAnalysis case Some(prev) if !equivPairs.equiv(prev.extra, currentSetup.extra) => + import sbt.internal.inc.ClassFileManager val classFileManager = ClassFileManager.getClassFileManager(incOptions, output, outputJarContent) val products = previousAnalysis.asInstanceOf[Analysis].relations.allProducts