2016-02-23 12:58:39 +01:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2016 Lightbend Inc. <http://www.lightbend.com>
|
|
|
|
|
*/
|
2011-12-09 21:55:49 +13:00
|
|
|
package akka
|
|
|
|
|
|
|
|
|
|
import sbt._
|
|
|
|
|
import sbt.Keys._
|
|
|
|
|
import java.io.File
|
2012-09-26 18:21:52 +12:00
|
|
|
import com.typesafe.sbt.site.SphinxSupport.{ generate, Sphinx }
|
2013-05-14 11:50:23 +02:00
|
|
|
import com.typesafe.sbt.pgp.PgpKeys.publishSigned
|
2013-08-21 09:22:46 +02:00
|
|
|
import com.typesafe.sbt.S3Plugin.S3
|
2014-04-25 16:32:43 +02:00
|
|
|
import sbtunidoc.Plugin.UnidocKeys._
|
2011-12-09 21:55:49 +13:00
|
|
|
|
|
|
|
|
object Release {
|
|
|
|
|
val releaseDirectory = SettingKey[File]("release-directory")
|
|
|
|
|
|
|
|
|
|
lazy val settings: Seq[Setting[_]] = commandSettings ++ Seq(
|
|
|
|
|
releaseDirectory <<= crossTarget / "release"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val commandSettings = Seq(
|
2013-08-21 09:22:46 +02:00
|
|
|
commands ++= Seq(buildReleaseCommand, uploadReleaseCommand)
|
2011-12-09 21:55:49 +13:00
|
|
|
)
|
|
|
|
|
|
2016-02-22 11:17:33 +02:00
|
|
|
def buildReleaseCommand = Command.command("buildRelease") { state =>
|
2011-12-09 21:55:49 +13:00
|
|
|
val extracted = Project.extract(state)
|
|
|
|
|
val release = extracted.get(releaseDirectory)
|
2014-11-30 15:53:41 +02:00
|
|
|
val dist = extracted.get(Dist.distDirectory)
|
2011-12-09 21:55:49 +13:00
|
|
|
val releaseVersion = extracted.get(version)
|
|
|
|
|
val projectRef = extracted.get(thisProjectRef)
|
|
|
|
|
val repo = extracted.get(Publish.defaultPublishTo)
|
2013-05-14 11:50:23 +02:00
|
|
|
val state1 = extracted.runAggregated(publishSigned in projectRef, state)
|
2014-04-25 16:32:43 +02:00
|
|
|
val (state2, Seq(api, japi)) = extracted.runTask(unidoc in Compile, state1)
|
2012-09-26 18:21:52 +12:00
|
|
|
val (state3, docs) = extracted.runTask(generate in Sphinx, state2)
|
2014-11-30 15:53:41 +02:00
|
|
|
val (state4, _) = extracted.runTask(Dist.dist, state3)
|
2013-12-04 12:12:38 +01:00
|
|
|
val (state5, activatorDist) = extracted.runTask(ActivatorDist.activatorDist in LocalProject(AkkaBuild.samples.id), state4)
|
2014-04-25 16:32:43 +02:00
|
|
|
|
2011-12-09 21:55:49 +13:00
|
|
|
IO.delete(release)
|
|
|
|
|
IO.createDirectory(release)
|
|
|
|
|
IO.copyDirectory(repo, release / "releases")
|
|
|
|
|
IO.copyDirectory(api, release / "api" / "akka" / releaseVersion)
|
2013-03-18 11:44:54 +01:00
|
|
|
IO.copyDirectory(japi, release / "japi" / "akka" / releaseVersion)
|
2011-12-09 21:55:49 +13:00
|
|
|
IO.copyDirectory(docs, release / "docs" / "akka" / releaseVersion)
|
2014-11-30 15:53:41 +02:00
|
|
|
|
|
|
|
|
// copy all distributions from dist dir to downloads dir
|
|
|
|
|
// may contain distributions from cross-builds
|
|
|
|
|
for (f <- (dist * "akka_*.zip").get)
|
|
|
|
|
IO.copyFile(f, release / "downloads" / f.name)
|
|
|
|
|
|
2013-12-04 12:12:38 +01:00
|
|
|
for (f <- (activatorDist * "*.zip").get)
|
|
|
|
|
IO.copyFile(f, release / "downloads" / f.name)
|
2014-11-30 15:53:41 +02:00
|
|
|
|
2013-12-04 12:12:38 +01:00
|
|
|
state5
|
2011-12-09 21:55:49 +13:00
|
|
|
}
|
2013-08-21 09:22:46 +02:00
|
|
|
|
2016-02-22 11:17:33 +02:00
|
|
|
def uploadReleaseCommand = Command.command("uploadRelease") { state =>
|
2013-08-21 09:22:46 +02:00
|
|
|
val extracted = Project.extract(state)
|
|
|
|
|
val (state1, _) = extracted.runTask(S3.upload, state)
|
|
|
|
|
state1
|
|
|
|
|
}
|
2011-12-09 21:55:49 +13:00
|
|
|
}
|