Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Commit 2ea768a

Browse files
authored
Merge pull request #31 from lrytz/buildCleanups
Clean up the build
2 parents c9aedd8 + 04705c4 commit 2ea768a

File tree

3 files changed

+57
-55
lines changed

3 files changed

+57
-55
lines changed

build.sbt

Lines changed: 55 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import com.typesafe.tools.mima.plugin.{MimaPlugin, MimaKeys}
2-
import Keys.{`package` => packageTask }
3-
import com.typesafe.sbt.osgi.{OsgiKeys, SbtOsgi}
1+
import Keys.{ `package` => packageTask }
42

53
// plugin logic of build based on https://github.com/retronym/boxer
64

75
lazy val commonSettings = scalaModuleSettings ++ Seq(
8-
repoName := "scala-continuations",
9-
organization := "org.scala-lang.plugins",
10-
version := "1.0.3-SNAPSHOT",
11-
scalaVersion := crossScalaVersions.value.head,
12-
crossScalaVersions := {
13-
val java = System.getProperty("java.version")
14-
if (java.startsWith("1.6.") || java.startsWith("1.7."))
15-
Seq("2.11.8")
16-
else if (java.startsWith("1.8.") || java.startsWith("1.9."))
17-
Seq("2.12.0", "2.12.1")
18-
else
19-
sys.error(s"don't know what Scala versions to build on $java")
6+
repoName := "scala-continuations",
7+
organization := "org.scala-lang.plugins",
8+
version := "1.0.3-SNAPSHOT",
9+
10+
scalaVersionsByJvm := {
11+
val j67 = List("2.11.11", "2.11.8")
12+
val j89 = List("2.12.2", "2.12.1", "2.12.0", "2.13.0-M1")
13+
// Map[JvmVersion, List[(ScalaVersion, UseForPublishing)]]
14+
Map(
15+
6 -> j67.map(_ -> true),
16+
7 -> j67.map(_ -> false),
17+
8 -> j89.map(_ -> true),
18+
9 -> j89.map(_ -> false)
19+
)
2020
},
21-
snapshotScalaBinaryVersion := "2.11.8",
21+
2222
scalacOptions ++= Seq(
2323
"-deprecation",
2424
"-feature")
@@ -36,43 +36,47 @@ lazy val crossVersionSharedSources: Seq[Setting[_]] =
3636
}
3737
}
3838

39-
lazy val root = project.in( file(".") ).settings( publishArtifact := false ).aggregate(plugin, library).settings(commonSettings : _*)
39+
lazy val root = project.in(file("."))
40+
.settings(commonSettings: _*)
41+
.settings(publishArtifact := false)
42+
.aggregate(plugin, library)
4043

41-
lazy val plugin = project settings (scalaModuleOsgiSettings: _*) settings (
42-
name := "scala-continuations-plugin",
43-
crossVersion := CrossVersion.full, // because compiler api is not binary compatible
44-
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
45-
OsgiKeys.exportPackage := Seq(s"scala.tools.selectivecps;version=${version.value}")
46-
) settings (commonSettings : _*)
44+
lazy val plugin = project
45+
.settings(commonSettings: _*)
46+
.settings(
47+
name := "scala-continuations-plugin",
48+
crossVersion := CrossVersion.full, // because compiler api is not binary compatible
49+
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
50+
OsgiKeys.exportPackage := Seq(s"scala.tools.selectivecps;version=${version.value}")
51+
)
4752

4853
val pluginJar = packageTask in (plugin, Compile)
4954

5055
// TODO: the library project's test are really plugin tests, but we first need that jar
51-
lazy val library = project settings (scalaModuleOsgiSettings: _*) settings (MimaPlugin.mimaDefaultSettings: _*) settings (
52-
name := "scala-continuations-library",
53-
MimaKeys.mimaPreviousArtifacts := Set(
54-
organization.value % s"${name.value}_2.11" % "1.0.2"
55-
),
56-
scalacOptions ++= Seq(
57-
// add the plugin to the compiler
58-
s"-Xplugin:${pluginJar.value.getAbsolutePath}",
59-
// enable the plugin
60-
"-P:continuations:enable",
61-
// add plugin timestamp to compiler options to trigger recompile of
62-
// the library after editing the plugin. (Otherwise a 'clean' is needed.)
63-
s"-Jdummy=${pluginJar.value.lastModified}"),
64-
libraryDependencies ++= Seq(
65-
"org.scala-lang" % "scala-compiler" % scalaVersion.value % "test",
66-
"junit" % "junit" % "4.12" % "test",
67-
"com.novocode" % "junit-interface" % "0.11" % "test"),
68-
testOptions += Tests.Argument(
69-
TestFrameworks.JUnit,
70-
s"-Dscala-continuations-plugin.jar=${pluginJar.value.getAbsolutePath}"
71-
),
72-
// run mima during tests
73-
test in Test := {
74-
MimaKeys.mimaReportBinaryIssues.value
75-
(test in Test).value
76-
},
77-
OsgiKeys.exportPackage := Seq(s"scala.util.continuations;version=${version.value}")
78-
) settings (commonSettings : _*)
56+
lazy val library = project
57+
.settings(commonSettings: _*)
58+
.settings(
59+
name := "scala-continuations-library",
60+
mimaPreviousVersion := Some("1.0.3"),
61+
62+
scalacOptions ++= Seq(
63+
// add the plugin to the compiler
64+
s"-Xplugin:${pluginJar.value.getAbsolutePath}",
65+
// enable the plugin
66+
"-P:continuations:enable",
67+
// add plugin timestamp to compiler options to trigger recompile of
68+
// the library after editing the plugin. (Otherwise a 'clean' is needed.)
69+
s"-Jdummy=${pluginJar.value.lastModified}"),
70+
71+
libraryDependencies ++= Seq(
72+
"org.scala-lang" % "scala-compiler" % scalaVersion.value % "test",
73+
"junit" % "junit" % "4.12" % "test",
74+
"com.novocode" % "junit-interface" % "0.11" % "test"),
75+
76+
testOptions += Tests.Argument(
77+
TestFrameworks.JUnit,
78+
s"-Dscala-continuations-plugin.jar=${pluginJar.value.getAbsolutePath}"
79+
),
80+
81+
OsgiKeys.exportPackage := Seq(s"scala.util.continuations;version=${version.value}")
82+
)

project/build.properties

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

project/plugins.sbt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.2")
2-
3-
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.9")
1+
addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.6")

0 commit comments

Comments
 (0)