Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
CxxsimTask: clean before build.
Browse files Browse the repository at this point in the history
  • Loading branch information
kivikakk committed May 27, 2024
1 parent 4a05fc4 commit e5d10ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/scala/ee/hrzn/chryse/ChryseApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ abstract class ChryseApp {
)
else
None
val force =
opt[Boolean](
descr = "Clean before build",
)
val compileOnly =
opt[Boolean](
name = "compile",
Expand Down Expand Up @@ -150,6 +154,7 @@ abstract class ChryseApp {
tasks.CxxsimTask.Options(
Conf.cxxsim.debug(),
Conf.cxxsim.optimize(),
Conf.cxxsim.force(),
Conf.cxxsim.compileOnly(),
Conf.cxxsim.vcd.toOption,
Conf.cxxsim.trailing.getOrElse(List.empty),
Expand Down
7 changes: 7 additions & 0 deletions src/main/scala/ee/hrzn/chryse/tasks/CxxsimTask.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ee.hrzn.chryse.platform.Platform
import ee.hrzn.chryse.platform.cxxrtl.BlackBoxGenerator
import ee.hrzn.chryse.platform.cxxrtl.CXXRTLOptions
import ee.hrzn.chryse.platform.cxxrtl.CXXRTLPlatform
import org.apache.commons.io.FileUtils

import java.io.PrintWriter
import java.nio.file.Files
Expand All @@ -23,6 +24,7 @@ object CxxsimTask extends BaseTask {
case class Options(
debug: Boolean,
optimize: Boolean,
force: Boolean,
compileOnly: Boolean,
vcdOutPath: Option[String],
args: Seq[String],
Expand All @@ -37,6 +39,11 @@ object CxxsimTask extends BaseTask {
println(s"Building cxxsim ${platform.id} ...")

Files.createDirectories(Paths.get(buildDir, platform.id))
if (runOptions.force) {
println(s"Cleaning build dir $buildDir/${platform.id}")
FileUtils.deleteDirectory(Paths.get(buildDir, platform.id).toFile());
Files.createDirectories(Paths.get(buildDir, platform.id))
}

val name = chryse.name

Expand Down

0 comments on commit e5d10ce

Please sign in to comment.