diff --git a/project/AkkaBuild.scala b/project/AkkaBuild.scala index 4c0be9ec79..2f2c5a15df 100644 --- a/project/AkkaBuild.scala +++ b/project/AkkaBuild.scala @@ -25,6 +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 } object AkkaBuild extends Build { System.setProperty("akka.mode", "test") // Is there better place for this? @@ -45,29 +46,18 @@ object AkkaBuild extends Build { id = "akka", base = file("."), 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, parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", "false").toBoolean, 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), - 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 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 @@ -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( id = "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"))), 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 */ @@ -723,7 +719,7 @@ object AkkaBuild extends Build { lazy val unidocScaladocSettings: Seq[sbt.Setting[_]]= { Seq(scalacOptions in doc ++= scaladocOptions) ++ (if (scaladocDiagramsEnabled) - Seq(Unidoc.unidoc ~= scaladocVerifier) + Seq(unidoc ~= scaladocVerifier) else Seq.empty) } @@ -882,6 +878,9 @@ object Dependencies { // Cluster Sample 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 object Test { diff --git a/project/Unidoc.scala b/project/Unidoc.scala index 209fda53c7..63af1cbaa5 100644 --- a/project/Unidoc.scala +++ b/project/Unidoc.scala @@ -5,6 +5,18 @@ import sbt.Keys._ import sbt.Project.Initialize 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 unidocExclude = SettingKey[Seq[String]]("unidoc-exclude") val unidocAllSources = TaskKey[Seq[Seq[File]]]("unidoc-all-sources") @@ -12,20 +24,24 @@ object Unidoc { 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 junidocAllSources = TaskKey[Seq[Seq[File]]]("junidoc-all-sources") + val junidocSources = TaskKey[Seq[File]]("junidoc-sources") lazy val settings = Seq( unidocDirectory <<= crossTarget / "unidoc", unidocExclude := Seq.empty, - unidocAllSources <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allSources, + unidocAllSources <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allSources(Compile), unidocSources <<= unidocAllSources map { _.flatten }, unidocAllClasspaths <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allClasspaths, unidocClasspath <<= unidocAllClasspaths map { _.flatten.map(_.data).distinct }, + junidocAllSources <<= (thisProjectRef, buildStructure, unidocExclude) flatMap allSources(JavaDoc), + junidocSources <<= junidocAllSources map { _.flatten }, 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) - 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]] = {