Skip to content

Commit

Permalink
add more application logging
Browse files Browse the repository at this point in the history
  • Loading branch information
soronpo committed Aug 27, 2024
1 parent 626204d commit ba5a24c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/src/main/scala/dfhdl/app/DFApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import scala.collection.mutable
import dfhdl.options.CompilerOptions
import org.rogach.scallop.*
import dfhdl.internals.sbtShellIsRunning
import scala.util.chaining.scalaUtilChainingOps

trait DFApp:
private val logger = Logger("DFHDL App")
Expand Down Expand Up @@ -65,6 +66,15 @@ trait DFApp:
elaborated.printCodeString
elaborated

private inline def compile =
elaborate.tap(_ => logger.info("Compiling design...")).compile

private inline def commit =
compile.tap(_ => logger.info("Committing backend files to disk...")).commit

private inline def lint =
commit.tap(_ => logger.info("Running external linter...")).lint

private def listBackends: Unit =
println(
s"""|Backend option pattern: -b <lang>[.<dialect>]
Expand Down Expand Up @@ -124,9 +134,9 @@ trait DFApp:
case Some(HelpMode.backend) => listBackends
case _ => println(parsedCommandLine.getFullHelpString())
case Mode.elaborate => elaborate
case Mode.compile => elaborate.compile
case Mode.commit => elaborate.compile.commit
case Mode.lint => elaborate.compile.commit.lint
case Mode.compile => compile
case Mode.commit => commit
case Mode.lint => lint
end match
end main
end DFApp

0 comments on commit ba5a24c

Please sign in to comment.