Release should build and copy javadoc automatically. See #3158

This commit is contained in:
Björn Antonsson 2013-03-18 11:44:54 +01:00
parent 6e8125a46e
commit ed40dff7d7
5 changed files with 14 additions and 10 deletions

View file

@ -25,7 +25,7 @@ import java.io.{PrintWriter, InputStreamReader, FileInputStream, File}
import java.nio.charset.Charset
import java.util.Properties
import annotation.tailrec
import Unidoc.{ JavaDoc, javadocSettings, junidocSources, unidoc, unidocExclude }
import Unidoc.{ JavaDoc, javadocSettings, junidocSources, sunidoc, unidocExclude }
object AkkaBuild extends Build {
System.setProperty("akka.mode", "test") // Is there better place for this?
@ -52,7 +52,6 @@ object AkkaBuild extends Build {
parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", "false").toBoolean,
Publish.defaultPublishTo in ThisBuild <<= crossTarget / "repository",
unidocExclude := Seq(samples.id, channelsTests.id, remoteTests.id),
unidoc <<= (unidoc, doc in JavaDoc) map ((u, d) => u),
sources in JavaDoc <<= junidocSources,
javacOptions in JavaDoc := Seq(),
artifactName in packageDoc in JavaDoc := ((sv, mod, art) => "" + mod.name + "_" + sv.binary + "-" + mod.revision + "-javadoc.jar"),
@ -719,7 +718,7 @@ object AkkaBuild extends Build {
lazy val unidocScaladocSettings: Seq[sbt.Setting[_]]= {
Seq(scalacOptions in doc ++= scaladocOptions) ++
(if (scaladocDiagramsEnabled)
Seq(unidoc ~= scaladocVerifier)
Seq(sunidoc ~= scaladocVerifier)
else Seq.empty)
}

View file

@ -29,7 +29,7 @@ object Dist {
distLibJars <<= (thisProjectRef, buildStructure, distExclude) flatMap aggregated(packageBin.task in Compile),
distSrcJars <<= (thisProjectRef, buildStructure, distExclude) flatMap aggregated(packageSrc.task in Compile),
distDocJars <<= (thisProjectRef, buildStructure, distExclude) flatMap aggregated(packageDoc.task in Compile),
distSources <<= (distDependencies, distLibJars, distSrcJars, distDocJars, Unidoc.unidoc, generate in Sphinx in docsProject) map DistSources,
distSources <<= (distDependencies, distLibJars, distSrcJars, distDocJars, Unidoc.sunidoc, generate in Sphinx in docsProject) map DistSources,
distDirectory <<= crossTarget / "dist",
distUnzipped <<= distDirectory / "unzipped",
distFile <<= (distDirectory, version) { (dir, v) => dir / ("akka-" + v + ".zip") },

View file

@ -23,13 +23,14 @@ object Release {
val projectRef = extracted.get(thisProjectRef)
val repo = extracted.get(Publish.defaultPublishTo)
val state1 = extracted.runAggregated(publish in projectRef, state)
val (state2, api) = extracted.runTask(Unidoc.unidoc, state1)
val (state2, (api, japi)) = extracted.runTask(Unidoc.unidoc, state1)
val (state3, docs) = extracted.runTask(generate in Sphinx, state2)
val (state4, dist) = extracted.runTask(Dist.dist, state3)
IO.delete(release)
IO.createDirectory(release)
IO.copyDirectory(repo, release / "releases")
IO.copyDirectory(api, release / "api" / "akka" / releaseVersion)
IO.copyDirectory(japi, release / "japi" / "akka" / releaseVersion)
IO.copyDirectory(docs, release / "docs" / "akka" / releaseVersion)
IO.copyFile(dist, release / "downloads" / dist.name)
state4

View file

@ -30,7 +30,9 @@ object Unidoc {
val unidocSources = TaskKey[Seq[File]]("unidoc-sources")
val unidocAllClasspaths = TaskKey[Seq[Classpath]]("unidoc-all-classpaths")
val unidocClasspath = TaskKey[Seq[File]]("unidoc-classpath")
val unidoc = TaskKey[File]("unidoc", "Create unified scaladoc for all aggregates")
val unidoc = TaskKey[(File, File)]("unidoc", "Create unified scaladoc and javadoc for all aggregates")
val sunidoc = TaskKey[File]("sunidoc", "Create unified scaladoc for all aggregates")
val junidoc = TaskKey[File]("junidoc", "Create unified javadoc for all aggregates")
val junidocAllSources = TaskKey[Seq[Seq[File]]]("junidoc-all-sources")
val junidocSources = TaskKey[Seq[File]]("junidoc-sources")
@ -43,7 +45,9 @@ object Unidoc {
unidocClasspath <<= unidocAllClasspaths map { _.flatten.map(_.data).distinct },
junidocAllSources <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allSources(JavaDoc),
junidocSources <<= junidocAllSources map { _.flatten },
unidoc <<= unidocTask
sunidoc <<= sunidocTask,
junidoc <<= (doc in JavaDoc),
unidoc <<= (sunidoc, junidoc) map ((s, t) (s, t))
)
def allSources(conf: Configuration)(projectRef: ProjectRef, structure: Load.BuildStructure, exclude: Seq[String]): Task[Seq[Seq[File]]] = {
@ -64,7 +68,7 @@ object Unidoc {
}
}
def unidocTask: Initialize[Task[File]] = {
def sunidocTask: Initialize[Task[File]] = {
(compilers, cacheDirectory, unidocSources, unidocClasspath, unidocDirectory, scalacOptions in doc, streams) map {
(compilers, cache, sources, classpath, target, options, s) => {
val scaladoc = new Scaladoc(100, compilers.scalac)

View file

@ -290,9 +290,9 @@ fi
# build the release
echolog "Building the release..."
if [ ! $dry_run ]; then
RELEASE_OPT="-Dpublish.maven.central=true"
RELEASE_OPT="-Dakka.genjavadoc.enabled=true -Dpublish.maven.central=true"
else
RELEASE_OPT=""
RELEASE_OPT="-Dakka.genjavadoc.enabled=true"
fi
try sbt $RELEASE_OPT build-release
echolog "Creating gzipped tar download..."