SethTisue / sbt-spiewak

A plugin which represents my personal SBT project baseline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sbt-spiewak Build Status Download

This plugin basically just exists to allow me to more conveniently setup my baseline SBT configuration, which has evolved somewhat over the years, and is also becoming quite unwieldy when solely represented in giter8 format. If you want to use this plugin with a new project, you should probably start from that template.

If you generally agree with my opinions on how projects should be set up, though, then this is probably a really excellent plugin to base on! Between this plugin and my giter8 template, you can get a new Scala project up and running and publishing to Bintray or Sonatype within about five minutes. As an example, check out this quick screencast:

sbt-spiewak demo

TLDR, it's really really easy.

Usage

Put one of the following into your plugins.sbt:

// for stock functionality (no publication defaults)
addSbtPlugin("com.codecommit" % "sbt-spiewak" % "<version>")

// publishing to bintray
addSbtPlugin("com.codecommit" % "sbt-spiewak-bintray" % "<version>")

// publishing to sonatype
addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "<version>")

Then, in your build.sbt, make sure you set a value for baseVersion, organization, publishGithubUser and publishFullName:

organization in ThisBuild := "com.codecommit"

baseVersion in ThisBuild := "0.1"

publishGithubUser in ThisBuild := "djspiewak"
publishFullName in ThisBuild := "Daniel Spiewak"

Or something like that.

If you have a multi-module build and need a subproject to not publish (as is commonly done with the root project), enable the NoPublishPlugin. For example:

lazy val root = project
  .aggregate(core, bintray, sonatype)
  .in(file("."))
  .settings(name := "root")
  .enablePlugins(NoPublishPlugin)

Features

  • Baseline plugin setup
    • coursier
    • sbt-travisci
    • sbt-git
      • With sane git versioning settings
      • Also with fixed git-status stuff
    • sbt-header
      • Assumes Apache 2.0 license
    • sbt-bintray (or sonatype!)
      • With fixed support for Travis builds
    • sbt-sonatype (or bintray!)
      • With fixed snapshot publication URLs
    • sbt-gpg
    • sbt-mima
      • Infers previous versions by using git tags
      • Automatically runs on ci and release
  • Sane scalac settings
    • Including -Ybackend-parallelism where supported
  • SI-2712 fix across scala versions (dating back to 2.10)
  • kind-projector
  • release and ci command aliases
    • Ensures bintray package existence
    • Performs sonatype release steps
    • Stages through bintrayRelease to allow release atomicity

Bintray Requirements

You will need to additionally define the following setting:

bintrayVcsUrl in Global := Some("git@github.com:you/your-repo.git")

Check sbt-bintray credentials on how to authenticate.

Sonatype Requirements

You will additionally need to define the following settings:

homepage in Global := Some(url("https://github.com/djspiewak/sbt-spiewak")),

scmInfo in Global := Some(ScmInfo(url("https://github.com/djspiewak/sbt-spiewak"),
  "git@github.com:djspiewak/sbt-spiewak.git")))

Defaults Which You May Wish to Override...

You may consider overriding any of the following keys, which are hard-coded to defaults that I believe are sane:

  • licenses (defaults to Apache 2.0)
  • developers (defaults to just yourself, using the publishFullName and publishGithubUser)
  • startYear (defaults to 2018)
  • strictSemVer (defaults to true)
    • When set to true, it disallows breaking binary compatibility in any release which does not increment the major component unless the major component is 0 (i.e. semantic versioning). Many Scala projects break binary compatibility in minor releases, such as Scala itself. This scheme is sometimes referred to as "scala ver". Setting strictSemVer in ThisBuild := false will relax the MiMa compatibility checks and allow you to perform such breakage if desired.

About

A plugin which represents my personal SBT project baseline

License:Apache License 2.0


Languages

Language:Scala 100.0%