Skip to content

Instantly share code, notes, and snippets.

@jackkoenig
Created August 22, 2020 06:18
Show Gist options
  • Save jackkoenig/2e250f6e62f598c5d6b987066fda9d82 to your computer and use it in GitHub Desktop.
Save jackkoenig/2e250f6e62f598c5d6b987066fda9d82 to your computer and use it in GitHub Desktop.
Example build.sbt with comments to help explain
// 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"
// This is the version of your project
ThisBuild / version := "0.1-SNAPSHOT" // SNAPSHOT is used to indicate that it's a development (not stable) version
// 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 myProject = (project in file("."))
.settings(
name := "my-project-name",
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",
// 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"
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment