-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
62 lines (55 loc) · 2.14 KB
/
build.sbt
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
enablePlugins(GitVersioning, GitBranchPrompt)
lazy val buildSettings = Seq(
organization := "org.cheminot",
scalaVersion := "2.11.8",
crossPaths := false
)
lazy val commonSettings = Seq(
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-feature",
"-unchecked",
"-Xlint",
"-Ywarn-dead-code",
"-Ywarn-unused-import"
),
scalacOptions in (Compile, console) ~= (_ filterNot (_ == "-Ywarn-unused-import"))
)
lazy val cheminotorgSettings = buildSettings ++ commonSettings
lazy val root = (project in file(".")).
settings(commonSettings: _*).
settings(name := "web").
settings(cheminotorgSettings:_*).
settings(libraryDependencies += "com.propensive" %% "rapture" % "2.0.0-M7" exclude ("javax.servlet", "servlet-api")).
settings(libraryDependencies += "com.propensive" %% "rapture-http-jetty" % "2.0.0-M7").
settings(libraryDependencies += "joda-time" % "joda-time" % "2.9.1").
settings(libraryDependencies += "org.joda" % "joda-convert" % "1.8").
settings(libraryDependencies += "org.jsoup" % "jsoup" % "1.8.3").
settings(libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.4").
settings(libraryDependencies += "org.cheminot" % "misc" % "0.1-SNAPSHOT").
settings(com.github.retronym.SbtOneJar.oneJarSettings: _*)
// versioning
git.baseVersion := "0.1.0"
git.useGitDescribe := true
git.formattedShaVersion := git.gitHeadCommit.value map { sha => s"$sha".take(7) }
resolvers ++= Seq(
Resolver.typesafeRepo("releases"),
Resolver.url("rapture", new URL("https://raw.githubusercontent.com/srenault/central/master"))(Resolver.ivyStylePatterns)
)
sourceGenerators in Compile <+= (version, sourceManaged in Compile).map {
case (gitVersion, sources) =>
val file = sources / "Settings.scala"
val code = """package org.cheminot.web { trait Settings { val GIT_TAG = "%s" } }""".format(gitVersion)
scala.util.Try(IO read file).map { current =>
Some(current)
}.recover {
case _: java.io.FileNotFoundException =>
None
}.foreach { maybeCurrent =>
if(maybeCurrent.isEmpty || maybeCurrent.exists(_ != code)) {
IO.write(file, code)
}
}
Seq(file)
}