Skip to content

Commit

Permalink
Merge pull request #484 from scalacenter/topic/fix-watch-error-clean-…
Browse files Browse the repository at this point in the history
…cache

Don't embed the number of watching dirs we expect
  • Loading branch information
jvican authored May 12, 2018
2 parents 229c74c + c0e9786 commit 37311cd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions frontend/src/test/scala/bloop/engine/FileWatchingSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,19 @@ class FileWatchingSpec {
// Start the compilation
workerThread.start()

// Create non-existing source dirs in tests Xhttps://github.com/scalacenter/bloop/pull/471
project.sources.foreach { a =>
val p = a.underlying
val reachable = Dag.dfs(state.build.getDagFor(project))
val allSources = reachable.iterator.flatMap(_.sources.toList).map(_.underlying).toList
val existingProjectSources = allSources.filter { p =>
val s = p.toString
if (!Files.exists(p) && !s.endsWith(".scala") && !s.endsWith(".java"))
Files.createDirectories(p)
Files.exists(p) && !s.endsWith(".scala") && !s.endsWith(".java")
}

// Deletion doesn't trigger recompilation -- done to avoid file from previous test run
val newSource = project.sources.head.resolve("D.scala").underlying
if (Files.exists(newSource)) TestUtil.delete(newSource)

val dirsToWatch = existingProjectSources.length

// Wait for #1 compilation to finish
readCompilingLines(1, "Compiling 1 Scala source to", bloopOut)
readCompilingLines(1, "Compiling 6 Scala sources to", bloopOut)
Expand All @@ -172,7 +173,9 @@ class FileWatchingSpec {
readCompilingLines(1, "- should be very personal", bloopOut)
readCompilingLines(1, "Total for specification Specs2Test", bloopOut)
readCompilingLines(2, "Test server has been successfully closed.", bloopOut)
readCompilingLines(1, "Watching 8 directories... (press C-c to interrupt)", bloopOut)
readCompilingLines(1,
s"Watching $dirsToWatch directories... (press C-c to interrupt)",
bloopOut)

// Write the contents of a source back to the same source
Files.write(newSource, "object ForceRecompilation {}".getBytes("UTF-8"))
Expand Down

0 comments on commit 37311cd

Please sign in to comment.