Learn you an SBT for fun and profit – Scala Days 2014 example project
Scala
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
application/src
project
src/main/scala
web/src/main/scala
.gitignore
README.md
build.sbt

README.md

This is the example project used in my Scala Days 2014 talk Learn you an SBT for fun and profit.

The Hipster Coffee Shop is a web shop that sells overpriced coffee to Berlin hipsters. Their manager wants to have decent release notes for every release of their web application, so the SBT build contains some custom functionality for generating them from the Git history as a markdown file that contains the list of tickets closed in the release, some diff stats, and a list of the contributors to the release.

Usage

Call show releaseNotesGenerate_ and pass in a valid Git tag for a release to look at the generates release notes.

Call the releaseNotesDump task and pass in a valid Git tag for a release to write release notes into a markdown file.

The directory into which release notes are written can be configured by providing a setting for the releaseNotesDir setting key.

The file name of the generated markdown file can be changed by providing a setting for the releaseNotesFileName setting key.

The release notes functionality is implemented as an SBT autoplugin, and the sole purpose of this project is to demonstrate how to provide custom setting keys and task keys in SBT, how to implement your own tasks, using the File, IO, and Process APIs as well as parser combinators, and how to provide that functionality as an SBT auto plugin.

The functionality of the plugin is not usable in a generic way, as it makes strong assumptions about the format of release tags and about Git commit messages for closed tickets. A real-world version would likely allow configuring these things, too, and fetch the actual ticket description from an issue tracker.

To allow you to play around with this quickly, the release notes functionality is not a separate SBT project. Rather, the release notes auto plugin is simply part of the build project, under project/src/main/scala/releasenotes.