-
Notifications
You must be signed in to change notification settings - Fork 0
/
OLD_SBT_STUFF
39 lines (33 loc) · 1.87 KB
/
OLD_SBT_STUFF
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* don't remember this stuff, but here it is.
def patchclasspath = Command.command("patchclasspath") { (state: State) =>
val extracted = Project.extract(state)
import extracted._
println(currentProject.id)
val classPath = Project.runTask(fullClasspath in Runtime, state).get._2.toEither.right.get.files.mkString(":")
println(classPath)
// return a state with javaOptionsPatched = true and javaOptions set correctly
Project.extract(state).append(Seq(javaOptions ++= Seq("-cp", classPath)), state.put(caliperLoopKey, true))
}
val caliperFixForBenchmark = (
// we need to add the runtime classpath as a "-cp" argument to the `javaOptions in run`, otherwise caliper
// will not see the right classpath and die with a ConfigurationException
// unfortunately `javaOptions` is a SettingsKey and `fullClasspath in Runtime` is a TaskKey, so we need to
// jump through these hoops here in order to feed the result of the latter into the former
onLoad in Global ~= { previous => state =>
previous {
state.get(caliperLoopKey) match {
case None =>
println("!"+ Project.extract(state).currentProject.id)
// get the runtime classpath, turn into a colon-delimited string
val classPath = Project.runTask(fullClasspath in Runtime, state).get._2.toEither.right.get.files.mkString(":")
// return a state with javaOptionsPatched = true and javaOptions set correctly
Project.extract(state).append(Seq(javaOptions ++= Seq("-cp", classPath)), state.put(caliperLoopKey, true))
case Some(_) => // the javaOptions are already patched
println("?"+Project.extract(state).currentProject.id)
state
}
}
}
)
val caliperLoopKey = AttributeKey[Boolean]("javaOptionsPatched") // attribute caliperLoopKey to prevent circular onLoad hook
*/