=pro upgrade to latest sbt and add first auto plugins

* RootSettings plugin contains settings for root project
* other auto plugins that are meant only for root project depend on RootSettings
* other auto plugins that are meant for every project are enabled by default reducing boilerplate
This commit is contained in:
Martynas Mickevičius 2014-11-30 15:34:59 +02:00
parent 338f61886e
commit 22334da2a1
26 changed files with 117 additions and 101 deletions

View file

@ -71,7 +71,7 @@ Whether or not a pull request (or parts of it) shall be back- or forward-ported
## Continuous Integration
Each project should be configured to use a continuous integration (CI) tool (i.e. a build server à la Jenkins). Typesafe has a Jenkins server farm that can be used. The CI tool should, on each push to master, build the **full** distribution and run **all** tests, and if something fails it should email out a notification with the failure report to the committer and the core team. The CI tool should also be used in conjunction with Typesafes Pull Request Validator (discussed below).
Each project should be configured to use a continuous integration (CI) tool (i.e. a build server à la Jenkins). Typesafe has a [Jenkins server farm](https://jenkins.akka.io/) that can be used. The CI tool should, on each push to master, build the **full** distribution and run **all** tests, and if something fails it should email out a notification with the failure report to the committer and the core team. The CI tool should also be used in conjunction with a Pull Request validator (discussed below).
## Documentation
@ -143,8 +143,16 @@ Example:
## How To Enforce These Guidelines?
### Make Use Of Typesafes Pull Request Validator
It is recommended to set up the project to use Typesafes [Pull Request Validator](https://github.com/typesafehub/ghpullrequest-validator) that automatically merges the code, builds it, runs the tests and comments on the Pull Request in GitHub.
### Make Use of Pull Request Validator
Akka uses [Jenkins GitHub pull request builder plugin](https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin) that automatically merges the code, builds it, runs the tests and comments on the Pull Request in GitHub.
Upon a submission of a Pull Request the Github pull request builder plugin will post a following comment:
Can one of the repo owners verify this patch?
This requires a member from a core team to start Pull Request validation process by posting comment consisting only of `OK TO TEST`. From now on, whenever new commits are pushed to the Pull Request, a validation job will be automaticaly started and the results of the validation posted to the Pull Request.
A Pull Request validation job can be started manually by posting `TEST THIS PLEASE` comment on the Pull Request.
## Source style

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -0,0 +1 @@
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -0,0 +1 @@
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

View file

@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.7

1
build.sbt Normal file
View file

@ -0,0 +1 @@
enablePlugins(akka.RootSettings)

View file

@ -40,11 +40,10 @@ object AkkaBuild extends Build {
lazy val root = Project(
id = "akka",
base = file("."),
settings = parentSettings ++ Release.settings ++ unidocSettings ++ Publish.versionSettings ++
settings = parentSettings ++ Release.settings ++ unidocSettings ++
SphinxDoc.akkaSettings ++ Dist.settings ++ s3Settings ++ mimaSettings ++ scaladocSettings ++
GraphiteBuildEvents.settings ++ Protobuf.settings ++ Unidoc.settings(Seq(samples), Seq(remoteTests)) ++ Seq(
parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", "false").toBoolean,
Publish.defaultPublishTo in ThisBuild <<= crossTarget / "repository",
Dist.distExclude := Seq(actorTests.id, docs.id, samples.id, osgi.id),
S3.host in S3.upload := "downloads.typesafe.com.s3.amazonaws.com",
@ -231,7 +230,7 @@ object AkkaBuild extends Build {
) ++
resolverSettings
lazy val baseSettings = Defaults.defaultSettings ++ Publish.settings
lazy val baseSettings = Defaults.defaultSettings
lazy val parentSettings = baseSettings ++ Seq(
publishArtifact := false,

View file

@ -1,99 +1,61 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka
import sbt._
import sbt.Keys._
import sbt.Project.Initialize
import java.io.File
object Publish {
final val Snapshot = "-SNAPSHOT"
object Publish extends AutoPlugin {
val defaultPublishTo = SettingKey[File]("default-publish-to")
val defaultPublishTo = settingKey[File]("Default publish directory")
lazy val settings = Seq(
override def trigger = allRequirements
override lazy val projectSettings = Seq(
crossPaths := false,
pomExtra := akkaPomExtra,
publishTo <<= akkaPublishTo,
publishTo := akkaPublishTo.value,
credentials ++= akkaCredentials,
organizationName := "Typesafe Inc.",
organizationHomepage := Some(url("http://www.typesafe.com")),
publishMavenStyle := true,
// Maven central cannot allow other repos.
// TODO - Make sure all artifacts are on central.
pomIncludeRepository := { x => false }
)
lazy val versionSettings = Seq(
commands += stampVersion
pomIncludeRepository := { x => false },
defaultPublishTo := crossTarget.value / "repository"
)
def akkaPomExtra = {
(<inceptionYear>2009</inceptionYear>
<inceptionYear>2009</inceptionYear>
<scm>
<url>git://github.com/akka/akka.git</url>
<connection>scm:git:git@github.com:akka/akka.git</connection>
</scm>) ++ makeDevelopersXml(Map(
"jboner" -> "Jonas Boner",
"viktorklang" -> "Viktor Klang",
"rkuhn" -> "Roland Kuhn",
"pvlugter" -> "Peter Vlugter"
// TODO - More than the names in the last 10 commits
))
}
private[this] def makeDevelopersXml(users: Map[String,String]) =
</scm>
<developers>
{
for((id, user) <- users)
yield <developer><id>{id}</id><name>{user}</name></developer>
}
<developer>
<id>akka-contributors</id>
<name>Akka Contributors</name>
<email>akka-dev@googlegroups.com</email>
<url>https://github.com/akka/akka/graphs/contributors</url>
</developer>
</developers>
def sonatypePublishTo: Initialize[Option[Resolver]] = {
version { v: String =>
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
}
def akkaPublishTo: Initialize[Option[Resolver]] = {
(defaultPublishTo, version) { (defaultPT, v) =>
akkaPublishRepository orElse
sonatypeRepo(v) orElse
Some(Resolver.file("Default Local Repository", defaultPT))
}
private def akkaPublishTo = Def.setting {
sonatypeRepo(version.value) orElse localRepo(defaultPublishTo.value)
}
def sonatypeRepo(version: String): Option[Resolver] = {
private def sonatypeRepo(version: String): Option[Resolver] =
Option(sys.props("publish.maven.central")) filter (_.toLowerCase == "true") map { _ =>
val nexus = "https://oss.sonatype.org/"
if(version endsWith "-SNAPSHOT") ("snapshots" at nexus + "content/repositories/snapshots")
else ("releases" at nexus + "service/local/staging/deploy/maven2")
}
if (version endsWith "-SNAPSHOT") "snapshots" at nexus + "content/repositories/snapshots"
else "releases" at nexus + "service/local/staging/deploy/maven2"
}
def akkaPublishRepository: Option[Resolver] =
Option(System.getProperty("akka.publish.repository", null)) map { "Akka Publish Repository" at _ }
private def localRepo(repository: File) =
Some(Resolver.file("Default Local Repository", repository))
def akkaCredentials: Seq[Credentials] =
Option(System.getProperty("akka.publish.credentials", null)) map (f => Credentials(new File(f))) toSeq
private def akkaCredentials: Seq[Credentials] =
Option(System.getProperty("akka.publish.credentials", null)).map(f => Credentials(new File(f))).toSeq
// timestamped versions
def stampVersion = Command.command("stamp-version") { state =>
val extracted = Project.extract(state)
extracted.append(List(version in ThisBuild ~= stamp), state)
}
def stamp(version: String): String = {
if (version endsWith Snapshot) (version stripSuffix Snapshot) + "-" + timestamp(System.currentTimeMillis)
else version
}
def timestamp(time: Long): String = {
val format = new java.text.SimpleDateFormat("yyyyMMdd-HHmmss")
format.format(new java.util.Date(time))
}
}

View file

@ -0,0 +1,10 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka
import sbt.AutoPlugin
object RootSettings extends AutoPlugin {
// settings for root project will go here
}

View file

@ -0,0 +1,34 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka
import sbt._
import sbt.Keys._
object TimeStampede extends AutoPlugin {
override def requires = RootSettings
override def trigger = allRequirements
override lazy val projectSettings = Seq(
commands += stampVersion
)
final val Snapshot = "-SNAPSHOT"
def stampVersion = Command.command("stampVersion") { state =>
val extracted = Project.extract(state)
extracted.append(List(version in ThisBuild ~= stamp), state)
}
def stamp(version: String): String = {
if (version endsWith Snapshot) (version stripSuffix Snapshot) + "-" + timestamp(System.currentTimeMillis)
else version
}
def timestamp(time: Long): String = {
val format = new java.text.SimpleDateFormat("yyyyMMdd-HHmmss")
format.format(new java.util.Date(time))
}
}

View file

@ -1 +1 @@
sbt.version=0.13.5
sbt.version=0.13.7