-
Notifications
You must be signed in to change notification settings - Fork 28
/
ApiDocSettings.scala
43 lines (26 loc) · 1.29 KB
/
ApiDocSettings.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sbt._
import Keys._
import play.Project._
// Adapted from: https://github.com/yesnault/Play20StartApp
object ApiDocSettings {
val apiDocTask = TaskKey[Unit]("api-doc", "run scaladoc and javadoc, placing results in target/api") <<= (fullClasspath in Test, compilers, streams) map { (classpath, cs, s) =>
val apiDir = "target/doc/api"
IO.delete(file(apiDir))
// Scaladoc
var scalaVersionForSbt = Option(System.getProperty("scala.version")).getOrElse("2.10.0")
val sourceFiles =
(file("app") ** "*.scala").get ++
(file("test") ** "*.scala").get ++
(file("target/scala-" + scalaVersionForSbt + "/src_managed/main/views/html") ** "*.scala").get
new Scaladoc(10, cs.scalac)("Scala API", sourceFiles, classpath.map(_.data), file(apiDir + "/scala"), Nil, s.log)
// Javadoc
val javaSources = Seq(file("test"), file("app")).mkString(":")
val javaApiTarget = file(apiDir + "/java")
val javaClasspath = classpath.map(_.data).mkString(":")
val javaPackages = "controllers:models:tests"
val cmd = <x>javadoc -linksource -sourcepath {javaSources} -d {javaApiTarget} -subpackages {javaPackages} -classpath {javaClasspath}</x>
//println("Executing: "+cmd.text)
cmd ! s.log
println("API documentation in " + apiDir)
}
}