Skip to content

Commit

Permalink
Added SBT pack, and runner scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomo Ferega committed Feb 26, 2015
1 parent ff92d97 commit ec95ec6
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions code/compile-run.bat
@@ -0,0 +1 @@
sbt "Server/run-main net.selenate.server.EntryPoint"
2 changes: 2 additions & 0 deletions code/compile-run.sh
@@ -0,0 +1,2 @@
#!/bin/bash
sbt "Server/run-main net.selenate.server.EntryPoint"
1 change: 1 addition & 0 deletions code/pack.bat
@@ -0,0 +1 @@
sbt pack
2 changes: 2 additions & 0 deletions code/pack.sh
@@ -0,0 +1,2 @@
#!/bin/bash
sbt pack
2 changes: 1 addition & 1 deletion code/project/SelenateBuild.scala
Expand Up @@ -13,7 +13,7 @@ object SelenateBuild extends Build with Settings with Dependencies {
lazy val compiler = project(scalaSettings, "Compiler", isPublish = false)(
)

lazy val server = project(scalaSettings, "Server", isPublish = true)(
lazy val server = project(scalaSettings, "Server", isPublish = true, isPackable = true)(
akka, selenium, config, dispatch, logback, procrun, slf4j
).dependsOn(common)

Expand Down
13 changes: 10 additions & 3 deletions code/project/Settings.scala
Expand Up @@ -4,21 +4,23 @@ import Keys._
import com.typesafe.sbteclipse.plugin.EclipsePlugin
import EclipsePlugin.{ EclipseCreateSrc, EclipseKeys, EclipseProjectFlavor }
import net.virtualvoid.sbt.graph.{ Plugin => GraphPlugin }

import xerial.sbt.Pack
trait Settings {
implicit def depToDepSeq(dep: ModuleID) = Seq(dep)

def project(
baseSettings: Seq[Def.Setting[_]],
projectName: String,
isPublish: Boolean = false)
isPublish: Boolean = false,
isPackable: Boolean = false)
(deps: Seq[ModuleID]*) =
Project(
projectName,
file(projectName),
settings =
baseSettings ++
(if (isPublish) publishing else Seq.empty) ++
(if (isPackable) packable else Seq.empty) ++
Seq(
name := "Selenate-" + projectName,
libraryDependencies ++= deps.flatten
Expand Down Expand Up @@ -77,4 +79,9 @@ trait Settings {
crossScalaVersions := Seq("2.11.5", "2.10.4"),
publishArtifact in (Compile, packageDoc) := false
)

val packable =
Pack.packSettings ++ Seq(
Pack.packMain := Map("start" -> "net.selenate.server.EntryPoint")
)
}
8 changes: 8 additions & 0 deletions code/project/plugins.sbt
Expand Up @@ -14,3 +14,11 @@ addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "3.0.0")
// +-------------------------------------------------------------------------------------+

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")


// +-------------------------------------------------------------------------------------+
// | SBT-Pack SBT plugin (https://github.com/xerial/sbt-pack) |
// | A sbt plugin for creating distributable Scala packages that include dependent jars |
// | and launch scripts. |
// +-------------------------------------------------------------------------------------+
addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.6.5")
1 change: 1 addition & 0 deletions code/run-pack.bat
@@ -0,0 +1 @@
call Server\target\pack\bin\start.bat
2 changes: 2 additions & 0 deletions code/run-pack.sh
@@ -0,0 +1,2 @@
#!/bin/bash
exec Server/target/pack/bin/start

0 comments on commit ec95ec6

Please sign in to comment.