verizon / sbt-scalaz   0.1.3

Apache License 2.0 GitHub

Helpful SBT plugin for cross-publishing libraries with Scalaz

Scala versions: 2.10
sbt plugins: 0.13

sbt-scalaz

Build Status Maven Central

An sbt plugin to manage scalaz cross builds. Features include:

  • Rewriting your project version based on community naming conventions.
  • Adding scalaz version-specific directories to your source path.
  • Add a forScalaz operator to dependencies to try to find an appropriate one.

Usage

  1. Add to your project/plugins.sbt:
addSbtPlugin("io.verizon.build" % "sbt-scalaz" % sbtScalazVersion)
  1. Set version in ThisBuild in your project's version.sbt:
version in ThisBuild := "1.0.0-SNAPSHOT"
  1. Set SCALAZ_VERSION environment variable to initialize the scalazVersion setting in your build. Travis users might include something like the following in .travis.yml:
env:
  matrix:
  - SCALAZ_VERSION=7.2.9
  - SCALAZ_VERSION=7.1.11

Version suffix

This plugin rewrites the version setting of your modules based on version in ThisBuild and scalazVersion. No consensus has been reached in the community, so this plugin supports multiple strategies. You choose it by setting the scalazVersionRewriter:

importp verizon.build.ScalazPlugin.autoImport._
import verizon.build.ScalazPlugin.scalazVersionRewriters

scalazVersionRewriter := scalazVersionRewriters.scalazStream_0_8

We recommend default, but scalazStream_0_8 also has significant traction in the community:

scalazVersionRewriter version in ThisBuild scalazVersion version
default 1.0.0 7.2.9 1.0.0-scalaz-7.2
default 1.0.0 7.1.11 1.0.0-scalaz-7.1
default 1.0.0-SNAPSHOT 7.2.9 1.0.0-scalaz-7.2-SNAPSHOT
scalazStream_0_8 1.0.0 7.2.9 1.0.0a
scalazStream_0_8 1.0.0 7.1.11 1.0.0
scalazStream_0_8 1.0.0-SNAPSHOT 7.2.9 1.0.0a-SNAPSHOT

Dependencies

sbt-scalaz tries to understand the Scalaz dependency ecosystem so you don't have to. knobs, http4s, and specs2 use three different publishing conventions. Use the forScalaz operator and let sbt-scalaz find the right convention:

libraryDependencies ++= Seq(
  "org.http4s" %% "http4s-server" % "0.15.7" forScalaz scalazVersion.value,
  "io.verizon.knobs" %% "core" % "4.0.30" forScalaz scalazVersion.value,
  "org.specs2" %% "specs2-core" % "3.8.6" forScalaz scalazVersion.value 
)

under scalaz 7.2.9 becomes

libraryDependencies ++= Seq(
  "org.http4s" %% "http4s-server" % "0.15.7a",
  "io.verizon.knobs" %% "core" % "4.0.30-scalaz-7.2",
  "org.specs2" %% "specs2-core" % "3.8.6"
)

and under scalaz 7.1.11 becomes

libraryDependencies ++= Seq(
  "org.http4s" %% "http4s-server" % "0.15.7",
  "io.verizon.knobs" %% "core" % "4.0.30-scalaz-7.1",
  "org.specs2" %% "specs2-core" % "3.8.6-scalaz-7.1"
)

We do the dirty work so you don't have to.