2010-03-30 02:13:38 +02:00
|
|
|
import sbt._
|
|
|
|
|
|
|
|
|
|
trait Sxr extends BasicScalaProject
|
|
|
|
|
{
|
|
|
|
|
val sxrConf = config("sxr") hide
|
2011-05-29 05:49:17 +02:00
|
|
|
val sxrDep = "org.scala-tools.sxr" % "sxr_2.9.0" % "0.2.7" % sxrConf.name jar()
|
2010-03-30 02:13:38 +02:00
|
|
|
|
|
|
|
|
def deepSources: PathFinder
|
2011-05-18 02:09:20 +02:00
|
|
|
def deepBaseDirectories: PathFinder
|
2010-03-30 02:13:38 +02:00
|
|
|
def sxrBaseDirs = "-P:sxr:base-directory:" + deepBaseDirectories.absString
|
|
|
|
|
def sxrLocation = "-Xplugin:" + managedClasspath(sxrConf).absString
|
|
|
|
|
def sxrDirName = "browse"
|
|
|
|
|
def sxrOutput = outputPath / (sxrDirName + ".sxr")
|
|
|
|
|
def sxrClassesOutput = outputPath / sxrDirName // isn't actually written to, since compiler stops before writing classes
|
2011-05-29 05:49:17 +02:00
|
|
|
def sxrOptions = compileOptions.map(_.asString) ++ Seq(sxrBaseDirs, sxrLocation)
|
2010-03-30 02:13:38 +02:00
|
|
|
|
|
|
|
|
lazy val sxr = task {
|
|
|
|
|
xsbt.FileUtilities.delete(sxrOutput +++ sxrClassesOutput getFiles)
|
|
|
|
|
xsbt.FileUtilities.createDirectory(sxrClassesOutput asFile)
|
2010-05-17 03:33:27 +02:00
|
|
|
val compiler = new xsbt.RawCompiler(buildScalaInstance, xsbt.ClasspathOptions.auto, log)
|
|
|
|
|
compiler(deepSources.getFiles, compileClasspath.getFiles, sxrClassesOutput asFile, sxrOptions)
|
2010-03-30 02:13:38 +02:00
|
|
|
None
|
|
|
|
|
}
|
|
|
|
|
}
|