Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change into educational example #77

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 35 additions & 51 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,55 +1,39 @@
// See README.md for license details.

def scalacOptionsVersion(scalaVersion: String): Seq[String] = {
Seq() ++ {
// If we're building with Scala > 2.11, enable the compile option
// switch to support our anonymous Bundle definitions:
// https://github.com/scala/bug/issues/10047
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, scalaMajor: Long)) if scalaMajor < 12 => Seq()
case _ => Seq("-Xsource:2.11")
}
}
}

def javacOptionsVersion(scalaVersion: String): Seq[String] = {
Seq() ++ {
// Scala 2.12 requires Java 8. We continue to generate
// Java 7 compatible code for Scala 2.11
// for compatibility with old clients.
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, scalaMajor: Long)) if scalaMajor < 12 =>
Seq("-source", "1.7", "-target", "1.7")
case _ =>
Seq("-source", "1.8", "-target", "1.8")
}
}
}

name := "chisel-module-template"

version := "3.3-SNAPSHOT"

scalaVersion := "2.12.10"

crossScalaVersions := Seq("2.12.10", "2.11.12")

resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases")
)

addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)

// Provide a managed dependency on X if -DXVersion="" is supplied on the command line.
val defaultVersions = Seq(
"chisel-iotesters" -> "1.5-SNAPSHOT",
"chiseltest" -> "0.3-SNAPSHOT"
// Common properties shared for a whole build
ThisBuild / scalaVersion := "2.12.12"
// These settings are mainly for publishing, they should be customized by the user
ThisBuild / organization := "edu.berkeley.cs"
ThisBuild / version := "3.3-SNAPSHOT" // SNAPSHOT is used to indicate development

// A project is a compilation unit
// Many projects are fine with just one (like this example), but complex builds may have multiple
// The properties scoped in "ThisBuild" above are shared between all projects
lazy val chiselTemplate = (project in file("."))
.settings(
name := "chisel-module-template",
libraryDependencies ++= Seq(
// Fundamentally, Chisel is just a Scala library, so we depend on it as a library
// Chisel 3 is versioning is of the style "3.<major>.<minor>"
// Chisel maintains binary compatibility between minor versions
// We use '+' to pull newest minor version
"edu.berkeley.cs" %% "chisel3" % "3.3.+",
// By default, dependencies are in the "main" scope, projects also have a "test" scope
// main code lives in "src/main/", test is found in "src/test/"
// The following depenencies will only be available in "src/test/"
"edu.berkeley.cs" %% "chisel-iotesters" % "1.4.+" % "test",
Comment on lines +21 to +24
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nix iotesters, pin versions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially only have dependency on chiseltest

// Leading with a 0 indicates less stability so it's generally good to pin a specific version,
// It's also reasonable to pin specific versions for the above dependencies as well
"edu.berkeley.cs" %% "chiseltest" % "0.2.2" % "test"
),
scalacOptions ++= Seq(
// Required options for Chisel code
"-Xsource:2.11",
// Recommended options
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit"
)
)

libraryDependencies ++= defaultVersions.map { case (dep, ver) =>
"edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", ver) }

scalacOptions ++= scalacOptionsVersion(scalaVersion.value)

javacOptions ++= javacOptionsVersion(scalaVersion.value)