Skip to content

Commit

Permalink
Undouble CachedCompiler0#run
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Jul 15, 2020
1 parent d231b81 commit ae4bca3
Showing 1 changed file with 3 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class CompilerInterface extends CompilerInterface2 {
): Unit = {
val cached = new CachedCompiler0(options, output, new WeakLog(log, delegate))
try {
cached.run(sources, changes, callback, log, delegate, progress)
cached.run(sources.toList, changes, callback, log, delegate, progress)
} finally {
cached.close()
}
Expand Down Expand Up @@ -117,40 +117,17 @@ private final class CachedCompiler0(args: Array[String], output: Output, initial
s"[zinc] Running cached compiler $compilerId for Scala compiler $versionString"

def run(
sources: Array[File],
sources: List[VirtualFile],
changes: DependencyChanges,
callback: AnalysisCallback,
log: Logger,
delegate: Reporter,
progress: CompileProgress
): Unit = {
val srcs = sources.toList.map(AbstractFile.getFile(_)).sortBy(_.path)
doRun(srcs, callback, log, delegate, progress)
}

def run(
sources: Array[VirtualFile],
changes: DependencyChanges,
callback: AnalysisCallback,
log: Logger,
delegate: Reporter,
progress: CompileProgress
): Unit = {
val srcs = sources.toList.map(AbstractZincFile(_)).sortBy(_.underlying.id)
doRun(srcs, callback, log, delegate, progress)
}

private[this] def doRun(
sources: List[AbstractFile],
callback: AnalysisCallback,
log: Logger,
delegate: Reporter,
progress: CompileProgress
): Unit = synchronized {
debug(log, infoOnCachedCompiler(hashCode().toLong.toHexString))
val dreporter = DelegatingReporter(settings, delegate)
try {
run(sources, callback, log, dreporter, progress)
run(sources.sortBy(_.id).map(AbstractZincFile(_)), callback, log, dreporter, progress)
} finally {
dreporter.dropDelegate()
}
Expand Down

0 comments on commit ae4bca3

Please sign in to comment.