build unified javadocs (under target/genjavadoc-api), see #3122
this also changes the akka_*-javadoc.jar to contain the assembled javadocs
This commit is contained in:
parent
77c18fc128
commit
7e7c1140b8
2 changed files with 49 additions and 34 deletions
|
|
@ -25,6 +25,7 @@ import java.io.{PrintWriter, InputStreamReader, FileInputStream, File}
|
||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
import java.util.Properties
|
import java.util.Properties
|
||||||
import annotation.tailrec
|
import annotation.tailrec
|
||||||
|
import Unidoc.{ JavaDoc, javadocSettings, junidocSources, unidoc, unidocExclude }
|
||||||
|
|
||||||
object AkkaBuild extends Build {
|
object AkkaBuild extends Build {
|
||||||
System.setProperty("akka.mode", "test") // Is there better place for this?
|
System.setProperty("akka.mode", "test") // Is there better place for this?
|
||||||
|
|
@ -45,29 +46,18 @@ object AkkaBuild extends Build {
|
||||||
id = "akka",
|
id = "akka",
|
||||||
base = file("."),
|
base = file("."),
|
||||||
settings = parentSettings ++ Release.settings ++ Unidoc.settings ++ Publish.versionSettings ++
|
settings = parentSettings ++ Release.settings ++ Unidoc.settings ++ Publish.versionSettings ++
|
||||||
SphinxSupport.settings ++ Dist.settings ++ mimaSettings ++ unidocScaladocSettings ++ Seq(
|
SphinxSupport.settings ++ Dist.settings ++ mimaSettings ++ unidocScaladocSettings ++
|
||||||
|
inConfig(JavaDoc)(Defaults.configSettings) ++ Seq(
|
||||||
testMailbox in GlobalScope := System.getProperty("akka.testMailbox", "false").toBoolean,
|
testMailbox in GlobalScope := System.getProperty("akka.testMailbox", "false").toBoolean,
|
||||||
parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", "false").toBoolean,
|
parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", "false").toBoolean,
|
||||||
Publish.defaultPublishTo in ThisBuild <<= crossTarget / "repository",
|
Publish.defaultPublishTo in ThisBuild <<= crossTarget / "repository",
|
||||||
Unidoc.unidocExclude := Seq(samples.id, channelsTests.id, remoteTests.id),
|
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"),
|
||||||
|
packageDoc in Compile <<= packageDoc in JavaDoc,
|
||||||
Dist.distExclude := Seq(actorTests.id, akkaSbtPlugin.id, docs.id, samples.id, osgi.id, osgiAries.id, channelsTests.id),
|
Dist.distExclude := Seq(actorTests.id, akkaSbtPlugin.id, docs.id, samples.id, osgi.id, osgiAries.id, channelsTests.id),
|
||||||
initialCommands in ThisBuild :=
|
|
||||||
"""|import language.postfixOps
|
|
||||||
|import akka.actor._
|
|
||||||
|import ActorDSL._
|
|
||||||
|import scala.concurrent._
|
|
||||||
|import com.typesafe.config.ConfigFactory
|
|
||||||
|import scala.concurrent.duration._
|
|
||||||
|import akka.util.Timeout
|
|
||||||
|val config = ConfigFactory.parseString("akka.stdout-loglevel=INFO,akka.loglevel=DEBUG,pinned{type=PinnedDispatcher,executor=thread-pool-executor,throughput=1000}")
|
|
||||||
|val remoteConfig = ConfigFactory.parseString("akka.remote.netty{port=0,use-dispatcher-for-io=akka.actor.default-dispatcher,execution-pool-size=0},akka.actor.provider=akka.remote.RemoteActorRefProvider").withFallback(config)
|
|
||||||
|var system: ActorSystem = null
|
|
||||||
|implicit def _system = system
|
|
||||||
|def startSystem(remoting: Boolean = false) { system = ActorSystem("repl", if(remoting) remoteConfig else config); println("don’t forget to system.shutdown()!") }
|
|
||||||
|implicit def ec = system.dispatcher
|
|
||||||
|implicit val timeout = Timeout(5 seconds)
|
|
||||||
|""".stripMargin,
|
|
||||||
initialCommands in Test in ThisBuild += "import akka.testkit._",
|
|
||||||
// generate online version of docs
|
// generate online version of docs
|
||||||
sphinxInputs in Sphinx <<= sphinxInputs in Sphinx in LocalProject(docs.id) map { inputs => inputs.copy(tags = inputs.tags :+ "online") },
|
sphinxInputs in Sphinx <<= sphinxInputs in Sphinx in LocalProject(docs.id) map { inputs => inputs.copy(tags = inputs.tags :+ "online") },
|
||||||
// don't regenerate the pdf, just reuse the akka-docs version
|
// don't regenerate the pdf, just reuse the akka-docs version
|
||||||
|
|
@ -103,17 +93,6 @@ object AkkaBuild extends Build {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val JavaDoc = config("genjavadoc") extend Compile
|
|
||||||
|
|
||||||
val javadocSettings = inConfig(JavaDoc)(Defaults.configSettings) ++ Seq(
|
|
||||||
libraryDependencies += compilerPlugin("com.typesafe.genjavadoc" %% "genjavadoc-plugin" % "0.1-SNAPSHOT" cross CrossVersion.full),
|
|
||||||
scalacOptions <+= target map (t => "-P:genjavadoc:out=" + t + "/java"),
|
|
||||||
packageDoc in Compile <<= packageDoc in JavaDoc,
|
|
||||||
sources in JavaDoc <<= (target, compile in Compile, sources in Compile) map ((t, c, s) => (t / "java" ** "*.java").get ++ s.filter(_.getName.endsWith(".java"))),
|
|
||||||
javacOptions in JavaDoc := Seq(),
|
|
||||||
artifactName in packageDoc in JavaDoc := ((sv, mod, art) => "" + mod.name + "_" + sv.binary + "-" + mod.revision + "-javadoc.jar")
|
|
||||||
)
|
|
||||||
|
|
||||||
lazy val actor = Project(
|
lazy val actor = Project(
|
||||||
id = "akka-actor",
|
id = "akka-actor",
|
||||||
base = file("akka-actor"),
|
base = file("akka-actor"),
|
||||||
|
|
@ -609,6 +588,23 @@ object AkkaBuild extends Build {
|
||||||
licenses in lsync := Seq(("Apache 2", url("http://www.apache.org/licenses/LICENSE-2.0.html"))),
|
licenses in lsync := Seq(("Apache 2", url("http://www.apache.org/licenses/LICENSE-2.0.html"))),
|
||||||
externalResolvers in lsync := Seq("Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases"),
|
externalResolvers in lsync := Seq("Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases"),
|
||||||
|
|
||||||
|
initialCommands :=
|
||||||
|
"""|import language.postfixOps
|
||||||
|
|import akka.actor._
|
||||||
|
|import ActorDSL._
|
||||||
|
|import scala.concurrent._
|
||||||
|
|import com.typesafe.config.ConfigFactory
|
||||||
|
|import scala.concurrent.duration._
|
||||||
|
|import akka.util.Timeout
|
||||||
|
|val config = ConfigFactory.parseString("akka.stdout-loglevel=INFO,akka.loglevel=DEBUG,pinned{type=PinnedDispatcher,executor=thread-pool-executor,throughput=1000}")
|
||||||
|
|val remoteConfig = ConfigFactory.parseString("akka.remote.netty{port=0,use-dispatcher-for-io=akka.actor.default-dispatcher,execution-pool-size=0},akka.actor.provider=akka.remote.RemoteActorRefProvider").withFallback(config)
|
||||||
|
|var system: ActorSystem = null
|
||||||
|
|implicit def _system = system
|
||||||
|
|def startSystem(remoting: Boolean = false) { system = ActorSystem("repl", if(remoting) remoteConfig else config); println("don’t forget to system.shutdown()!") }
|
||||||
|
|implicit def ec = system.dispatcher
|
||||||
|
|implicit val timeout = Timeout(5 seconds)
|
||||||
|
|""".stripMargin,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test settings
|
* Test settings
|
||||||
*/
|
*/
|
||||||
|
|
@ -723,7 +719,7 @@ object AkkaBuild extends Build {
|
||||||
lazy val unidocScaladocSettings: Seq[sbt.Setting[_]]= {
|
lazy val unidocScaladocSettings: Seq[sbt.Setting[_]]= {
|
||||||
Seq(scalacOptions in doc ++= scaladocOptions) ++
|
Seq(scalacOptions in doc ++= scaladocOptions) ++
|
||||||
(if (scaladocDiagramsEnabled)
|
(if (scaladocDiagramsEnabled)
|
||||||
Seq(Unidoc.unidoc ~= scaladocVerifier)
|
Seq(unidoc ~= scaladocVerifier)
|
||||||
else Seq.empty)
|
else Seq.empty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -882,6 +878,9 @@ object Dependencies {
|
||||||
// Cluster Sample
|
// Cluster Sample
|
||||||
val sigar = "org.fusesource" % "sigar" % "1.6.4" // ApacheV2
|
val sigar = "org.fusesource" % "sigar" % "1.6.4" // ApacheV2
|
||||||
|
|
||||||
|
// Compiler plugins
|
||||||
|
val genjavadoc = compilerPlugin("com.typesafe.genjavadoc" %% "genjavadoc-plugin" % "0.2" cross CrossVersion.full) // ApacheV2
|
||||||
|
|
||||||
// Test
|
// Test
|
||||||
|
|
||||||
object Test {
|
object Test {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,18 @@ import sbt.Keys._
|
||||||
import sbt.Project.Initialize
|
import sbt.Project.Initialize
|
||||||
|
|
||||||
object Unidoc {
|
object Unidoc {
|
||||||
|
|
||||||
|
lazy val JavaDoc = config("genjavadoc") extend Compile
|
||||||
|
|
||||||
|
lazy val javadocSettings = inConfig(JavaDoc)(Defaults.configSettings) ++ Seq(
|
||||||
|
libraryDependencies += Dependencies.Compile.genjavadoc,
|
||||||
|
scalacOptions <+= target map (t => "-P:genjavadoc:out=" + t + "/java"),
|
||||||
|
packageDoc in Compile <<= packageDoc in JavaDoc,
|
||||||
|
sources in JavaDoc <<= (target, compile in Compile, sources in Compile) map ((t, c, s) => (t / "java" ** "*.java").get ++ s.filter(_.getName.endsWith(".java"))),
|
||||||
|
javacOptions in JavaDoc := Seq(),
|
||||||
|
artifactName in packageDoc in JavaDoc := ((sv, mod, art) => "" + mod.name + "_" + sv.binary + "-" + mod.revision + "-javadoc.jar")
|
||||||
|
)
|
||||||
|
|
||||||
val unidocDirectory = SettingKey[File]("unidoc-directory")
|
val unidocDirectory = SettingKey[File]("unidoc-directory")
|
||||||
val unidocExclude = SettingKey[Seq[String]]("unidoc-exclude")
|
val unidocExclude = SettingKey[Seq[String]]("unidoc-exclude")
|
||||||
val unidocAllSources = TaskKey[Seq[Seq[File]]]("unidoc-all-sources")
|
val unidocAllSources = TaskKey[Seq[Seq[File]]]("unidoc-all-sources")
|
||||||
|
|
@ -12,20 +24,24 @@ object Unidoc {
|
||||||
val unidocAllClasspaths = TaskKey[Seq[Classpath]]("unidoc-all-classpaths")
|
val unidocAllClasspaths = TaskKey[Seq[Classpath]]("unidoc-all-classpaths")
|
||||||
val unidocClasspath = TaskKey[Seq[File]]("unidoc-classpath")
|
val unidocClasspath = TaskKey[Seq[File]]("unidoc-classpath")
|
||||||
val unidoc = TaskKey[File]("unidoc", "Create unified scaladoc for all aggregates")
|
val unidoc = TaskKey[File]("unidoc", "Create unified scaladoc for all aggregates")
|
||||||
|
val junidocAllSources = TaskKey[Seq[Seq[File]]]("junidoc-all-sources")
|
||||||
|
val junidocSources = TaskKey[Seq[File]]("junidoc-sources")
|
||||||
|
|
||||||
lazy val settings = Seq(
|
lazy val settings = Seq(
|
||||||
unidocDirectory <<= crossTarget / "unidoc",
|
unidocDirectory <<= crossTarget / "unidoc",
|
||||||
unidocExclude := Seq.empty,
|
unidocExclude := Seq.empty,
|
||||||
unidocAllSources <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allSources,
|
unidocAllSources <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allSources(Compile),
|
||||||
unidocSources <<= unidocAllSources map { _.flatten },
|
unidocSources <<= unidocAllSources map { _.flatten },
|
||||||
unidocAllClasspaths <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allClasspaths,
|
unidocAllClasspaths <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allClasspaths,
|
||||||
unidocClasspath <<= unidocAllClasspaths map { _.flatten.map(_.data).distinct },
|
unidocClasspath <<= unidocAllClasspaths map { _.flatten.map(_.data).distinct },
|
||||||
|
junidocAllSources <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allSources(JavaDoc),
|
||||||
|
junidocSources <<= junidocAllSources map { _.flatten },
|
||||||
unidoc <<= unidocTask
|
unidoc <<= unidocTask
|
||||||
)
|
)
|
||||||
|
|
||||||
def allSources(projectRef: ProjectRef, structure: Load.BuildStructure, exclude: Seq[String]): Task[Seq[Seq[File]]] = {
|
def allSources(conf: Configuration)(projectRef: ProjectRef, structure: Load.BuildStructure, exclude: Seq[String]): Task[Seq[Seq[File]]] = {
|
||||||
val projects = aggregated(projectRef, structure, exclude)
|
val projects = aggregated(projectRef, structure, exclude)
|
||||||
projects flatMap { sources in Compile in LocalProject(_) get structure.data } join
|
projects flatMap { sources in conf in LocalProject(_) get structure.data } join
|
||||||
}
|
}
|
||||||
|
|
||||||
def allClasspaths(projectRef: ProjectRef, structure: Load.BuildStructure, exclude: Seq[String]): Task[Seq[Classpath]] = {
|
def allClasspaths(projectRef: ProjectRef, structure: Load.BuildStructure, exclude: Seq[String]): Task[Seq[Classpath]] = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue