Skip to content

Instantly share code, notes, and snippets.

@machisuji
Created September 1, 2011 20:28
Show Gist options
  • Select an option

  • Save machisuji/1187185 to your computer and use it in GitHub Desktop.

Select an option

Save machisuji/1187185 to your computer and use it in GitHub Desktop.
Generating documentation for all projects
sbt
> project docs
Set current project to docs 1.0
> docs
[info] == docs ==
[info] Generating API documentation ...
class MyParentProject(info: ProjectInfo) extends ParentProject(info) {
lazy val core = project("core", "mpp-core", new Core(_))
// ... more sub projects
lazy val docs = project("docs", "docs", new Docs(_), core /*, ... */)
def concatPaths[T](s: Seq[T])(f: PartialFunction[T, PathFinder]): PathFinder = {
def finder: T => PathFinder = f orElse { case _ => Path.emptyPathFinder }
(Path.emptyPathFinder /: s)(_ +++ finder(_))
}
def deepSources = concatPaths(topologicalSort) { case p: ScalaPaths => p.mainSources }
def deepDocClasspath = (Path.emptyPathFinder /: dependencies.map {
case p: DefaultProject => p.compileClasspath })(_ +++ _)
class Docs(info: ProjectInfo) extends DefaultProject(info) {
lazy val docs = scaladocTask("MyParentProject", deepSources, docPath, deepDocClasspath, documentOptions)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment