From c5af4c0388eab5b4f9aff647e09fa89e87bea0b6 Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Thu, 30 Jul 2009 13:53:14 +0000 Subject: Added 'removed' files parameter to the update m... Added 'removed' files parameter to the update method for build managers. --- src/compiler/scala/tools/nsc/interactive/BuildManager.scala | 4 ++-- .../scala/tools/nsc/interactive/RefinedBuildManager.scala | 12 +++++++++++- .../scala/tools/nsc/interactive/SimpleBuildManager.scala | 5 +++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/compiler/scala/tools/nsc/interactive/BuildManager.scala b/src/compiler/scala/tools/nsc/interactive/BuildManager.scala index 504e82dce3..1bb3217095 100644 --- a/src/compiler/scala/tools/nsc/interactive/BuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/BuildManager.scala @@ -20,7 +20,7 @@ trait BuildManager { /** The given files have been modified by the user. Recompile * them and their dependent files. */ - def update(files: Set[AbstractFile]) + def update(added: Set[AbstractFile], removed: Set[AbstractFile]) /** Load saved dependency information. */ def loadFrom(file: AbstractFile) @@ -62,7 +62,7 @@ object BuildManagerTest extends EvalLoop { loop { line => val args = List.fromString(line, ' ') val command = new CompilerCommand(args, new Settings(error), error, true) - buildManager.update(command.files) + buildManager.update(command.files, Set.empty) } } diff --git a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala index 7120254c5d..8368990cde 100644 --- a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala @@ -59,13 +59,23 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana /** Remove the given files from the managed build process. */ def removeFiles(files: Set[AbstractFile]) { sources --= files + val changes = new mutable.HashMap[Symbol, List[Change]] + for (f <- files; sym <- definitions(f)) + changes += sym -> List(Removed(Class(sym.fullNameString))) + update(invalidated(files, changes)) } + def update(added: Set[AbstractFile], removed: Set[AbstractFile]) { + removeFiles(removed) + update(added) + } + + /** The given files have been modified by the user. Recompile * them and all files that depend on them. Only files that * have been previously added as source files are recompiled. */ - def update(files: Set[AbstractFile]): Unit = if (!files.isEmpty) { + private def update(files: Set[AbstractFile]): Unit = if (!files.isEmpty) { val deps = compiler.dependencyAnalysis.dependencies val run = compiler.newRun() compiler.inform("compiling " + files) diff --git a/src/compiler/scala/tools/nsc/interactive/SimpleBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/SimpleBuildManager.scala index b5f0951656..b3ed0e0abf 100644 --- a/src/compiler/scala/tools/nsc/interactive/SimpleBuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/SimpleBuildManager.scala @@ -40,6 +40,11 @@ class SimpleBuildManager(val settings: Settings) extends BuildManager { sources --= files } + def update(added: Set[AbstractFile], removed: Set[AbstractFile]) { + removeFiles(removed) + update(added) + } + /** The given files have been modified by the user. Recompile * them and all files that depend on them. Only files that * have been previously added as source files are recompiled. -- cgit v1.2.3