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 }
4
2
5
3
// plugin logic of build based on https://github.com/retronym/boxer
6
4
7
5
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
+ )
20
20
},
21
- snapshotScalaBinaryVersion := " 2.11.8 " ,
21
+
22
22
scalacOptions ++= Seq (
23
23
" -deprecation" ,
24
24
" -feature" )
@@ -36,43 +36,47 @@ lazy val crossVersionSharedSources: Seq[Setting[_]] =
36
36
}
37
37
}
38
38
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)
40
43
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
+ )
47
52
48
53
val pluginJar = packageTask in (plugin, Compile )
49
54
50
55
// 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
+ )
0 commit comments