Skip to content

Commit 6a57642

Browse files
authored
Update sbt to 0.13.16; add Scala 2.12 support. (#675)
To clean, test, and build Scala 2.11 and Scala 2.12 versions: % sbt +clean +test +publishLocal
1 parent a97fbfc commit 6a57642

File tree

4 files changed

+53
-32
lines changed

4 files changed

+53
-32
lines changed

Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ c_resources_dir := src/main/resources
2525

2626
test_outs := $(addprefix $(targetDir)/, $(addsuffix .out, $(test_results)))
2727

28-
.PHONY: smoke publish-local check clean jenkins-build coverage scaladoc test checkstyle compile
28+
.PHONY: smoke publish-local pubishLocal check clean jenkins-build coverage scaladoc test checkstyle compile
2929

30-
default: publish-local
30+
default: publishLocal
3131

3232
smoke compile:
3333
$(SBT) $(SBT_FLAGS) compile
3434

35-
publish-local:
36-
$(SBT) $(SBT_FLAGS) publish-local
35+
publish-local publishLocal:
36+
$(SBT) $(SBT_FLAGS) publishLocal
3737

3838
test:
3939
$(SBT) $(SBT_FLAGS) test
@@ -69,7 +69,7 @@ site:
6969
# We need to run the coverage tests last, since Jenkins will fail the build if it can't find their results.
7070
jenkins-build: clean
7171
$(SBT) $(SBT_FLAGS) test
72-
$(SBT) $(SBT_FLAGS) clean publish-local
72+
$(SBT) $(SBT_FLAGS) clean publishLocal
7373
$(SBT) $(SBT_FLAGS) scalastyle coverage test
7474
$(SBT) $(SBT_FLAGS) coverageReport
7575

@@ -87,3 +87,8 @@ $(targetDir)/%.h: $(c_resources_dir)/%.h
8787

8888
$(targetDir)/%.out: $(targetDir)/%
8989
$(SBT) $(SBT_FLAGS) "test:runMain ChiselTests.MiniChisel $(notdir $(basename $<)) $(CHISEL_FLAGS) --test --targetDir $(targetDir)"
90+
91+
# The "last-resort" rule.
92+
# We assume the target is something like "+clean".
93+
%::
94+
$(SBT) $(SBT_FLAGS) $@

build.sbt

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,45 @@
11
// See LICENSE for license details.
22

3-
site.settings
4-
5-
site.includeScaladoc()
6-
7-
ghpages.settings
8-
9-
import UnidocKeys._
10-
11-
lazy val customUnidocSettings = unidocSettings ++ Seq (
12-
doc in Compile := (doc in ScalaUnidoc).value,
13-
target in unidoc in ScalaUnidoc := crossTarget.value / "api"
14-
)
3+
enablePlugins(SiteScaladocPlugin)
4+
5+
enablePlugins(GhpagesPlugin)
6+
7+
def scalacOptionsVersion(scalaVersion: String): Seq[String] = {
8+
Seq() ++ {
9+
// If we're building with Scala > 2.11, enable the compile option
10+
// switch to support our anonymous Bundle definitions:
11+
// https://github.com/scala/bug/issues/10047
12+
CrossVersion.partialVersion(scalaVersion) match {
13+
case Some((2, scalaMajor: Int)) if scalaMajor < 12 => Seq()
14+
case _ => Seq("-Xsource:2.11")
15+
}
16+
}
17+
}
18+
19+
def javacOptionsVersion(scalaVersion: String): Seq[String] = {
20+
Seq() ++ {
21+
// Scala 2.12 requires Java 8. We continue to generate
22+
// Java 7 compatible code for Scala 2.11
23+
// for compatibility with old clients.
24+
CrossVersion.partialVersion(scalaVersion) match {
25+
case Some((2, scalaMajor: Int)) if scalaMajor < 12 =>
26+
Seq("-source", "1.7", "-target", "1.7")
27+
case _ =>
28+
Seq("-source", "1.8", "-target", "1.8")
29+
}
30+
}
31+
}
1532

1633
val defaultVersions = Map("firrtl" -> "1.1-SNAPSHOT")
1734

1835
lazy val commonSettings = Seq (
1936
organization := "edu.berkeley.cs",
2037
version := "3.1-SNAPSHOT",
21-
git.remoteRepo := "git@github.com:ucb-bar/chisel3.git",
38+
git.remoteRepo := "git@github.com:freechipsproject/chisel3.git",
2239
autoAPIMappings := true,
2340
scalaVersion := "2.11.11",
24-
scalacOptions := Seq("-deprecation", "-feature"),
41+
crossScalaVersions := Seq("2.11.11", "2.12.3"),
42+
scalacOptions := Seq("-deprecation", "-feature") ++ scalacOptionsVersion(scalaVersion.value),
2543
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
2644
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
2745
// Use the root project's unmanaged base for all sub-projects.
@@ -54,8 +72,8 @@ lazy val chiselSettings = Seq (
5472
</license>
5573
</licenses>
5674
<scm>
57-
<url>https://github.com/ucb-bar/chisel3.git</url>
58-
<connection>scm:git:github.com/ucb-bar/chisel3.git</connection>
75+
<url>https://github.com/freechipsproject/chisel3.git</url>
76+
<connection>scm:git:github.com/freechipsproject/chisel3.git</connection>
5977
</scm>
6078
<developers>
6179
<developer>
@@ -84,13 +102,13 @@ lazy val chiselSettings = Seq (
84102
libraryDependencies ++= Seq(
85103
"org.scalatest" %% "scalatest" % "3.0.1" % "test",
86104
"org.scalacheck" %% "scalacheck" % "1.13.4" % "test",
87-
"com.github.scopt" %% "scopt" % "3.5.0"
105+
"com.github.scopt" %% "scopt" % "3.6.0"
88106
),
89107

90108
// Tests from other projects may still run concurrently.
91109
parallelExecution in Test := true,
92110

93-
javacOptions ++= Seq("-target", "1.7")
111+
javacOptions ++= javacOptionsVersion(scalaVersion.value)
94112
)
95113

96114
lazy val coreMacros = (project in file("coreMacros")).
@@ -107,14 +125,14 @@ lazy val root = RootProject(file("."))
107125

108126
lazy val chisel = (project in file(".")).
109127
enablePlugins(BuildInfoPlugin).
128+
enablePlugins(ScalaUnidocPlugin).
110129
settings(
111130
buildInfoPackage := name.value,
112131
buildInfoOptions += BuildInfoOption.BuildTime,
113132
buildInfoUsePackageAsPath := true,
114133
buildInfoKeys := Seq[BuildInfoKey](buildInfoPackage, version, scalaVersion, sbtVersion)
115134
).
116135
settings(commonSettings: _*).
117-
settings(customUnidocSettings: _*).
118136
settings(chiselSettings: _*).
119137
// Prevent separate JARs from being generated for coreMacros and chiselFrontend.
120138
dependsOn(coreMacros % "compile-internal;test-internal").

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.15
1+
sbt.version=0.13.16

project/plugins.sbt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ resolvers += Classpaths.sbtPluginReleases
44

55
resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven"
66

7-
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")
8-
9-
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")
7+
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
108

119
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0")
1210

13-
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.4")
11+
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2")
1412

15-
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.2")
13+
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.0")
1614

17-
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.6.1")
15+
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")
1816

19-
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.3.3")
17+
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.1")
2018

0 commit comments

Comments
 (0)