1
- import com .typesafe .tools .mima .plugin .{MimaPlugin , MimaKeys }
2
1
import Keys .{`package` => packageTask }
3
2
import com .typesafe .sbt .osgi .{OsgiKeys , SbtOsgi }
4
3
5
4
// plugin logic of build based on https://github.com/retronym/boxer
6
5
7
6
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" )
7
+ repoName := " scala-continuations" ,
8
+ organization := " org.scala-lang.plugins" ,
9
+ version := " 1.0.3-SNAPSHOT" ,
10
+
11
+ scalaVersionsByJvm := {
12
+ val j67 = List (" 2.11.11" , " 2.11.8" )
13
+ val j89 = List (" 2.12.2" , " 2.12.1" , " 2.12.0" , " 2.13.0-M1" )
14
+ // Map[JvmVersion, List[(ScalaVersion, UseForPublishing)]]
15
+ Map (
16
+ 6 -> j67.map(_ -> true ),
17
+ 7 -> j67.map(_ -> false ),
18
+ 8 -> j89.map(_ -> true ),
19
+ 9 -> j89.map(_ -> false )
20
+ )
20
21
},
21
- snapshotScalaBinaryVersion := " 2.11.8 " ,
22
+
22
23
scalacOptions ++= Seq (
23
24
" -deprecation" ,
24
25
" -feature" )
@@ -36,43 +37,49 @@ lazy val crossVersionSharedSources: Seq[Setting[_]] =
36
37
}
37
38
}
38
39
39
- lazy val root = project.in( file(" ." ) ).settings( publishArtifact := false ).aggregate(plugin, library).settings(commonSettings : _* )
40
+ lazy val root = project.in(file(" ." ))
41
+ .settings(commonSettings : _* )
42
+ .settings(publishArtifact := false )
43
+ .aggregate(plugin, library)
40
44
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 : _* )
45
+ lazy val plugin = project
46
+ .settings(scalaModuleOsgiSettings : _* )
47
+ .settings(commonSettings : _* )
48
+ .settings(
49
+ name := " scala-continuations-plugin" ,
50
+ crossVersion := CrossVersion .full, // because compiler api is not binary compatible
51
+ libraryDependencies += " org.scala-lang" % " scala-compiler" % scalaVersion.value,
52
+ OsgiKeys .exportPackage := Seq (s " scala.tools.selectivecps;version= ${version.value}" )
53
+ )
47
54
48
55
val pluginJar = packageTask in (plugin, Compile )
49
56
50
57
// 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 : _* )
58
+ lazy val library = project
59
+ .settings( scalaModuleOsgiSettings : _* )
60
+ .settings( commonSettings : _* )
61
+ .settings(
62
+ name := " scala-continuations-library " ,
63
+ mimaPreviousVersion := Some ( " 1.0.3 " ),
64
+
65
+ scalacOptions ++= Seq (
66
+ // add the plugin to the compiler
67
+ s " -Xplugin: ${pluginJar.value.getAbsolutePath} " ,
68
+ // enable the plugin
69
+ " -P:continuations:enable " ,
70
+ // add plugin timestamp to compiler options to trigger recompile of
71
+ // the library after editing the plugin. (Otherwise a 'clean' is needed.)
72
+ s " -Jdummy= ${pluginJar .value.lastModified} " ) ,
73
+
74
+ libraryDependencies ++= Seq (
75
+ " org.scala-lang " % " scala-compiler " % scalaVersion.value % " test " ,
76
+ " junit " % " junit " % " 4.12 " % " test " ,
77
+ " com.novocode " % " junit-interface " % " 0.11 " % " test " ),
78
+
79
+ testOptions += Tests . Argument (
80
+ TestFrameworks . JUnit ,
81
+ s " -Dscala-continuations-plugin.jar= ${pluginJar .value.getAbsolutePath} "
82
+ ),
83
+
84
+ OsgiKeys .exportPackage := Seq (s " scala.util.continuations;version= ${version.value}" )
85
+ )
0 commit comments