forked from scala/pickling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
150 lines (141 loc) · 5.83 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
146
147
148
149
150
import Benchmark._ // see project/Benchmark.scala
import Dependencies._ // see project/Dependencies.scala
import scala.xml.{Node => XmlNode, NodeSeq => XmlNodeSeq, _}
import scala.xml.transform.{RewriteRule, RuleTransformer}
val buildVersion = "0.11.0-M2"
def commonSettings = Seq(
version in ThisBuild := buildVersion,
scalaVersion := Util.buildScalaVersion,
crossScalaVersions := Util.buildScalaVersions,
scalacOptions in (Test, compile) ++= (scalaBinaryVersion.value match {
case "2.10" => Seq("-Xmax-classfile-name", "254")
case _ => Seq()
}),
organization in ThisBuild := "org.scala-lang.modules",
organizationName in ThisBuild := "LAMP/EPFL",
organizationHomepage in ThisBuild := Some(url("http://lamp.epfl.ch")),
homepage in ThisBuild := Some(url("https://github.com/scala/pickling")),
licenses in ThisBuild := List("BSD-like" -> url("http://www.scala-lang.org/downloads/license.html")),
scmInfo in ThisBuild := Some(ScmInfo(url("https://github.com/scala/pickling"), "[email protected]:scala/pickling.git")),
developers in ThisBuild := List(
Developer("xeno-by", "Eugene Burmako", "@xeno_by", url("http://github.com/xeno-by")),
Developer("heathermiller", "Heather Miller", "@heathercmiller", url("http://github.com/heathermiller")),
Developer("phaller", "Philipp Haller", "@philippkhaller", url("http://github.com/phaller")),
Developer("havocp", "Havoc Pennington", "@havocp", url("https://github.com/havocp")),
Developer("eed3si9n", "Eugene Yokota", "@eed3si9n", url("https://github.com/eed3si9n")),
Developer("jsuereth", "Josh Suereth", "@jsuereth", url("https://github.com/jsuereth"))
),
resolvers += Resolver.sonatypeRepo("snapshots"),
resolvers += Resolver.sonatypeRepo("releases"),
scalacOptions ++= Seq("-feature"),
parallelExecution in Test := false, // hello, reflection sync!!
publishMavenStyle in ThisBuild := true,
publishArtifact in Test := false,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
pomIncludeRepository := { x => false },
pomExtra := <inceptionYear>2013</inceptionYear>,
credentials ++= Util.loadCredentials(),
pomPostProcess := { (node: XmlNode) =>
new RuleTransformer(new RewriteRule {
override def transform(node: XmlNode): XmlNodeSeq = node match {
case e: Elem if e.label == "dependency" && e.child.exists(child => child.label == "artifactId" && child.text.contains("testutil")) =>
Comment(s"Ommitted test-util dependency")
case _ => node
}
}).transform(node).head
}
)
def noPublish = Seq(
publish := {},
publishLocal := {}
)
// Use root project
lazy val root: Project = (project in file(".")).
aggregate(core, benchmark, sandbox, sandboxTests, macroTests).
settings(commonSettings ++ noPublish: _*).
settings(
name := "Scala Pickling",
run in Compile := (run in (sandbox, Compile)).evaluated
)
/** Scala Pickling code */
lazy val core: Project = (project in file("core")).
dependsOn(testUtil % "test->test").
settings(commonSettings: _*).
settings(
name := "scala-pickling",
libraryDependencies ++= {
val baseDeps = Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang" % "scala-compiler" % scalaVersion.value, // for ToolBox
scalaTest % Test,
scalaCheck % Test
)
val additional = CrossVersion.partialVersion(scalaVersion.value) match {
// if scala 2.11+ is used, quasiquotes are merged into scala-reflect
case Some((2, scalaMajor)) if scalaMajor >= 11 =>
Seq(parserCombinators)
// in Scala 2.10, quasiquotes are provided by macro-paradise
case Some((2, 10)) =>
Seq(compilerPlugin(macroParadise), quasiquotes)
}
baseDeps ++ additional
}
)
lazy val macroTests: Project = (project in file("macro-test")).
dependsOn(core).
settings(commonSettings:_*).settings(noPublish:_*).
settings(
libraryDependencies ++= {
val baseDeps =
Seq(
scalaTest % Test,
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Test
)
val additional = CrossVersion.partialVersion(scalaVersion.value) match {
// if scala 2.11+ is used, quasiquotes are merged into scala-reflect
case Some((2, scalaMajor)) if scalaMajor >= 11 =>
Seq(parserCombinators)
// in Scala 2.10, quasiquotes are provided by macro-paradise
case Some((2, 10)) =>
Seq(compilerPlugin(macroParadise), quasiquotes)
}
baseDeps ++ additional
}
)
lazy val testUtil: Project = (project in file("test-util")).
settings(commonSettings ++ noPublish: _*)
lazy val sandbox: Project = (project in file("sandbox")).
dependsOn(core).
settings(commonSettings ++ noPublish: _*).
settings(
sourceDirectory in Test := baseDirectory.value,
libraryDependencies += scalaTest % Test,
// scalacOptions ++= Seq()
scalacOptions ++= Seq("-Xlog-implicits")
// scalacOptions ++= Seq("-Xprint:typer")
)
/* This submodule is meant to store tests that need to be executed
* independently from the main test suite placed in `core`. */
lazy val sandboxTests: Project = (project in file("sandbox-test")).
dependsOn(core).
settings(commonSettings ++ noPublish: _*).
settings(
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
scalaTest % Test,
scalaCheck % Test
)
)
lazy val benchmark: Project = (project in file("benchmark")).
dependsOn(core).
settings(commonSettings ++ noPublish ++ benchmarkSettings: _*).
settings(
scalacOptions ++= Seq("-optimise"),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
kryoSerializers, kryo)
)