diff --git a/backend/src/main/scala/bloop/Compiler.scala b/backend/src/main/scala/bloop/Compiler.scala index e426e412d..9c190e6d9 100644 --- a/backend/src/main/scala/bloop/Compiler.scala +++ b/backend/src/main/scala/bloop/Compiler.scala @@ -1016,12 +1016,9 @@ object Compiler { BloopClassFileManager.supportedCompileProducts.filter(_ != ".betasty") :+ ".class" Files .walk(clientClassesDir.underlying) - .filter(path => - Files.isRegularFile(path) && deletedCompileProducts.exists( - path.toString.endsWith(_) - ) - ) - .forEach(path => if (Files.exists(path)) Files.delete(path)) + .filter(path => Files.isRegularFile(path)) + .filter(path => deletedCompileProducts.exists(path.toString.endsWith(_))) + .forEach(Files.delete(_)) }.map(_ => ()) } diff --git a/frontend/src/main/scala/bloop/engine/tasks/CompileTask.scala b/frontend/src/main/scala/bloop/engine/tasks/CompileTask.scala index a5b72d5ee..86a4a91c2 100644 --- a/frontend/src/main/scala/bloop/engine/tasks/CompileTask.scala +++ b/frontend/src/main/scala/bloop/engine/tasks/CompileTask.scala @@ -178,7 +178,8 @@ object CompileTask { waitOnReadClassesDir.flatMap { _ => // Only when the task is finished, we kickstart the compilation def compile(inputs: CompileInputs) = { - val firstResult = Compiler.compile(inputs, isBestEffort, isBestEffortDep, true) + val firstResult = + Compiler.compile(inputs, isBestEffort, isBestEffortDep, firstCompilation = true) firstResult.flatMap { case result @ Compiler.Result.Failed( _, @@ -196,7 +197,12 @@ object CompileTask { previousCompilerResult = result, previousResult = emptyResult ) - Compiler.compile(newInputs, isBestEffort, isBestEffortDep, false) + Compiler.compile( + newInputs, + isBestEffort, + isBestEffortDep, + firstCompilation = false + ) case result => Task(result) } } diff --git a/frontend/src/main/scala/bloop/engine/tasks/compilation/CompileGraph.scala b/frontend/src/main/scala/bloop/engine/tasks/compilation/CompileGraph.scala index aeaf317db..1aab0af1e 100644 --- a/frontend/src/main/scala/bloop/engine/tasks/compilation/CompileGraph.scala +++ b/frontend/src/main/scala/bloop/engine/tasks/compilation/CompileGraph.scala @@ -389,7 +389,7 @@ object CompileGraph { PartialFailure(bundle.project, FailedOrCancelledPromise, Task.now(results)) } - def loop(dag: Dag[Project], isBestEffortDep: Boolean): CompileTraversal = { + def loop(dag: Dag[Project]): CompileTraversal = { tasks.get(dag) match { case Some(task) => task case None => @@ -397,6 +397,7 @@ object CompileGraph { case Leaf(project) => val bundleInputs = BundleInputs(project, dag, Map.empty) setupAndDeduplicate(client, bundleInputs, computeBundle) { bundle => + val isBestEffortDep = false compile(Inputs(bundle, Map.empty), bestEffortAllowed && project.isBestEffort, isBestEffortDep).map { results => results.fromCompiler match { case Compiler.Result.Ok(_) => Leaf(partialSuccess(bundle, results)) @@ -406,13 +407,13 @@ object CompileGraph { } case Aggregate(dags) => - val downstream = dags.map(loop(_, isBestEffortDep = false)) + val downstream = dags.map(loop(_)) Task.gatherUnordered(downstream).flatMap { dagResults => Task.now(Parent(PartialEmpty, dagResults)) } case Parent(project, dependencies) => - val downstream = dependencies.map(loop(_, isBestEffortDep = false)) + val downstream = dependencies.map(loop(_)) Task.gatherUnordered(downstream).flatMap { dagResults => val depsSupportBestEffort = dependencies.map(Dag.dfs(_, mode = Dag.PreOrder)).flatten.forall(_.isBestEffort) @@ -433,7 +434,7 @@ object CompileGraph { case _ => false } val continue = bestEffortAllowed && depsSupportBestEffort && successfulBestEffort || failed.isEmpty - val dependsOnBestEffort = failed.nonEmpty && bestEffortAllowed && depsSupportBestEffort || isBestEffortDep + val dependsOnBestEffort = failed.nonEmpty && bestEffortAllowed && depsSupportBestEffort if (!continue) { // Register the name of the projects we're blocked on (intransitively) @@ -479,7 +480,7 @@ object CompileGraph { } } - loop(dag, isBestEffortDep = false) + loop(dag) } private def errorToString(err: Throwable): String = {