Fix triggered execution

git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@1009 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
dmharrah 2009-09-12 14:30:49 +00:00
parent edead65a2b
commit 7cfcf44bf3
3 changed files with 3 additions and 4 deletions

View File

@ -585,7 +585,7 @@ object Main
private def compileContinuously(project: Project) = executeContinuously(project, "test-compile") private def compileContinuously(project: Project) = executeContinuously(project, "test-compile")
private def executeContinuously(project: Project, action: String) private def executeContinuously(project: Project, action: String)
{ {
def shouldTerminate: Boolean = (System.in.available > 0) && project.terminateWatch(System.in.read()) || shouldTerminate def shouldTerminate: Boolean = (System.in.available > 0) && (project.terminateWatch(System.in.read()) || shouldTerminate)
if(checkAction(project, action)) if(checkAction(project, action))
{ {
SourceModificationWatch.watchUntil(project, ContinuousCompilePollDelaySeconds)(shouldTerminate) SourceModificationWatch.watchUntil(project, ContinuousCompilePollDelaySeconds)(shouldTerminate)

View File

@ -240,7 +240,7 @@ trait Project extends TaskManager with Dag[Project] with BasicEnvironment
/** A `PathFinder` that determines the files watched when an action is run with a preceeding ~ when this is the current /** A `PathFinder` that determines the files watched when an action is run with a preceeding ~ when this is the current
* project. This project does not need to include the watched paths for projects that this project depends on.*/ * project. This project does not need to include the watched paths for projects that this project depends on.*/
def watchPaths: PathFinder = Path.emptyPathFinder def watchPaths: PathFinder = Path.emptyPathFinder
def terminateWatch(key: Int): Boolean = key == 10 def terminateWatch(key: Int): Boolean = key == 10 || key == 13
protected final override def parentEnvironment = info.parent protected final override def parentEnvironment = info.parent

View File

@ -7,8 +7,7 @@ object SourceModificationWatch
{ {
def watchUntil(project: Project, pollDelaySec: Int)(terminationCondition: => Boolean)(onSourcesModified: => Unit) def watchUntil(project: Project, pollDelaySec: Int)(terminationCondition: => Boolean)(onSourcesModified: => Unit)
{ {
def sourceFiles: Iterable[java.io.File] = def sourceFiles: Iterable[java.io.File] = sourcesFinder.get.map(_.asFile)
sourcesFinder.get.map(Path.relativize(project.info.projectPath, _)).filter(_.isDefined).map(_.get.asFile)
def sourcesFinder: PathFinder = (Path.emptyPathFinder /: project.topologicalSort)(_ +++ _.watchPaths) def sourcesFinder: PathFinder = (Path.emptyPathFinder /: project.topologicalSort)(_ +++ _.watchPaths)
def loop(lastCallbackCallTime: Long, previousFileCount: Int) def loop(lastCallbackCallTime: Long, previousFileCount: Int)
{ {