-
Notifications
You must be signed in to change notification settings - Fork 142
/
build.sbt
145 lines (125 loc) · 4.44 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import com.typesafe.sbt.SbtGit.{GitKeys => git}
import sbt.Tests.{InProcess, Group}
val akkaVersion = "2.5.25"
val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion
val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion
val specs2 = "org.specs2" %% "specs2-core" % "4.8.0"
val stm = "org.scala-stm" %% "scala-stm" % "0.9.1"
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.14.2"
//val scalameter = "com.github.axel22" %% "scalameter" % "0.4"
val rediscalaDependencies = Seq(
akkaActor,
stm,
akkaTestkit % "test",
//scalameter % "test",
specs2 % "test",
scalacheck % "test"
)
val baseSourceUrl = "https://github.com/etaty/rediscala/tree/"
val Scala211 = "2.11.12"
lazy val standardSettings = Def.settings(
name := "rediscala",
organization := "com.github.etaty",
scalaVersion := Scala211,
crossScalaVersions := Seq(Scala211, "2.12.10", "2.13.0"),
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html")),
homepage := Some(url("https://github.com/etaty/rediscala")),
scmInfo := Some(ScmInfo(url("https://github.com/etaty/rediscala"), "scm:git:[email protected]:etaty/rediscala.git")),
apiURL := Some(url("http://etaty.github.io/rediscala/latest/api/")),
pomExtra := (
<developers>
<developer>
<id>etaty</id>
<name>Valerian Barbot</name>
<url>http://github.com/etaty/</url>
</developer>
</developers>
),
publishTo := sonatypePublishTo.value,
publishMavenStyle := true,
git.gitRemoteRepo := "[email protected]:etaty/rediscala.git",
scalacOptions ++= Seq(
"-encoding", "UTF-8",
"-Xlint",
"-deprecation",
"-feature",
"-language:postfixOps",
"-unchecked"
),
scalacOptions in (Compile, doc) ++= {
Seq(
"-sourcepath", (baseDirectory in LocalProject("rediscala")).value.getAbsolutePath
)
},
autoAPIMappings := true,
apiURL := Some(url("http://etaty.github.io/rediscala/")),
scalacOptions in (Compile, doc) ++= {
val v = (version in LocalProject("rediscala")).value
val branch = if(v.trim.endsWith("SNAPSHOT")) "master" else v
Seq[String](
"-doc-source-url", baseSourceUrl + branch +"€{FILE_PATH}.scala"
)
},
siteMappings ++= {
for((f, d) <- (mappings in packageDoc in Compile).value) yield (f, (version in LocalProject("rediscala")).value + "/api/" + d)
},
ghpagesCleanSite := {
val dir = ghpagesUpdatedRepository.value
val v = (version in LocalProject("rediscala")).value
val toClean = IO.listFiles(dir).filter{ f =>
val p = f.getName
p.startsWith("latest") || p.startsWith(v)
}.map(_.getAbsolutePath).toList
val log = streams.value.log
val gitRunner = git.gitRunner.value
if(toClean.nonEmpty)
gitRunner.apply(("rm" :: "-r" :: "-f" :: "--ignore-unmatch" :: toClean) :_*)(dir, log)
()
},
ghpagesSynchLocal := {
val clean = ghpagesCleanSite.value
val repo = ghpagesUpdatedRepository.value
// TODO - an sbt.Synch with cache of previous mappings to make this more efficient. */
val betterMappings = ghpagesPrivateMappings.value map { case (file, target) => (file, repo / target) }
// First, remove 'stale' files.
//cleanSite.
// Now copy files.
IO.copy(betterMappings)
if(ghpagesNoJekyll.value) IO.touch(repo / ".nojekyll")
repo
},
siteSubdirName in SiteScaladoc := "latest/api"
)
lazy val BenchTest = config("bench") extend Test
lazy val benchTestSettings = inConfig(BenchTest)(Defaults.testSettings ++ Seq(
sourceDirectory in BenchTest := baseDirectory.value / "src/benchmark",
//testOptions in BenchTest += Tests.Argument("-preJDK7"),
testFrameworks in BenchTest := Seq(new TestFramework("org.scalameter.ScalaMeterFramework")),
//https://github.com/sbt/sbt/issues/539 => bug fixed in sbt 0.13.x
testGrouping in BenchTest := (definedTests in BenchTest map partitionTests).value
))
lazy val root = Project(id = "rediscala",
base = file(".")
).settings(
standardSettings,
libraryDependencies ++= rediscalaDependencies
).configs(
BenchTest
).enablePlugins(
SiteScaladocPlugin, GhpagesPlugin
)
lazy val benchmark = {
import pl.project13.scala.sbt.JmhPlugin
Project(
id = "benchmark",
base = file("benchmark")
).settings(Seq(
scalaVersion := Scala211,
libraryDependencies += "net.debasishg" %% "redisclient" % "3.0"
))
.enablePlugins(JmhPlugin)
.dependsOn(root)
}
def partitionTests(tests: Seq[TestDefinition]) = {
Seq(new Group("inProcess", tests, InProcess))
}