-
Notifications
You must be signed in to change notification settings - Fork 40
/
build.sbt
124 lines (104 loc) · 3.8 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
def scala211Dependencies(scalaVersion:String) = {
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, scalaMajor)) if scalaMajor >= 11 =>
Seq(
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1")
case _ =>
Seq()
}
}
val updateVersion = taskKey[Unit]("Updates version in README")
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % "1.6.4",
"org.slf4j" % "slf4j-simple" % "1.6.4" % "test",
"org.scalatest" %% "scalatest" % "2.1.6" % "test"
) ++ scala211Dependencies(scalaVersion.value)
val commonSettings = Seq(
organization := "com.gilt",
scalaVersion := "2.11.7",
crossScalaVersions := Seq("2.11.7", "2.10.5"),
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % "1.6.4",
"org.slf4j" % "slf4j-simple" % "1.6.4" % "test",
"org.scalatest" %% "scalatest" % "2.2.4" % "test"
) ++ scala211Dependencies(scalaVersion.value),
updateVersion := {
val log = streams.value.log
val readme = (baseDirectory.value / "README.md")
val content = IO.read(readme)
val regex = """("handlebars-scala[a-z-]*" % ")[0-9\.]+(")""".r
val replaced = regex.replaceAllIn(content, { m => s"${m.group(1)}${version.value}${m.group(2)}"})
IO.write(readme, replaced)
log.info(s"Updated ${readme}")
},
resolvers ++= Seq(
"Sonatype.org Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
"Sonatype.org Releases" at "http://oss.sonatype.org/service/local/staging/deploy/maven2"
),
scalacOptions ++= Seq(
"-deprecation",
"-unchecked"
),
publishMavenStyle := true,
publishTo <<= version { (v: String) =>
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "/service/local/staging/deploy/maven2")
},
// For publishing / testing locally
//publishTo := Some(Resolver.file("m2", new File(Path.userHome.absolutePath+"/.m2/repository")))
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
licenses := Seq("BSD-style" -> url("http://www.opensource.org/licenses/bsd-license.php")),
homepage := Some(url("https://github.com/mwunsch/handlebars.scala")),
pomExtra := (
<scm>
<url>[email protected]:mwunsch/handlebars.scala.git</url>
<connection>scm:git:[email protected]:mwunsch/handlebars.scala.git</connection>
</scm>
<developers>
<developer>
<id>mwunsch</id>
<name>Mark Wunsch</name>
<url>http://markwunsch.com/</url>
<organization>Gilt</organization>
<organizationUrl>http://www.gilt.com</organizationUrl>
</developer>
<developer>
<id>chicks</id>
<name>Chris Hicks</name>
<url>http://tech.gilt.com/</url>
<organization>Gilt</organization>
<organizationUrl>http://www.gilt.com</organizationUrl>
</developer>
<developer>
<id>timcharper</id>
<name>Tim Harper</name>
<url>http://timcharper.com/</url>
<organization>Foundational Software</organization>
<organizationUrl>http://www.foundationalsoftware.com</organizationUrl>
</developer>
</developers>
)
)
lazy val core = (project in file("./")).
settings(commonSettings: _*).
settings(
name := "handlebars-scala")
lazy val `play-json` = (project in file("./addons/play-json/")).
settings(commonSettings: _*).
settings(
name := "handlebars-scala-play-json",
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.5.4").
dependsOn(core)
lazy val `all` = (project in file("./addons/all")).
settings(commonSettings: _*).
settings(
updateVersion := {},
publish := {},
test := {}
).
dependsOn(core, `play-json`).
aggregate(core, `play-json`)