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] 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)