|
| 1 | +import sbt.Keys._ |
1 | 2 | import sbt._ |
2 | | -import Keys._ |
3 | | -import Process._ |
4 | 3 |
|
5 | 4 | object DottyBuild extends Build { |
6 | 5 |
|
7 | 6 | val TRAVIS_BUILD = "dotty.travis.build" |
8 | 7 |
|
9 | 8 | val agentOptions = List( |
10 | | - // "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005", |
| 9 | + // "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" |
11 | 10 | // "-agentpath:/home/dark/opt/yjp-2013-build-13072/bin/linux-x86-64/libyjpagent.so" |
12 | 11 | ) |
13 | 12 |
|
@@ -74,4 +73,51 @@ object DottyBuild extends Build { |
74 | 73 | ) |
75 | 74 |
|
76 | 75 | lazy val dotty = Project(id = "dotty", base = file("."), settings = defaults) |
| 76 | + |
| 77 | + lazy val benchmarkSettings = Defaults.defaultSettings ++ Seq( |
| 78 | + |
| 79 | + // to get Scala 2.11 |
| 80 | + resolvers += Resolver.sonatypeRepo("releases"), |
| 81 | + |
| 82 | + baseDirectory in (Test,run) := (baseDirectory in dotty).value, |
| 83 | + |
| 84 | + |
| 85 | + libraryDependencies ++= Seq("com.storm-enroute" %% "scalameter" % "0.6" % Test, |
| 86 | + "com.novocode" % "junit-interface" % "0.11-RC1"), |
| 87 | + testFrameworks += new TestFramework("org.scalameter.ScalaMeterFramework"), |
| 88 | + |
| 89 | + // scalac options |
| 90 | + scalacOptions in Global ++= Seq("-feature", "-deprecation", "-language:_"), |
| 91 | + |
| 92 | + javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"), |
| 93 | + |
| 94 | + fork in Test := true, |
| 95 | + parallelExecution in Test := false, |
| 96 | + |
| 97 | + // http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala |
| 98 | + javaOptions <++= (dependencyClasspath in Runtime, packageBin in Compile) map { (attList, bin) => |
| 99 | + // put the Scala {library, reflect, compiler} in the classpath |
| 100 | + val path = for { |
| 101 | + file <- attList.map(_.data) |
| 102 | + path = file.getAbsolutePath |
| 103 | + prefix = if(path.endsWith(".jar")) "p" else "a" |
| 104 | + } yield "-Xbootclasspath/"+ prefix +":" + path |
| 105 | + // dotty itself needs to be in the bootclasspath |
| 106 | + val fullpath = ("-Xbootclasspath/a:" + bin) :: path.toList |
| 107 | + // System.err.println("BOOTPATH: " + fullpath) |
| 108 | + |
| 109 | + val travis_build = // propagate if this is a travis build |
| 110 | + if (sys.props.isDefinedAt(TRAVIS_BUILD)) |
| 111 | + List(s"-D$TRAVIS_BUILD=${sys.props(TRAVIS_BUILD)}") |
| 112 | + else |
| 113 | + List() |
| 114 | + val res = agentOptions ::: travis_build ::: fullpath |
| 115 | + println("Running with javaOptions: " +res) |
| 116 | + res |
| 117 | + } |
| 118 | + ) |
| 119 | + |
| 120 | + |
| 121 | + lazy val benchmarks = Project(id = "dotty-bench", settings = benchmarkSettings, |
| 122 | + base = file("bench")) dependsOn(dotty % "compile->test") |
77 | 123 | } |
0 commit comments