Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.net.InetSocketAddress
- import com.mle.sbtplay.PlayProjects
- import play.Play._
- import play.PlayImport.PlayKeys._
- import play.PlayRunHook
- import sbt.Keys._
- import sbt._
- object PlayBuild extends Build {
- lazy val p = PlayProjects.plainPlayProject("play-run").settings(commonSettings: _*)
- val hack = config("hack")
- class HackHook(base: File, logger: Logger) extends PlayRunHook {
- var process: Option[Process] = None
- def log(s: => String) = logger info s
- override def beforeStarted(): Unit = log("beforeStarted()")
- override def afterStarted(addr: InetSocketAddress): Unit = log("afterStarted()")
- override def afterStopped(): Unit = log("afterStopped()")
- override def onError(): Unit = log("onError()")
- }
- lazy val commonSettings = Seq(
- organization := "com.github.malliina",
- version := "0.0.1",
- scalaVersion := "2.11.6",
- retrieveManaged := false,
- sbt.Keys.fork in Test := true,
- updateOptions := updateOptions.value.withCachedResolution(true),
- libraryDependencies ++= Seq("com.github.malliina" %% "play-base" % "0.4.2"),
- mainClass := Some("com.mle.play.Starter"),
- exportJars := true,
- javacOptions ++= Seq("-source", "1.7", "-target", "1.7"),
- scalacOptions ++= Seq(
- "-target:jvm-1.7",
- "-deprecation",
- "-encoding", "UTF-8",
- "-unchecked",
- "-feature",
- "-language:existentials",
- "-language:higherKinds",
- "-language:implicitConversions",
- "-Xfatal-warnings",
- "-Xlint",
- "-Yno-adapted-args",
- "-Ywarn-dead-code",
- "-Ywarn-numeric-widen"),
- play.PlayImport.PlayKeys.playRunHooks in hack += new HackHook(baseDirectory.value, streams.value.log),
- run in Compile in hack <<= playRunTask(playRunHooks in hack, playDependencyClasspath, playDependencyClassLoader,
- playReloaderClasspath, playReloaderClassLoader, playAssetsClassLoader)
- )
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement