feat: fs2 instead of parTraverse
Merge request lab2425_spring/WACC_37!46
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
//> using dep org.slf4j:slf4j-simple:2.0.17
|
||||
//> using test.dep org.scalatest::scalatest::3.2.19
|
||||
//> using dep org.typelevel::cats-effect-testing-scalatest::1.6.0
|
||||
//> using dep "co.fs2::fs2-core:3.11.0"
|
||||
//> using dep co.fs2::fs2-io:3.11.0
|
||||
|
||||
// sensible defaults for warnings and compiler checks
|
||||
//> using options -deprecation -unchecked -feature
|
||||
|
||||
@@ -15,6 +15,8 @@ import com.monovore.decline.effect._
|
||||
import org.typelevel.log4cats.slf4j.Slf4jLogger
|
||||
import org.typelevel.log4cats.Logger
|
||||
|
||||
import fs2.Stream
|
||||
|
||||
import assemblyIR as asm
|
||||
import cats.data.ValidatedNel
|
||||
import java.io.File
|
||||
@@ -147,8 +149,13 @@ def compileCommandParallel(
|
||||
log: Boolean,
|
||||
outDir: Option[Path]
|
||||
): IO[ExitCode] =
|
||||
files
|
||||
.parTraverse { file => compile(file.toAbsolutePath, outDir, log) }
|
||||
Stream
|
||||
.emits(files.toList)
|
||||
.parEvalMapUnordered(Runtime.getRuntime.availableProcessors()) { file =>
|
||||
compile(file.toAbsolutePath, outDir, log)
|
||||
}
|
||||
.compile
|
||||
.toList
|
||||
.map { exitCodes =>
|
||||
exitCodes.filter(_ != 0) match {
|
||||
case Nil => ExitCode.Success
|
||||
|
||||
BIN
wacc-compiler
Executable file
BIN
wacc-compiler
Executable file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user