forked from OSCPU/NutShell
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: update build.sc to adapt to mill 0.11
- Loading branch information
Showing
2 changed files
with
40 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,65 @@ | ||
import mill._, scalalib._ | ||
import coursier.maven.MavenRepository | ||
|
||
trait CommonModule extends ScalaModule { | ||
override def scalaVersion = "2.12.13" | ||
object ivys { | ||
val scala = "2.12.13" | ||
val chiselCrossVersions = Map( | ||
"3.5.4" -> (ivy"edu.berkeley.cs::chisel3:3.5.4", ivy"edu.berkeley.cs:::chisel3-plugin:3.5.4"), | ||
) | ||
} | ||
|
||
override def scalacOptions = Seq("-Xsource:2.11") | ||
trait CommonModule extends ScalaModule { | ||
override def scalaVersion = ivys.scala | ||
} | ||
|
||
trait HasXsource211 extends ScalaModule { | ||
override def scalacOptions = T { | ||
super.scalacOptions() ++ Seq( | ||
"-deprecation", | ||
"-unchecked", | ||
"-feature", | ||
"-language:reflectiveCalls", | ||
"-Xsource:2.11" | ||
trait HasChiselCross extends ScalaModule with Cross.Module[String]{ | ||
override def repositoriesTask = T.task { | ||
super.repositoriesTask() ++ Seq( | ||
MavenRepository("https://oss.sonatype.org/content/repositories/snapshots") | ||
) | ||
} | ||
override def ivyDeps = Agg(ivys.chiselCrossVersions(crossValue)._1) | ||
override def scalacPluginIvyDeps = Agg(ivys.chiselCrossVersions(crossValue)._2) | ||
} | ||
|
||
trait HasChisel3 extends ScalaModule { | ||
trait HasRiscvSpecCore extends ScalaModule with Cross.Module[String]{ | ||
override def repositoriesTask = T.task { | ||
super.repositoriesTask() ++ Seq( | ||
MavenRepository("https://oss.sonatype.org/content/repositories/snapshots"), | ||
MavenRepository("https://s01.oss.sonatype.org/content/repositories/snapshots") | ||
) | ||
} | ||
override def ivyDeps = Agg( | ||
ivy"edu.berkeley.cs::chisel3:3.5.4", | ||
ivy"cn.ac.ios.tis::riscvspeccore:1.0-SNAPSHOT" | ||
) | ||
override def scalacPluginIvyDeps = Agg( | ||
ivy"edu.berkeley.cs:::chisel3-plugin:3.5.4", | ||
ivy"org.scalamacros:::paradise:2.1.1" | ||
) | ||
override def ivyDeps = Agg(ivy"cn.ac.ios.tis::riscvspeccore:1.0.0") | ||
} | ||
|
||
trait HasChiselTests extends CrossSbtModule { | ||
object test extends Tests with TestModule.ScalaTest{ | ||
override def ivyDeps = Agg( | ||
ivy"org.scalatest::scalatest:3.0.4", | ||
ivy"edu.berkeley.cs::chiseltest:0.5.4" | ||
) | ||
trait HasChiselTests extends SbtModule { | ||
object test extends SbtModuleTests with TestModule.ScalaTest { | ||
override def ivyDeps = Agg(ivy"edu.berkeley.cs::chiseltest:0.5.4") | ||
} | ||
} | ||
|
||
object difftest extends SbtModule with CommonModule with HasChisel3 { | ||
trait CommonNS extends SbtModule with CommonModule with HasChiselCross with HasRiscvSpecCore | ||
|
||
object difftest extends Cross[CommonNS](ivys.chiselCrossVersions.keys.toSeq){ | ||
override def millSourcePath = os.pwd / "difftest" | ||
} | ||
|
||
object chiselModule extends CrossSbtModule with HasChisel3 with HasChiselTests with HasXsource211 { | ||
def crossScalaVersion = "2.12.13" | ||
object chiselModule extends Cross[ChiselModule](ivys.chiselCrossVersions.keys.toSeq) | ||
|
||
trait ChiselModule extends CommonNS with Cross.Module[String] with HasChiselTests { | ||
override def millSourcePath = os.pwd | ||
|
||
override def moduleDeps = super.moduleDeps ++ Seq( | ||
difftest | ||
difftest(crossValue) | ||
) | ||
} | ||
|
||
object generator extends Cross[Generator](ivys.chiselCrossVersions.keys.toSeq) | ||
|
||
trait Generator extends CommonNS with HasChiselTests with Cross.Module[String] { | ||
private val directory = if (crossValue.startsWith("3")) "chisel3" else "chisel" | ||
override def millSourcePath = os.pwd / "generator" / directory | ||
|
||
override def moduleDeps = super.moduleDeps ++ Seq( | ||
chiselModule(crossValue) | ||
) | ||
} |