2019-01-02 18:55:26 +08:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2016-2019 Lightbend Inc. <https://www.lightbend.com>
|
2016-02-23 12:58:39 +01:00
|
|
|
*/
|
2018-03-13 23:45:55 +09:00
|
|
|
|
2011-12-09 21:55:49 +13:00
|
|
|
package akka
|
|
|
|
|
|
|
|
|
|
import sbt._
|
|
|
|
|
import sbt.Keys._
|
|
|
|
|
import java.io.File
|
2013-05-14 11:50:23 +02:00
|
|
|
import com.typesafe.sbt.pgp.PgpKeys.publishSigned
|
2017-10-30 03:13:14 +02:00
|
|
|
import sbtunidoc.BaseUnidocPlugin.autoImport.unidoc
|
2017-05-15 05:13:33 -07:00
|
|
|
import com.lightbend.paradox.sbt.ParadoxKeys
|
2011-12-09 21:55:49 +13:00
|
|
|
|
2017-05-15 05:13:33 -07:00
|
|
|
object Release extends ParadoxKeys {
|
2011-12-09 21:55:49 +13:00
|
|
|
val releaseDirectory = SettingKey[File]("release-directory")
|
|
|
|
|
|
|
|
|
|
lazy val settings: Seq[Setting[_]] = commandSettings ++ Seq(
|
2017-10-06 10:30:28 +02:00
|
|
|
releaseDirectory := crossTarget.value / "release")
|
2011-12-09 21:55:49 +13:00
|
|
|
|
|
|
|
|
lazy val commandSettings = Seq(
|
2019-01-29 15:39:54 +01:00
|
|
|
commands ++= Seq(buildReleaseCommand, buildDocsCommand))
|
2011-12-09 21:55:49 +13:00
|
|
|
|
2017-10-06 10:30:28 +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)
|
|
|
|
|
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
|
|
|
|
2011-12-09 21:55:49 +13:00
|
|
|
IO.delete(release)
|
|
|
|
|
IO.createDirectory(release)
|
|
|
|
|
IO.copyDirectory(repo, release / "releases")
|
2019-01-29 15:39:54 +01:00
|
|
|
state1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def buildDocsCommand = Command.command("buildDocs") { state =>
|
|
|
|
|
if (!sys.props.contains("akka.genjavadoc.enabled"))
|
|
|
|
|
throw new RuntimeException("Make sure you start sbt with \"-J-Dakka.genjavadoc.enabled=true\" otherwise no japi will be generated")
|
|
|
|
|
val extracted = Project.extract(state)
|
|
|
|
|
// we want to build the api-docs and docs with 2.12.x
|
|
|
|
|
val scalaV = extracted.get(scalaVersion)
|
|
|
|
|
if (!scalaV.startsWith("2.12"))
|
|
|
|
|
throw new RuntimeException(s"The docs should be built with Scala 2.12 (was $scalaV)")
|
|
|
|
|
val release = extracted.get(releaseDirectory)
|
|
|
|
|
val releaseVersion = extracted.get(version)
|
|
|
|
|
val projectRef = extracted.get(thisProjectRef)
|
|
|
|
|
|
|
|
|
|
val (state2, Seq(japi, api)) = extracted.runTask(unidoc in Compile, state)
|
|
|
|
|
val (state3, docs) = extracted.runTask(paradox in ProjectRef(projectRef.build, "akka-docs") in Compile, state2)
|
|
|
|
|
|
|
|
|
|
IO.delete(release / "api")
|
|
|
|
|
IO.delete(release / "japi")
|
|
|
|
|
IO.delete(release / "docsapi")
|
|
|
|
|
IO.createDirectory(release)
|
2011-12-09 21:55:49 +13:00
|
|
|
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
|
|
|
|
2017-01-25 18:04:24 +01:00
|
|
|
state3
|
2011-12-09 21:55:49 +13:00
|
|
|
}
|
2013-08-21 09:22:46 +02:00
|
|
|
|
2011-12-09 21:55:49 +13:00
|
|
|
}
|