diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2009-07-30 13:53:14 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2009-07-30 13:53:14 +0000 |
commit | c5af4c0388eab5b4f9aff647e09fa89e87bea0b6 (patch) | |
tree | b37986b7e70b572a7c244a77d6bac62eab0368f0 | |
parent | 46f563457f9a1afe8e8b44923e279e816dcb6076 (diff) | |
download | scala-c5af4c0388eab5b4f9aff647e09fa89e87bea0b6.tar.gz scala-c5af4c0388eab5b4f9aff647e09fa89e87bea0b6.tar.bz2 scala-c5af4c0388eab5b4f9aff647e09fa89e87bea0b6.zip |
Added 'removed' files parameter to the update m...
Added 'removed' files parameter to the update method for build managers.
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. |