Skip to content

Instantly share code, notes, and snippets.

@int128
Created October 1, 2012 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save int128/3810971 to your computer and use it in GitHub Desktop.
Save int128/3810971 to your computer and use it in GitHub Desktop.
import sbt._
import Keys._
import com.github.siasia.WarPlugin.warSettings
object ProjectBuild extends Build {
lazy val root = Project(
id = "root",
base = new File("."),
settings = Project.defaultSettings ++ warSettings ++ mySettings ++ Seq(
externalIvySettings(),
externalIvyFile(),
classpathConfiguration in Compile := config("compileWithProvided")))
object MyKeys {
lazy val jdkHomePath = SettingKey[File]("jdk-home")
lazy val jdkAptPath = SettingKey[File]("jdk-apt")
lazy val slim3gen = TaskKey[Unit]("slim3gen", "Slim3 APT generation")
}
lazy val mySettings = Seq(
MyKeys.jdkHomePath := {
val dir = new File(System.getProperty("java.home"))
dir.getName() match {
// remove trailing jre if needed
case s if s.endsWith("jre") => dir.getParentFile()
case _ => dir
}
},
MyKeys.jdkAptPath <<= MyKeys.jdkHomePath(_ / "bin" / "apt"),
MyKeys.slim3gen <<= (MyKeys.jdkAptPath) map { (apt) =>
val out = new StringBuffer
// TODO: fix arguments
val exit = Seq(apt.absolutePath)!
println(out)
println(exit)
})
}
// https://github.com/siasia/xsbt-web-plugin/wiki/
libraryDependencies <+= sbtVersion(v => v match {
case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8"
case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10"
case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11"
case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
case x if (x.startsWith("0.12")) => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment