From ba5a24cad5652af2015e2a7b7f9e5aaa4fbbf121 Mon Sep 17 00:00:00 2001 From: oronpo Date: Tue, 27 Aug 2024 07:21:44 +0300 Subject: [PATCH] add more application logging --- lib/src/main/scala/dfhdl/app/DFApp.scala | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/src/main/scala/dfhdl/app/DFApp.scala b/lib/src/main/scala/dfhdl/app/DFApp.scala index dab3aed78..bf3ccf348 100644 --- a/lib/src/main/scala/dfhdl/app/DFApp.scala +++ b/lib/src/main/scala/dfhdl/app/DFApp.scala @@ -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") @@ -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 [.] @@ -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