diff --git a/backend/src/main/scala/bloop/Compiler.scala b/backend/src/main/scala/bloop/Compiler.scala index ec884d75e..2d47dbede 100644 --- a/backend/src/main/scala/bloop/Compiler.scala +++ b/backend/src/main/scala/bloop/Compiler.scala @@ -368,23 +368,6 @@ object Compiler { reporter.reportStartCompilation(previousProblems) val fileManager = newFileManager - def findFailedProblems(fMaybe: Option[xsbti.CompileFailed]): List[ProblemPerPhase] = { - // We cannot guarantee reporter.problems == f.problems, so we aggregate them together - val reportedProblems = reporter.allProblemsPerPhase.toList - val rawProblemsFromReporter = reportedProblems.iterator.map(_.problem).toSet - val newProblems: List[ProblemPerPhase] = fMaybe - .map { f => - f.problems() - .flatMap { p => - if (rawProblemsFromReporter.contains(p)) Nil - else List(ProblemPerPhase(p, None)) - } - .toList - } - .getOrElse(Nil) - reportedProblems ++ newProblems.toList - } - // Manually skip redundant best-effort compilations. This is necessary because compiler // phases supplying the data needed to skip compilations in zinc remain unimplemented for now. val noopBestEffortResult = compileInputs.previousCompilerResult match { @@ -442,7 +425,6 @@ object Compiler { compileInputs, compileOut, () => elapsed, - findFailedProblems, reporter, backgroundTasksWhenNewSuccessfulAnalysis, allInvalidatedClassFilesForProject, @@ -684,7 +666,6 @@ object Compiler { compileInputs, compileOut, () => elapsed, - findFailedProblems, reporter, backgroundTasksWhenNewSuccessfulAnalysis, allInvalidatedClassFilesForProject, @@ -701,14 +682,7 @@ object Compiler { cause match { case f: xsbti.CompileFailed => - // We cannot guarantee reporter.problems == f.problems, so we aggregate them together - val reportedProblems = reporter.allProblemsPerPhase.toList - val rawProblemsFromReporter = reportedProblems.iterator.map(_.problem).toSet - val newProblems = f.problems().flatMap { p => - if (rawProblemsFromReporter.contains(p)) Nil - else List(ProblemPerPhase(p, None)) - } - val failedProblems = reportedProblems ++ newProblems.toList + val failedProblems = findFailedProblems(reporter, Some(f)) val backgroundTasks = toBackgroundTasks(backgroundTasksForFailedCompilation.toList) Result.Failed(failedProblems, None, elapsed, backgroundTasks, None) @@ -721,6 +695,26 @@ object Compiler { } } + def findFailedProblems( + reporter: ZincReporter, + compileFailedMaybe: Option[xsbti.CompileFailed] + ): List[ProblemPerPhase] = { + // We cannot guarantee reporter.problems == f.problems, so we aggregate them together + val reportedProblems = reporter.allProblemsPerPhase.toList + val rawProblemsFromReporter = reportedProblems.iterator.map(_.problem).toSet + val newProblems: List[ProblemPerPhase] = compileFailedMaybe + .map { f => + f.problems() + .flatMap { p => + if (rawProblemsFromReporter.contains(p)) Nil + else List(ProblemPerPhase(p, None)) + } + .toList + } + .getOrElse(Nil) + reportedProblems ++ newProblems.toList + } + def containsBestEffortFailure(cause: xsbti.CompileFailed) = cause.problems().exists(_.message().contains("Unsuccessful best-effort compilation.")) @@ -823,7 +817,6 @@ object Compiler { compileInputs: CompileInputs, compileOut: CompileOutPaths, elapsed: () => Long, - findFailedProblems: Option[xsbti.CompileFailed] => List[ProblemPerPhase], reporter: ZincReporter, backgroundTasksWhenNewSuccessfulAnalysis: mutable.ListBuffer[CompileBackgroundTasks.Sig], allInvalidatedClassFilesForProject: mutable.HashSet[File], @@ -940,7 +933,7 @@ object Compiler { compileInputs.sources, compileInputs.classpath ) - val failedProblems = findFailedProblems(errorCause) + val failedProblems = findFailedProblems(reporter, errorCause) Result.Failed( failedProblems, None,