diff options
author | Jakob Odersky <jodersky@gmail.com> | 2014-10-03 23:22:10 +0200 |
---|---|---|
committer | Jakob Odersky <jodersky@gmail.com> | 2014-10-03 23:22:10 +0200 |
commit | ab19a9d1a3124f310bbb48de0779b5b96801940e (patch) | |
tree | 9392461ee5605dc10deae89d96ded417c26dc9a2 /project | |
parent | e269a40911f901cac415269916d34032e167a618 (diff) | |
download | mavigator-ab19a9d1a3124f310bbb48de0779b5b96801940e.tar.gz mavigator-ab19a9d1a3124f310bbb48de0779b5b96801940e.tar.bz2 mavigator-ab19a9d1a3124f310bbb48de0779b5b96801940e.zip |
modularize project
Diffstat (limited to 'project')
-rw-r--r-- | project/Build.scala | 61 | ||||
-rw-r--r-- | project/Dependencies.scala | 11 | ||||
-rw-r--r-- | project/util.scala | 32 |
3 files changed, 67 insertions, 37 deletions
diff --git a/project/Build.scala b/project/Build.scala index af78ff5..9c6789b 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1,66 +1,65 @@ import sbt._ import sbt.Keys._ +import util._ import play._ import play.PlayImport.PlayKeys._ import scala.scalajs.sbtplugin.ScalaJSPlugin import scala.scalajs.sbtplugin.ScalaJSPlugin.ScalaJSKeys._ +import Dependencies._ object ApplicationBuild extends Build { val common = Seq( scalaVersion := "2.11.2", - scalacOptions ++= Seq("-feature") + scalacOptions ++= Seq("-feature"), + unmanagedSourceDirectories in Compile += (baseDirectory in ThisBuild).value / "vfd-shared" / "src" / "main" / "scala", + unmanagedResourceDirectories in Compile += (baseDirectory in ThisBuild).value / "vfd-shared" / "src" / "main" / "resources" ) lazy val root = Project("root", file(".")).aggregate( + uav, backend, frontend ) + lazy val uav = ( + Project("vfd-uav", file("vfd-uav")) + settings(common: _*) + settings( + libraryDependencies ++= Seq( + akkaActor, + flow, + flowNative + ) + ) + ) + lazy val backend = ( - Project("vfd-backend", file("backend")) + Project("vfd-backend", file("vfd-backend")) enablePlugins(PlayScala) settings(common: _*) settings( - libraryDependencies ++= Dependencies.backend + libraryDependencies ++= Seq( + bootstrap, + fontawesome, + jquery + ) ) + dependsOn(uav) dependsOnJs(frontend) ) lazy val frontend = ( - Project("vfd-frontend", file("frontend")) + Project("vfd-frontend", file("vfd-frontend")) settings(ScalaJSPlugin.scalaJSSettings: _*) settings(common: _*) settings( - libraryDependencies ++= Dependencies.frontend + libraryDependencies ++= Seq( + rx, + dom + ) ) ) - - - implicit class ScalaJSPlayProject(val project: Project) { - def dependsOnJs(reference: Project): Project = project.settings( - resourceGenerators in Compile += Def.task{ - val outDir: File = (resourceManaged in Compile).value / "public" / "lib" - - val optimized: Seq[File] = (fastOptJS in (reference, Compile)).value.allCode.map(_.path).map(file(_)) - - val outFiles = optimized.map(file => outDir / file.name) - - for ((opt, out) <- optimized zip outFiles) { - if (!out.exists || out.lastModified < opt.lastModified) { - IO.copyFile(opt, out, true) - val map = opt.getParentFile / (out.name + ".map") - IO.copyFile(map, outDir / map.name) - } - } - outFiles - }.taskValue, - playMonitoredFiles ++= (watchSources in reference).value.map(_.getCanonicalPath) - ) - } - - - }
\ No newline at end of file diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 6e30920..73b07ac 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -3,17 +3,16 @@ import scala.scalajs.sbtplugin.ScalaJSPlugin._ object Dependencies { - val flow = "com.github.jodersky" %% "flow" % "2.0.4" - val flowNative = "com.github.jodersky" % "flow-native" % "2.0.4" + val akkaActor = "com.typesafe.akka" %% "akka-actor" % "2.3.6" - val dom = "org.scala-lang.modules.scalajs" %%%! "scalajs-dom" % "0.6" - val rx = "com.scalarx" %%%! "scalarx" % "0.2.5" + val flow = "com.github.jodersky" %% "flow" % "2.0.6" + val flowNative = "com.github.jodersky" % "flow-native" % "2.0.6" val bootstrap = "org.webjars" % "bootstrap" % "3.2.0" val fontawesome = "org.webjars" % "font-awesome" % "4.2.0" val jquery = "org.webjars" % "jquery" % "2.1.1" + val dom = "org.scala-lang.modules.scalajs" %%%! "scalajs-dom" % "0.6" + val rx = "com.scalarx" %%%! "scalarx" % "0.2.5" - def backend = Seq(bootstrap, fontawesome, jquery, flow, flowNative) - def frontend = Seq(dom, rx) }
\ No newline at end of file diff --git a/project/util.scala b/project/util.scala new file mode 100644 index 0000000..595d7fe --- /dev/null +++ b/project/util.scala @@ -0,0 +1,32 @@ +import sbt._ +import sbt.Keys._ +import play._ +import play.PlayImport.PlayKeys._ +import scala.scalajs.sbtplugin.ScalaJSPlugin +import scala.scalajs.sbtplugin.ScalaJSPlugin.ScalaJSKeys._ + +package object util { + + implicit class ScalaJSPlayProject(val project: Project) { + def dependsOnJs(reference: Project): Project = project.settings( + resourceGenerators in Compile += Def.task{ + val outDir: File = (resourceManaged in Compile).value / "public" / "lib" + + val optimized: Seq[File] = (fastOptJS in (reference, Compile)).value.allCode.map(_.path).map(file(_)) + + val outFiles = optimized.map(file => outDir / file.name) + + for ((opt, out) <- optimized zip outFiles) { + if (!out.exists || out.lastModified < opt.lastModified) { + IO.copyFile(opt, out, true) + val map = opt.getParentFile / (out.name + ".map") + IO.copyFile(map, outDir / map.name) + } + } + outFiles + }.taskValue, + playMonitoredFiles ++= (watchSources in reference).value.map(_.getCanonicalPath) + ) + } + +}
\ No newline at end of file |