Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

Commit

Permalink
Refactor unmanaged classpath.
Browse files Browse the repository at this point in the history
  • Loading branch information
jushi committed May 7, 2012
1 parent 2dc437b commit 2349f19
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,24 @@ import sbtassembly.Plugin._
object Build extends sbt.Build {
import BaseSettings._
import Dependencies._
import Unmanaged._

lazy val root = Project(id = "HouseMD", base = file("."), settings = baseSettings) aggregate(console, agent)

lazy val console = Project(
id = "Console",
base = file("console"),
settings = baseSettings ++ assemblySettings ++ Seq(
unmanagedClasspath in Compile += Attributed.blank(
file("/usr/lib/jvm/java-6-sun/lib/tools.jar")
),
unmanagedClasspath in Test <<= unmanagedClasspath in Compile,
unmanagedClasspath in Runtime <<= unmanagedClasspath in Compile,
// unmanagedClasspath in Compile += Attributed.blank(
// file("/usr/lib/jvm/java-6-sun/lib/tools.jar")
// ),
// unmanagedClasspath in Test <<= unmanagedClasspath in Compile,
// unmanagedClasspath in Runtime <<= unmanagedClasspath in Compile,
libraryDependencies := consoleDependencies ++ test,
packageOptions += Package.ManifestAttributes(
("Main-Class","com.github.zhongl.house.HouseMD")
)
)
) ++ classpathSettings
)

lazy val agent = Project(
Expand All @@ -56,25 +57,39 @@ object Build extends sbt.Build {
)

object BaseSettings {
val baseSettings = Defaults.defaultSettings ++ Seq(
lazy val baseSettings = Defaults.defaultSettings ++ Seq(
organization := "com.github.zhongl",
version := "0.2.0",
scalaVersion := "2.9.2"
)
}

object Dependencies {
val test = Seq(
lazy val test = Seq(
"org.mockito" % "mockito-all" % "1.9.0" % "test",
"org.scalatest" %% "scalatest" % "1.7.2" % "test"
)

val consoleDependencies = Seq(
lazy val consoleDependencies = Seq(
"asm" % "asm" % "3.3.1",
"asm" % "asm-commons" % "3.3.1",
"com.beust" % "jcommander" % "1.20",
"org.scala-lang" % "scala-library" % "2.9.2"
)
}

object Unmanaged {
lazy val javaHome = sys.props("java.home").replace("/jre","")
lazy val toolsFile = file(javaHome + "/lib/tools.jar")
lazy val classpathSettings =
if (sys.props("os.name").contains("Linux")) Seq(
unmanagedClasspath in Compile += Attributed.blank(toolsFile),
unmanagedClasspath in Test <<= unmanagedClasspath in Compile,
unmanagedClasspath in Runtime <<= unmanagedClasspath in Compile
)
else Seq()
}



}

0 comments on commit 2349f19

Please sign in to comment.