twitter-archive/sbt-package-dist

Name: sbt-package-dist

Owner: Twitter, Inc.

Owner: Twitter Archive

Description: sbt 11 plugin codifying best practices for building, packaging, and publishing

Created: 2012-03-27 22:15:14.0

Updated: 2018-03-31 00:59:39.0

Pushed: 2015-05-09 10:49:03.0

Homepage:

Size: 8933

Language: Scala

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

sbt-package-dist

sbt-package-dist is a plugin for sbt 0.11 which attempts to codify best practices for building, packaging, and publishing libraries and servers. It adds the following features:

General Usage

Getting sbt-package-dist

See https://github.com/harrah/xsbt/wiki/Plugins for information on adding plugins. In general, you'll need to add the following to your project/plugins.sbt file:

addSbtPlugin("com.twitter" % "sbt-package-dist" % "1.0.0")
Mixing in sbt-package-dist

sbt-package-dist is a collection of many different mixins. Each mixin provides a set of SBT Settings, Tasks and/or Commands that your project can use. The way an SBT project “uses” these extensions is by adding them to the project's settings map. There are two ways to include settings into your build definition.

Using an .sbt file

If you want to include all of the settings:

import com.twitter.sbt._

seq(StandardProject.newSettings: _*)

If you want to include only a specific mixin's settings, you can specify just the one(s) you want:

import com.twitter.sbt._

seq(GitProject.gitSettings: _*)
Using a .scala build definition

In your scala build definition, just extend the settings of any defined projects:

import sbt._
import Keys._
import com.twitter.sbt._

object MyProject extends Build {
  lazy val root = Project(
    id = "my-project",
    base = file("."),
    settings = StandardProject.newSettings
  )
}

Reference

Plugins

Standard project provides the following plugins you can extend:

StandardProject

Aggregates a “reasonable” set of mixins into a single plugin. Currently included are:

DefaultRepos

Sets up a default set of maven repos used in most Twitter projects. If the SBT_PROXY_REPO environment variable is set, it uses a proxy repo instead. Using a proxy repo may be useful when building in an environment where sbt can't access the internet.

ArtifactoryPublisher

Publishes artifacts to an “artifactory” (optionally with credentials) instead of the default publishing target. This mixin only takes effect if artifactoryResolver is set.

SubversionPublisher

Publishes artifacts to a subversion repo, if one is set. Settings of interest are:

GitProject

Adds various settings and commands for dealing with git-based projects, including:

BuildProperties

Uses GitProject to write a build.properties file containing information about the environment used to produce a jar. Includes the name, version, build name (usually a timestamp), git revision, git branch, and the last few commits.

PublishSourcesAndJavadocs

Just works around a bug in sbt to prevent scaladoc from blowing up.

PackageDist

Generates a deployable zip file of a server, containing:

VersionManagement

Provides commands to modify the current project version, including:

These commands look in build.sbt and project/*.scala files for a current version string and replace it with the updated version. After this is done, the command reloads the project, which should now have the updated version.

ReleaseManagement

Provides commands for publishing a release. The primary command is release- publish, which does the following in sequence:


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.