Skip to content

Instantly share code, notes, and snippets.

@tekul
Created March 29, 2012 21:31
Show Gist options
  • Save tekul/2244026 to your computer and use it in GitHub Desktop.
Save tekul/2244026 to your computer and use it in GitHub Desktop.
Gatling SBT Plugin
import sbt._
import Keys._
object GatlingPlugin {
val gatling = TaskKey[Unit]("gatling")
val gatlingVersion = SettingKey[String]("gatling-version")
val gatlingResultsDirectory = SettingKey[String]("gatling-results-directory")
val gatlingDataDirectory = SettingKey[String]("gatling-data-directory")
val gatlingConfigFile = SettingKey[String]("gatling-config-file")
lazy val gatlingSettings = Seq(
gatlingVersion := "1.1.1",
fullClasspath in gatling <<= fullClasspath or (fullClasspath in Runtime),
gatlingResultsDirectory <<= target(_.getAbsolutePath + "/gatling-results"),
gatlingDataDirectory <<= (resourceDirectory in Compile).apply(_.getAbsolutePath),
gatlingConfigFile <<= (resourceDirectory in Compile).apply(_.getAbsolutePath + "/gatling.conf"),
libraryDependencies <+= (gatlingVersion) { gv =>
"com.excilys.ebi.gatling.highcharts" % "gatling-charts-highcharts" % gv
},
gatling <<= (streams, gatlingResultsDirectory, gatlingDataDirectory, gatlingConfigFile, fullClasspath in gatling, classDirectory in Compile, runner in run)
map { (s, grd, gdd, gcf, cp, cd, runner) => {
val args = Array("--results-folder", grd,
"--data-folder", gdd,
"--config-file", gcf,
"--simulations-binaries-folder", cd.absolutePath)
toError(runner.run("com.excilys.ebi.gatling.app.Gatling", Build.data(cp), args, s.log))
}
}
)
}
@slandelle
Copy link

Are you sure you need to explicitly depend on gatling-app and gatling-http as gatling-charts-highcharts depends on them with compile scope?

@tekul
Copy link
Author

tekul commented Mar 30, 2012

No, you're probably right. I started off with just http, then added app and highcharts as required, but I can just use highcharts if transitive deps will take care of the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment