Skip to content

Commit

Permalink
updated sbt to 0.13.1 and scala-virtualized to 2.10.2; also simplifie…
Browse files Browse the repository at this point in the history
…d script dependencies
  • Loading branch information
kjbrown committed Apr 11, 2014
1 parent 010595b commit 966606f
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 98 deletions.
2 changes: 1 addition & 1 deletion bin/build-interop
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

sbt "; project optiql; compile; project optigraph; compile; project optiml; compile; project interop-apps; compile; project runtime; compile"
sbt "; project interop-apps; compile"
2 changes: 1 addition & 1 deletion bin/build-optigraph
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

sbt "; project optigraph; compile; project optigraph-apps; compile; project runtime; compile"
sbt "; project optigraph-apps; compile"
2 changes: 1 addition & 1 deletion bin/build-optiml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

sbt "; project optiml; compile; project optiml-apps; compile; project runtime; compile"
sbt "; project optiml-apps; compile"
2 changes: 1 addition & 1 deletion bin/build-optiql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

sbt "; project optiql; compile; project optiql-apps; compile; project runtime; compile"
sbt "; project optiql-apps; compile"
20 changes: 8 additions & 12 deletions bin/delite
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,14 @@ def run(deg, params, opts):
cp = " -cp "
cp = cp + old_cp + os.pathsep
cp = cp + delitecommon.DELITE_HOME + "/runtime/target/" + delitecommon.scala_major_id + "/classes" + os.pathsep
cp = cp + delitecommon.SCALA_VIRT_HOME + "/scala-library.jar" + os.pathsep #TR should use /lib/*.jar?
cp = cp + delitecommon.SCALA_VIRT_HOME + "/scala-compiler.jar" + os.pathsep
cp = cp + delitecommon.SCALA_VIRT_HOME + "/scala-reflect.jar" + os.pathsep
# lms math ops generated apache math for performance
cp = cp + delitecommon.DELITE_HOME + "/lib_managed/jars/org.apache.commons/commons-math/commons-math-2.2.jar" + os.pathsep
# mesos jars
cp = cp + delitecommon.DELITE_HOME + "/lib_managed/jars/org.apache.mesos/mesos/mesos-0.9.0-incubating.jar" + os.pathsep
cp = cp + delitecommon.DELITE_HOME + "/lib_managed/jars/com.google.protobuf/protobuf-java/protobuf-java-2.4.1.jar" + os.pathsep
cp = cp + delitecommon.DELITE_HOME + "/lib_managed/jars/org.apache.hadoop/hadoop-core/hadoop-core-1.2.0.jar" + os.pathsep
cp = cp + delitecommon.DELITE_HOME + "/lib_managed/jars/commons-logging/commons-logging/commons-logging-1.1.1.jar" + os.pathsep

# needed by deliszt

# add all managed libs
# caveat: scalatest pulls in some non-virtualized scala dependencies but they conflict with the scala-virtualized versions
jars = [os.path.join(d,f) for (d, n, fs) in os.walk(delitecommon.script_home + "/lib_managed/") if not (d.count("org.scala-lang") > 0 and d.count("virtualized") == 0) for f in fs]
for j in jars:
cp = cp + j + os.pathsep

# unsafe accessor
bootcp = " -Xbootclasspath/a:"
bootcp = bootcp + delitecommon.DELITE_HOME + "/unsafe_classes/unsafe.jar"

Expand Down
30 changes: 15 additions & 15 deletions bin/delitec
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ from time import localtime, strftime
import delitecommon

DSLs = ['optiml','optila','optiql','deliszt','optigraph','opticvx','multi-dsl']
LMS_HOME = os.getenv("LMS_HOME")
lms_version = "lms_2.10"
LMS_HOME = os.getenv("LMS_HOME") #should be set if LMS is provided directly from class files rather than a lib_managed jar

def err(s):
exit("error: " + s)
Expand Down Expand Up @@ -60,7 +59,7 @@ def checkLMSEnv():
LMS_HOME = lms_home

if LMS_HOME is None:
lms_home = delitecommon.DELITE_HOME + "/lib_managed/jars/EPFL/" + lms_version + "/"
lms_home = delitecommon.DELITE_HOME + "/lib_managed/jars/EPFL/" + delitecommon.lms_version + "/"
if not os.path.isdir(lms_home):
err("couldn't find the LMS library at: " + lms_home + ". Please set the LMS_HOME environment variable or libs.lms.home entry in delite.properties manually.")

Expand Down Expand Up @@ -99,19 +98,15 @@ def stage(runner, params, opts):
java_opts = java_opts + " -Ddelite.dump.exception"
java_opts = java_opts + " -Dnested.variants.level=0"

scala_virt_version = delitecommon.scala_virt_version
DELITE_HOME = delitecommon.DELITE_HOME
SCALA_VIRT_HOME = delitecommon.SCALA_VIRT_HOME

#add classpaths for Delite
scala_major_id = delitecommon.scala_major_id
old_cp = os.getenv("CLASSPATH", "")
cp = " -cp "
cp = cp + old_cp + os.pathsep
if LMS_HOME is None:
cp = cp + delitecommon.DELITE_HOME + "/lib_managed/jars/EPFL/" + lms_version + "/*" + os.pathsep
else:
cp = cp + LMS_HOME + "/target/" + scala_major_id + "/classes" + os.pathsep
if LMS_HOME:
cp = cp + LMS_HOME + "/target/" + scala_major_id + "/classes" + os.pathsep
cp = cp + DELITE_HOME + "/framework/target/" + scala_major_id + "/classes" + os.pathsep

#DSL cps
Expand All @@ -126,10 +121,11 @@ def stage(runner, params, opts):
cp = cp + DELITE_HOME + "/tests/target/" + scala_major_id + "/classes" + os.pathsep
cp = cp + DELITE_HOME + "/target/" + scala_major_id + "/test-classes" + os.pathsep

#scala-virt cp
cp = cp + SCALA_VIRT_HOME + "/scala-library.jar" + os.pathsep #TR should use /lib/*.jar?
cp = cp + SCALA_VIRT_HOME + "/scala-reflect.jar" + os.pathsep
cp = cp + SCALA_VIRT_HOME + "/scala-compiler.jar"
# add all managed libs
# caveat: scalatest pulls in some non-virtualized scala dependencies but they conflict with the scala-virtualized versions
jars = [os.path.join(d,f) for (d, n, fs) in os.walk(delitecommon.script_home + "/lib_managed/") if not (d.count("org.scala-lang") > 0 and d.count("virtualized") == 0) for f in fs]
for j in jars:
cp = cp + j + os.pathsep

java_opts = java_opts + cp
#os.putenv("JAVA_OPTS", java_opts)
Expand All @@ -138,8 +134,12 @@ def stage(runner, params, opts):
os.putenv("LD_PRELOAD", delitecommon.JAVA_HOME + "/jre/lib/amd64/libjsig.so")

if opts.verbose:
delitecommon.printEnv()
print("LMS_HOME = " + LMS_HOME)
delitecommon.printEnv()
if LMS_HOME:
print("LMS_HOME = " + LMS_HOME)
else:
print("LMS_HOME is UNDEFINED")
print(java_opts)

print "== Generating DEG file with options: " + str(opts)
java_cmd = delitecommon.JAVA_HOME + "/bin/java " + java_opts + " " + runner + " " + ' '.join(params)
Expand Down
28 changes: 6 additions & 22 deletions bin/delitecommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
USER_HOME = os.getenv("HOME")
DELITE_HOME = os.getenv("DELITE_HOME")
JAVA_HOME = os.getenv("JAVA_HOME")
SCALA_VIRT_HOME = os.getenv("SCALA_VIRT_HOME")
MESOS_NATIVE_LIBRARY = os.getenv("MESOS_NATIVE_LIBRARY")
DELITE_MEM = os.getenv("DELITE_MEM")

scala_virt_prefix = "org.scala-lang.virtualized."
scala_virt_version = "scala-2.10.2-RC1"
scala_major_id = '.'.join(scala_virt_version.split('.')[0:2])
#scala_major_id = "scala-2.10.2-RC1" # the full version is needed only when scalaBinaryVersion is set in sbt
scala_major_id = "scala-2.10"
lms_version = "lms_2.10"
script_path = os.path.dirname(__file__)
# base directory for the project, i.e. drops the '/bin' from script_path
script_home = os.path.split(script_path)[0]

props = {}

def err(s):
Expand Down Expand Up @@ -65,20 +66,6 @@ def checkCommonEnv():
else:
err("The JAVA_HOME environment variable must be defined or the java.home entry in delite.properties must be set.")

if SCALA_VIRT_HOME is None:
if "scala.virtualized.home" in props:
scala_virt_home = props["scala.virtualized.home"]
if not os.path.isdir(scala_virt_home):
warn("couldn't find scala virtualized at: " + scala_virt_home)
else:
SCALA_VIRT_HOME = scala_virt_home

if SCALA_VIRT_HOME is None:
scala_virt_home = USER_HOME + "/.sbt/boot/" + scala_virt_prefix + scala_virt_version + "/lib/"
if not os.path.isdir(scala_virt_home):
err("couldn't find scala virtualized at: " + scala_virt_home + ". Please set the SCALA_VIRT_HOME environment variable or scala.virtualized.home entry in delite.properties manually.")
SCALA_VIRT_HOME = scala_virt_home

if MESOS_NATIVE_LIBRARY is None:
if "mesos.lib" in props:
MESOS_NATIVE_LIBRARY = props["mesos.lib"]
Expand All @@ -93,6 +80,3 @@ def printEnv():
print("USER_HOME = " + USER_HOME)
print("DELITE_HOME = " + DELITE_HOME)
print("JAVA_HOME = " + JAVA_HOME)
print("SCALA_VIRT_HOME = " + SCALA_VIRT_HOME)


2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version := "0.2"

organization := "Stanford_PPL"
organization := "stanford-ppl"

retrieveManaged := true

Expand Down
51 changes: 8 additions & 43 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,24 @@ import Keys._
object DeliteBuild extends Build {
val virtualization_lms_core = "EPFL" % "lms_2.10" % "0.3-SNAPSHOT"

// -DshowSuppressedErrors=false
System.setProperty("showSuppressedErrors", "false")

val mavenLocal = "Maven Local" at "file://"+Path.userHome+"/.m2/repository" // for custom-built scala version

val scalaTestCompile = "org.scalatest" % "scalatest_2.10" % "2.0.M5b"
val scalaTest = scalaTestCompile % "test"

val virtScala = Option(System.getenv("SCALA_VIRTUALIZED_VERSION")).getOrElse("2.10.2-RC1")
val virtScala = Option(System.getenv("SCALA_VIRTUALIZED_VERSION")).getOrElse("2.10.2")
val virtBuildSettingsBase = Defaults.defaultSettings ++ Seq(
//resolvers := Seq(mavenLocal, prereleaseScalaTest, Resolver.sonatypeRepo("snapshots"), Resolver.sonatypeRepo("releases")),
organization := "stanford-ppl",
scalaOrganization := "org.scala-lang.virtualized",
//scalaHome := Some(file(Path.userHome + "/scala/build/pack")),
scalaVersion := virtScala,
//scalaBinaryVersion := virtScala,
publishArtifact in (Compile, packageDoc) := false,
// needed for scala.tools, which is apparently not included in sbt's built in version
libraryDependencies += virtualization_lms_core,
libraryDependencies += "org.scala-lang.virtualized" % "scala-library" % virtScala,
libraryDependencies += "org.scala-lang.virtualized" % "scala-compiler" % virtScala,
libraryDependencies += "org.scala-lang" % "scala-actors" % virtScala, // for ScalaTest
libraryDependencies += scalaTest,
libraryDependencies += "org.scalatest" % "scalatest_2.10" % "2.1.2",

libraryDependencies += "org.apache.commons" % "commons-math" % "2.2",
libraryDependencies += "com.google.protobuf" % "protobuf-java" % "2.4.1",
libraryDependencies += "org.apache.mesos" % "mesos" % "0.9.0-incubating",
libraryDependencies += "org.apache.hadoop" % "hadoop-core" % "1.2.0",


// used in delitec to access jars
retrieveManaged := true,
scalacOptions += "-Yno-generic-signatures",
scalacOptions += "-Yvirtualize"
Expand All @@ -46,38 +34,15 @@ object DeliteBuild extends Build {
concurrentRestrictions in Global += Tags.limitAll(1) //we need tests to run in isolation across all projects
)


/*
val vanillaScala = "2.9.1"
val vanillaBuildSettings = Defaults.defaultSettings ++ Seq(
//scalaSource in Compile <<= baseDirectory(_ / "src"),
//scalaVersion := vanillaScala,
// needed for scala.tools, which is apparently not included in sbt's built in version
libraryDependencies += "org.scala-lang" % "scala-library" % vanillaScala,
libraryDependencies += "org.scala-lang" % "scala-compiler" % vanillaScala
)
*/

/*
lazy val getJars = TaskKey[Unit]("get-jars")
lazy val getJarsTask = getJars <<= (target, fullClasspath in Runtime) map { (target, cp) =>
println("Target path is: "+target)
println("Full classpath is: "+cp.map(_.data).mkString(":"))
}
*/

// build targets

// _ forces sbt to choose it as default
// useless base directory is to avoid compiling leftover .scala files in the project root directory
lazy val _delite = Project("delite", file("project/boot"),
settings = virtBuildSettings) aggregate(framework, dsls, runtime, apps, tests)

//default project: just the dependencies needed to export Delite to others (e.g., Forge)
lazy val delite = Project("delite", file("."), //root directory required to be default
settings = virtBuildSettings) aggregate(framework, runtime, deliteTest)

lazy val framework = Project("framework", file("framework"), settings = virtBuildSettings) dependsOn(runtime) // dependency to runtime because of Scopes

lazy val deliteTest = Project("delite-test", file("framework/delite-test"), settings = virtBuildSettings ++ Seq(
libraryDependencies += scalaTestCompile
)) dependsOn(framework, runtime)
lazy val deliteTest = Project("delite-test", file("framework/delite-test"), settings = virtBuildSettings) dependsOn(framework, runtime)

lazy val dsls = Project("dsls", file("dsls"), settings = virtBuildSettings) aggregate(optila, optiml, optiql, optimesh, optigraph, opticvx)
lazy val optila = Project("optila", file("dsls/optila"), settings = virtBuildSettings) dependsOn(framework, deliteTest)
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Project properties
sbt.version=0.12.1
sbt.version=0.13.1

0 comments on commit 966606f

Please sign in to comment.