-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
144 lines (126 loc) · 5.25 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// See LICENSE for license details.
site.settings
site.includeScaladoc()
ghpages.settings
import UnidocKeys._
lazy val customUnidocSettings = unidocSettings ++ Seq (
doc in Compile := (doc in ScalaUnidoc).value,
target in unidoc in ScalaUnidoc := crossTarget.value / "api"
)
val defaultVersions = Map("sirrtl" -> "0.2")
lazy val commonSettings = Seq (
organization := "edu.berkeley.cs",
version := "3.1-FLOW",
git.remoteRepo := "[email protected]:ucb-bar/chisel3.git",
autoAPIMappings := true,
scalaVersion := "2.11.7",
scalacOptions := Seq("-deprecation", "-feature"),
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
// Use the root project's unmanaged base for all sub-projects.
unmanagedBase := (unmanagedBase in root).value,
// Since we want to examine the classpath to determine if a dependency on firrtl is required,
// this has to be a Task setting.
// Fortunately, allDependencies is a Task Setting, so we can modify that.
allDependencies := {
allDependencies.value ++ Seq("sirrtl").collect {
// If we have an unmanaged jar file on the classpath, assume we're to use that,
case dep: String if !(unmanagedClasspath in Compile).value.toString.contains(s"$dep.jar") =>
// otherwise let sbt fetch the appropriate version.
"edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", defaultVersions(dep))
}
}
)
lazy val chiselSettings = Seq (
name := "chisel3",
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { x => false },
pomExtra := <url>http://chisel.eecs.berkeley.edu/</url>
<licenses>
<license>
<name>BSD-style</name>
<url>http://www.opensource.org/licenses/bsd-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/ucb-bar/chisel3.git</url>
<connection>scm:git:github.com/ucb-bar/chisel3.git</connection>
</scm>
<developers>
<developer>
<id>jackbackrack</id>
<name>Jonathan Bachrach</name>
<url>http://www.eecs.berkeley.edu/~jrb/</url>
</developer>
</developers>,
publishTo <<= version { v: String =>
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT")) {
Some("snapshots" at nexus + "content/repositories/snapshots")
}
else {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
},
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases")
),
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "2.2.5" % "test",
"org.scalacheck" %% "scalacheck" % "1.12.4" % "test",
"com.github.scopt" %% "scopt" % "3.4.0"
),
// Tests from other projects may still run concurrently.
parallelExecution in Test := true,
javacOptions ++= Seq("-target", "1.7")
// Hopefully we get these options back in Chisel3
// scalacOptions in (Compile, doc) <++= (baseDirectory in LocalProject("chisel"), version) map { (bd, v) =>
// Seq("-diagrams", "-diagrams-max-classes", "25", "-sourcepath", bd.getAbsolutePath, "-doc-source-url",
// "https://github.com/ucb-bar/chisel/tree/master/€{FILE_PATH}.scala")
// }
)
lazy val coreMacros = (project in file("coreMacros")).
settings(commonSettings: _*).
settings(publishArtifact := false)
lazy val chiselFrontend = (project in file("chiselFrontend")).
settings(commonSettings: _*).
settings(publishArtifact := false).
dependsOn(coreMacros)
// This will always be the root project, even if we are a sub-project.
lazy val root = RootProject(file("."))
lazy val chisel = (project in file(".")).
enablePlugins(BuildInfoPlugin).
settings(
buildInfoPackage := name.value,
buildInfoOptions += BuildInfoOption.BuildTime,
buildInfoUsePackageAsPath := true,
buildInfoKeys := Seq[BuildInfoKey](buildInfoPackage, version, scalaVersion, sbtVersion)
).
settings(commonSettings: _*).
settings(customUnidocSettings: _*).
settings(chiselSettings: _*).
// Prevent separate JARs from being generated for coreMacros and chiselFrontend.
dependsOn(coreMacros % "compile-internal;test-internal").
dependsOn(chiselFrontend % "compile-internal;test-internal").
settings(
scalacOptions in Test ++= Seq("-language:reflectiveCalls"),
scalacOptions in Compile in doc ++= Seq(
"-diagrams",
"-diagrams-max-classes", "25",
"-doc-version", version.value,
"-doc-title", name.value,
"-doc-root-content", baseDirectory.value+"/root-doc.txt"
),
aggregate in doc := false,
// Include macro classes, resources, and sources main JAR.
mappings in (Compile, packageBin) <++= mappings in (coreMacros, Compile, packageBin),
mappings in (Compile, packageSrc) <++= mappings in (coreMacros, Compile, packageSrc),
mappings in (Compile, packageBin) <++= mappings in (chiselFrontend, Compile, packageBin),
mappings in (Compile, packageSrc) <++= mappings in (chiselFrontend, Compile, packageSrc),
// Export the packaged JAR so projects that depend directly on Chisel project (rather than the
// published artifact) also see the stuff in coreMacros and chiselFrontend.
exportJars := true
)