Skip to content

Commit c4a2c90

Browse files
committed
First cut at generating Javadoc in the SBT build.
1 parent 6a02ea9 commit c4a2c90

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

project/build/FunctionalJavaProject.scala

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sbt._
22
import java.util.jar.Attributes.Name._
3+
import Process._
34

45
final class FunctionalJavaProject(info: ProjectInfo) extends DefaultProject(info) {
56
override def compileOptions = target(Target.Java1_5) :: List(CompileOptions.Unchecked, "-encoding", "UTF-8").map(CompileOption) ++ super.compileOptions
@@ -32,7 +33,17 @@ final class FunctionalJavaProject(info: ProjectInfo) extends DefaultProject(info
3233

3334
val scalacheckDependency = "org.scala-tools.testing" %% "scalacheck" % "1.8" % "test"
3435

35-
override def packageToPublishActions = super.packageToPublishActions ++ Seq(packageSrc, packageTestSrc)
36+
override def packageToPublishActions = super.packageToPublishActions ++ Seq(packageSrc, packageTestSrc, packageDocs)
37+
38+
override protected def docAction = javadocTask(mainLabel, mainSourceRoots, mainSources, mainDocPath, docClasspath).dependsOn(compile) describedAs "Generate Javadoc"
39+
40+
def javadocTask(label: String, sourceRoot: PathFinder, sources: PathFinder, outputDirectory: Path, classpath: PathFinder): Task = task {
41+
val cmdLine = <x>javadoc -quiet -sourcepath {sourceRoot.get.toList.head} -d {outputDirectory} {sources.getPaths.mkString(" ")}</x>
42+
log.debug(cmdLine.toString)
43+
cmdLine !
44+
45+
None
46+
}
3647

3748
override def testFrameworks = Seq(new TestFramework("org.scalacheck.ScalaCheckFramework"))
3849

0 commit comments

Comments
 (0)