Skip to content

Commit

Permalink
restrict Sphinx tasks to akka-docs cage
Browse files Browse the repository at this point in the history
  • Loading branch information
rkuhn committed Jul 27, 2012
1 parent a7b1b6c commit 2ef7e7a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
16 changes: 6 additions & 10 deletions project/AkkaBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
import java.lang.Boolean.getBoolean
import sbt.Tests
import Sphinx.{ sphinxDocs, sphinxHtml, sphinxLatex, sphinxPdf, sphinxPygments, sphinxTags }
import Sphinx.{ sphinxDocs, sphinxTags }

object AkkaBuild extends Build {
System.setProperty("akka.mode", "test") // Is there better place for this?
Expand All @@ -36,7 +36,7 @@ object AkkaBuild extends Build {
lazy val akka = Project(
id = "akka",
base = file("."),
settings = parentSettings ++ Release.settings ++ Unidoc.settings ++ Sphinx.settings ++ Publish.versionSettings ++
settings = parentSettings ++ Release.settings ++ Unidoc.settings ++ Publish.versionSettings ++
Dist.settings ++ mimaSettings ++ Seq(
testMailbox in GlobalScope := System.getProperty("akka.testMailbox", "false").toBoolean,
parallelExecution in GlobalScope := System.getProperty("akka.parallelExecution", "false").toBoolean,
Expand All @@ -57,13 +57,7 @@ object AkkaBuild extends Build {
|implicit def ec = system.dispatcher
|implicit val timeout = Timeout(5 seconds)
|""".stripMargin,
initialCommands in Test in ThisBuild += "import akka.testkit._",
// online version of docs
sphinxDocs <<= baseDirectory / "akka-docs",
sphinxTags in sphinxHtml += "online",
sphinxPygments <<= sphinxPygments in LocalProject(docs.id),
sphinxLatex <<= sphinxLatex in LocalProject(docs.id),
sphinxPdf <<= sphinxPdf in LocalProject(docs.id)
initialCommands in Test in ThisBuild += "import akka.testkit._"
),
aggregate = Seq(actor, testkit, actorTests, remote, remoteTests, camel, cluster, slf4j, agent, transactor, mailboxes, zeroMQ, kernel, /*akkaSbtPlugin,*/ samples, tutorials, osgi, osgiAries, docs)
)
Expand Down Expand Up @@ -326,7 +320,9 @@ object AkkaBuild extends Build {
unmanagedSourceDirectories in Test <<= baseDirectory { _ ** "code" get },
libraryDependencies ++= Dependencies.docs,
unmanagedSourceDirectories in ScalariformKeys.format in Test <<= unmanagedSourceDirectories in Test,
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v")
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v"),
// online version of docs
sphinxTags in Sphinx.Html += "online"
)
)

Expand Down
5 changes: 4 additions & 1 deletion project/Release.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object Release {
val repo = extracted.get(Publish.defaultPublishTo)
val state1 = extracted.runAggregated(publish in projectRef, state)
val (state2, api) = extracted.runTask(Unidoc.unidoc, state1)
val (state3, docs) = extracted.runTask(Sphinx.sphinx, state2)
val (state3, docs) = extracted.runTask(Sphinx.sphinx in docsProject, state2)
val (state4, dist) = extracted.runTask(Dist.dist, state3)
IO.delete(release)
IO.createDirectory(release)
Expand All @@ -33,4 +33,7 @@ object Release {
IO.copyFile(dist, release / "downloads" / dist.name)
state4
}

def docsProject: ProjectReference = LocalProject(AkkaBuild.docs.id)

}
11 changes: 7 additions & 4 deletions project/Sphinx.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ object Sphinx {
sphinxDocs <<= baseDirectory,
sphinxTarget <<= crossTarget / "sphinx",
sphinxPygmentsDir <<= sphinxDocs { _ / "_sphinx" / "pygments" },
sphinxTags in sphinxHtml := Seq.empty,
sphinxTags in sphinxLatex := Seq.empty,
sphinxTags in Html := Seq.empty,
sphinxTags in Latex := Seq.empty,
sphinxPygments <<= pygmentsTask,
sphinxHtml <<= buildTask("html", sphinxTags in sphinxHtml),
sphinxLatex <<= buildTask("latex", sphinxTags in sphinxLatex),
sphinxHtml <<= buildTask("html", sphinxTags in Html),
sphinxLatex <<= buildTask("latex", sphinxTags in Latex),
sphinxPdf <<= pdfTask,
sphinx <<= sphinxTask
)

lazy val Latex = Configuration("sphinx-latex", "tags for LaTeX version of docs", true, Nil, false)
lazy val Html = Configuration("sphinx-html", "tags for HTML version of docs", true, Nil, false)

def pygmentsTask = (sphinxDocs, sphinxPygmentsDir, sphinxTarget, streams) map {
(cwd, pygments, baseTarget, s) => {
val target = baseTarget / "site-packages"
Expand Down

0 comments on commit 2ef7e7a

Please sign in to comment.