|
1 | 1 | # Scala modules sbt plugin
|
2 |
| -This is an sbt plugin for creating a scala module build. |
3 | 2 |
|
| 3 | +This is an sbt plugin for creating a scala module build. |
4 | 4 |
|
5 |
| -# Usage |
| 5 | +## Usage |
6 | 6 |
|
7 |
| -You must be using sbt 0.13 for your projects. First create a `project/plugins.sbt` files: |
| 7 | +Add the plugin to the `project/plugins.sbt` file: |
8 | 8 |
|
9 |
| - addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.0") |
| 9 | +``` |
| 10 | +addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.6") |
| 11 | +``` |
10 | 12 |
|
11 | 13 | Then, in your `build.sbt` add:
|
12 | 14 |
|
13 |
| - scalaModuleSettings |
14 |
| - |
15 |
| - name := "<your module name>" |
16 |
| - |
17 |
| - version := "<your module version>" |
18 |
| - |
19 |
| - // standard stuff follows: |
20 |
| - scalaVersion := "2.11.0-M8" |
21 |
| - |
| 15 | +``` |
| 16 | +scalaModuleSettings |
| 17 | +
|
| 18 | +name := "<module name>" |
| 19 | +repoName := "<GitHub repo name>" // the repo under github.com/scala/, only required if different from name |
| 20 | +organization := "<org>" |
| 21 | +version := "<module version>" |
| 22 | +
|
| 23 | +// The plugin uses `scalaVersionsByJvm` to set `crossScalaVersions` according to the JVM major version. |
| 24 | +// The `scalaVersion` is set to `crossScalaVersions.value.head`. |
| 25 | +scalaVersionsByJvm := { |
| 26 | + val v211 = "2.11.11" |
| 27 | + val v212 = "2.12.2" |
| 28 | + val v213 = "2.13.0-M1" |
| 29 | +
|
| 30 | + // Map[JvmMajorVersion, List[(ScalaVersion, UseForPublishing)]] |
| 31 | + Map( |
| 32 | + 6 -> List(v211 -> true), |
| 33 | + 7 -> List(v211 -> false), |
| 34 | + 8 -> List(v212 -> true, v213 -> true, v211 -> false), |
| 35 | + 9 -> List(v212, v213, v211).map(_ -> false) |
| 36 | + ) |
| 37 | +} |
| 38 | +
|
| 39 | +mimaPreviousVersion := Some("1.0.3") // enables MiMa (`None` by default, which disables it) |
| 40 | +
|
| 41 | +OsgiKeys.exportPackage := Seq(s"<exported package>;version=${version.value}") |
| 42 | +
|
| 43 | +// Other settings |
| 44 | +``` |
0 commit comments