2014-11-30 15:34:59 +02:00
|
|
|
/**
|
2017-01-04 17:37:10 +01:00
|
|
|
* Copyright (C) 2009-2017 Lightbend Inc. <http://www.lightbend.com>
|
2014-11-30 15:34:59 +02:00
|
|
|
*/
|
2011-09-23 10:21:03 +02:00
|
|
|
package akka
|
|
|
|
|
|
2011-07-08 18:01:19 +12:00
|
|
|
import sbt._
|
2011-12-09 21:55:49 +13:00
|
|
|
import sbt.Keys._
|
2011-07-08 18:01:19 +12:00
|
|
|
import java.io.File
|
|
|
|
|
|
2014-11-30 15:34:59 +02:00
|
|
|
object Publish extends AutoPlugin {
|
2011-07-08 18:01:19 +12:00
|
|
|
|
2014-11-30 15:34:59 +02:00
|
|
|
val defaultPublishTo = settingKey[File]("Default publish directory")
|
2011-12-09 21:55:49 +13:00
|
|
|
|
2014-11-30 15:34:59 +02:00
|
|
|
override def trigger = allRequirements
|
|
|
|
|
|
|
|
|
|
override lazy val projectSettings = Seq(
|
2011-10-06 15:44:15 +02:00
|
|
|
crossPaths := false,
|
|
|
|
|
pomExtra := akkaPomExtra,
|
2014-11-30 15:34:59 +02:00
|
|
|
publishTo := akkaPublishTo.value,
|
2011-10-06 15:44:15 +02:00
|
|
|
credentials ++= akkaCredentials,
|
2016-02-23 12:58:39 +01:00
|
|
|
organizationName := "Lightbend Inc.",
|
|
|
|
|
organizationHomepage := Some(url("http://www.lightbend.com")),
|
2012-03-30 09:59:33 -04:00
|
|
|
publishMavenStyle := true,
|
2017-10-06 10:30:28 +02:00
|
|
|
pomIncludeRepository := { x ⇒ false },
|
|
|
|
|
defaultPublishTo := crossTarget.value / "repository")
|
2011-07-08 18:01:19 +12:00
|
|
|
|
|
|
|
|
def akkaPomExtra = {
|
2017-06-19 16:09:40 +02:00
|
|
|
/* The scm info is automatic from the sbt-git plugin
|
2012-03-30 09:59:33 -04:00
|
|
|
<scm>
|
|
|
|
|
<url>git://github.com/akka/akka.git</url>
|
|
|
|
|
<connection>scm:git:git@github.com:akka/akka.git</connection>
|
2014-11-30 15:34:59 +02:00
|
|
|
</scm>
|
2017-06-19 16:09:40 +02:00
|
|
|
*/
|
|
|
|
|
<inceptionYear>2009</inceptionYear>
|
2012-03-30 09:59:33 -04:00
|
|
|
<developers>
|
2014-11-30 15:34:59 +02:00
|
|
|
<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>
|
2012-03-30 09:59:33 -04:00
|
|
|
</developers>
|
2011-07-08 18:01:19 +12:00
|
|
|
}
|
|
|
|
|
|
2014-11-30 15:34:59 +02:00
|
|
|
private def akkaPublishTo = Def.setting {
|
|
|
|
|
sonatypeRepo(version.value) orElse localRepo(defaultPublishTo.value)
|
2012-08-22 12:54:25 -04:00
|
|
|
}
|
|
|
|
|
|
2014-11-30 15:34:59 +02:00
|
|
|
private def sonatypeRepo(version: String): Option[Resolver] =
|
2017-10-06 10:30:28 +02:00
|
|
|
Option(sys.props("publish.maven.central")) filter (_.toLowerCase == "true") map { _ ⇒
|
2012-08-22 12:54:25 -04:00
|
|
|
val nexus = "https://oss.sonatype.org/"
|
2014-11-30 15:34:59 +02:00
|
|
|
if (version endsWith "-SNAPSHOT") "snapshots" at nexus + "content/repositories/snapshots"
|
|
|
|
|
else "releases" at nexus + "service/local/staging/deploy/maven2"
|
2011-12-09 21:55:49 +13:00
|
|
|
}
|
2011-07-08 18:01:19 +12:00
|
|
|
|
2014-11-30 15:34:59 +02:00
|
|
|
private def localRepo(repository: File) =
|
|
|
|
|
Some(Resolver.file("Default Local Repository", repository))
|
2011-07-08 18:01:19 +12:00
|
|
|
|
2014-11-30 15:34:59 +02:00
|
|
|
private def akkaCredentials: Seq[Credentials] =
|
2017-10-06 10:30:28 +02:00
|
|
|
Option(System.getProperty("akka.publish.credentials", null)).map(f ⇒ Credentials(new File(f))).toSeq
|
2011-07-08 18:01:19 +12:00
|
|
|
|
|
|
|
|
}
|