Skip to content

Commit

Permalink
parameterized es version for the build
Browse files Browse the repository at this point in the history
bump to 0.2.0 for the plugin

defaulting to ES 2.1.0, overridable with e.g.
  $ sbt 'set esVersion := "2.0.1"' clean pack

closes #1
  • Loading branch information
Shikhar Bhushan committed Dec 8, 2015
1 parent a88ee65 commit bbb4d61
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,49 @@ import sbt._

object Build extends sbt.Build {

val javaVersion = "1.8"

lazy val esVersion = SettingKey[String]("Elasticsearch version")

lazy val restlog = Project(
id = "es-restlog",
base = file(".")
).settings(
organization := "es-restlog",
version := s"0.1-es${V.elasticsearchMajorVersion}",
version := "0.2.0",
esVersion := "2.1.0",
description := "REST request logging for Elasticsearch",
autoScalaLibrary := false,
crossPaths := false,
javacOptions ++= Seq("-source", V.java, "-target", V.java)
javacOptions ++= Seq("-source", javaVersion, "-target", javaVersion)
).settings(
pack <<= packTask
).settings(
libraryDependencies ++= Seq(
"org.elasticsearch" % "elasticsearch" % V.elasticsearch % "provided"
"org.elasticsearch" % "elasticsearch" % esVersion.value % "provided"
)
)

lazy val pack = TaskKey[File]("pack")

def packTask = Def.task {
val archive = target.value / s"${name.value}-${version.value}.zip"
val esVersionQualifier = s"es_${esVersion.value.replace('.', '_')}"
val archive = target.value / s"${name.value}-${version.value}-$esVersionQualifier.zip"

println(archive)

val pluginDescriptorFile = {
val f = File.createTempFile(name.value, "tmp")
IO.write(f,
s"""name=${name.value}
|version=${version.value}
|description=${description.value}
|site=false
|jvm=true
|classname=com.etsy.elasticsearch.restlog.RestlogPlugin
|java.version=${V.java}
|elasticsearch.version=${V.elasticsearch}
|""".stripMargin)
|version=${version.value}
|description=${description.value}
|site=false
|jvm=true
|classname=com.etsy.elasticsearch.restlog.RestlogPlugin
|java.version=$javaVersion
|elasticsearch.version=${esVersion.value}
|""".stripMargin)
f
}

Expand All @@ -58,13 +64,4 @@ object Build extends sbt.Build {
archive
}

object V {

val java = "1.8"
val elasticsearch = "2.0.0"

def elasticsearchMajorVersion = elasticsearch.split('.')(0)

}

}

0 comments on commit bbb4d61

Please sign in to comment.