@@ -21,43 +21,36 @@ Having a shared plugin reduces duplication between the above
21
21
repositories. Reducing duplication makes maintenance easier and
22
22
helps ensure consistency.
23
23
24
- A major feature of the plugin is automated tag-based publishing. A
25
- release is made by pushing a tag to GitHub. Travis-CI then stages
26
- artifacts on Sonatype. Pressing "Close" and "Release" in the Sonatype
27
- web UI will then send the artifacts to Maven Central.
24
+ A major feature of the plugin is automated tag-based publishing using
25
+ sbt-ci-release. A release is made by pushing a tag to GitHub.
26
+
27
+ The plugin also brings in
28
+ - sbt-travisci to set the ` scalaVersion ` and ` crossScalaVersions `
29
+ - sbt-dynver to set the ` version ` based on the git history
30
+ - sbt-header
31
+ - sbt-osgi
28
32
29
33
## Usage
30
34
31
35
Add the plugin to the ` project/plugins.sbt ` file:
32
36
33
37
```
34
- addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0 .0")
38
+ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1 .0")
35
39
```
36
40
37
41
Then, in your ` build.sbt ` add:
38
42
39
43
```
40
- import ScalaModulePlugin._
44
+ // In a multi-project build, you might want to apply these settings only to the
45
+ // main project (see e.g. scala-parallel-collections)
46
+ ScalaModulePlugin.scalaModuleSettings
41
47
42
- scalaModuleSettings // in a multi-project build, you might want to apply these settings only to the
43
- // main project (see e.g. scala-parallel-collections)
48
+ // For JVM projects
49
+ ScalaModulePlugin.scalaModuleSettingsJVM
44
50
45
51
name := "<module name>"
46
52
repoName := "<GitHub repo name>" // the repo under github.com/scala/, only required if different from name
47
53
organization := "<org>" // only required if different from "org.scala-lang.modules"
48
- version := "<module version>"
49
-
50
- // The plugin uses `scalaVersionsByJvm` to set `crossScalaVersions in ThisBuild` according to the JVM major version.
51
- // The `scalaVersion in ThisBuild` is set to `crossScalaVersions.value.head`.
52
- scalaVersionsByJvm in ThisBuild := {
53
- val v211 = "2.11.12"
54
- val v212 = "2.12.8"
55
- val v213 = "2.13.0-RC1"
56
- // Map[JvmMajorVersion, List[(ScalaVersion, UseForPublishing)]]
57
- Map(
58
- 8 -> List(v211 -> true, v212 -> true, v213 -> true),
59
- 9 -> List(v211, v212, v213).map(_ -> false))
60
- }
61
54
62
55
mimaPreviousVersion := Some("1.0.0") // enables MiMa (`None` by default, which disables it)
63
56
@@ -66,11 +59,14 @@ OsgiKeys.exportPackage := Seq(s"<exported package>;version=${version.value}")
66
59
// Other settings
67
60
```
68
61
62
+ Scala versions are defined in ` .travis.yml ` .
63
+
64
+ Cross-building with Scala.js is possible, see scala-xml for example.
65
+
69
66
These additional settings are enabled by ` scalaModuleSettings ` :
70
67
- ` scalacOptions in (Compile, compile) ++= Seq("-feature", "-deprecation", "-unchecked", "-Xlint") `
71
68
- A ` projectName.properties ` file is generated and packaged
72
69
- ` fork in Test := true ` to work around some classpath clashes with scala-xml
73
- - ` publishTo ` sonatype, credentials file expected in ` ~/.ivy2/.credentials `
74
70
- POM and OSGi metadata
75
71
76
72
The following settings are also available:
0 commit comments