Advertisement
Guest User

Untitled

a guest
May 30th, 2015
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. import java.net.InetSocketAddress
  2.  
  3. import com.mle.sbtplay.PlayProjects
  4. import play.Play._
  5. import play.PlayImport.PlayKeys._
  6. import play.PlayRunHook
  7. import sbt.Keys._
  8. import sbt._
  9.  
  10. object PlayBuild extends Build {
  11. lazy val p = PlayProjects.plainPlayProject("play-run").settings(commonSettings: _*)
  12. val hack = config("hack")
  13.  
  14. class HackHook(base: File, logger: Logger) extends PlayRunHook {
  15. var process: Option[Process] = None
  16.  
  17. def log(s: => String) = logger info s
  18.  
  19. override def beforeStarted(): Unit = log("beforeStarted()")
  20.  
  21. override def afterStarted(addr: InetSocketAddress): Unit = log("afterStarted()")
  22.  
  23. override def afterStopped(): Unit = log("afterStopped()")
  24.  
  25. override def onError(): Unit = log("onError()")
  26. }
  27.  
  28. lazy val commonSettings = Seq(
  29. organization := "com.github.malliina",
  30. version := "0.0.1",
  31. scalaVersion := "2.11.6",
  32. retrieveManaged := false,
  33. sbt.Keys.fork in Test := true,
  34. updateOptions := updateOptions.value.withCachedResolution(true),
  35. libraryDependencies ++= Seq("com.github.malliina" %% "play-base" % "0.4.2"),
  36. mainClass := Some("com.mle.play.Starter"),
  37. exportJars := true,
  38. javacOptions ++= Seq("-source", "1.7", "-target", "1.7"),
  39. scalacOptions ++= Seq(
  40. "-target:jvm-1.7",
  41. "-deprecation",
  42. "-encoding", "UTF-8",
  43. "-unchecked",
  44. "-feature",
  45. "-language:existentials",
  46. "-language:higherKinds",
  47. "-language:implicitConversions",
  48. "-Xfatal-warnings",
  49. "-Xlint",
  50. "-Yno-adapted-args",
  51. "-Ywarn-dead-code",
  52. "-Ywarn-numeric-widen"),
  53. play.PlayImport.PlayKeys.playRunHooks in hack += new HackHook(baseDirectory.value, streams.value.log),
  54. run in Compile in hack <<= playRunTask(playRunHooks in hack, playDependencyClasspath, playDependencyClassLoader,
  55. playReloaderClasspath, playReloaderClassLoader, playAssetsClassLoader)
  56. )
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement