Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Errors not cleaning up in BSP for Scala 3 #2810

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions scalalib/worker/src/mill/scalalib/worker/ZincWorkerImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -492,28 +492,6 @@ class ZincWorkerImpl(
.map(path => converter.toVirtualFile(path.toNIO))
.toArray

// We want to listed to all compiled files
val compileProgress = reporter.map { reporter =>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is most likely here scala/scala3#13082

Wouldn't CompileProgress be useful for reporting % of the compilation or does mill handle it differently?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not reporting % of the compilation in Mill yet. I'm creating an issue so we don't forget about it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Anyway, this needs the fix for Scala 3, but otherwise we can probably copy the logic from Bloop

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue created here: #2816

new CompileProgress {
val seen = new ConcurrentHashMap[String, java.lang.Boolean]()
override def startUnit(phase: String, unitPath: String): Unit = {
// ctx.log.info(s"compiler starts unit `${unitPath}` (phase: ${phase})")
try {
seen.putIfAbsent(unitPath, java.lang.Boolean.TRUE) match {
case null =>
// first visit
os.Path(unitPath)
reporter.fileVisited(os.Path(unitPath))
case _ =>
}
} catch {
case e: IllegalArgumentException =>
// could not convert path to os.Path
}
}
}
}

val inputs = ic.inputs(
classpath = classpath,
sources = virtualSources,
Expand All @@ -532,7 +510,7 @@ class ZincWorkerImpl(
cache = new FreshCompilerCache,
incOptions = IncOptions.of(),
reporter = newReporter,
progress = compileProgress,
progress = None,
earlyAnalysisStore = None,
extra = Array()
),
Expand Down Expand Up @@ -569,6 +547,7 @@ class ZincWorkerImpl(
case e: CompileFailed =>
Result.Failure(e.toString)
} finally {
reporter.foreach(r => sources.foreach(r.fileVisited(_)))
reporter.foreach(_.finish())
}
}
Expand Down