-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.sbt
executable file
·175 lines (163 loc) · 5.1 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
lazy val theVersion = "0.2.9-SNAPSHOT"
lazy val theScalaVersion = "2.11.11"
lazy val scalaVersions = Seq("2.11.11", "2.12.2")
lazy val catsVersion = "0.9.0"
lazy val scalaTestVersion = "3.2.0-SNAP4"
scalaVersion in ThisBuild := theScalaVersion
lazy val root = Project(id = "diesel-root", base = file("."))
.settings(
name := "diesel-root",
crossScalaVersions := scalaVersions,
crossVersion := CrossVersion.binary,
commonSettings,
publishSettings,
// Do not publish the root project (it just serves as an aggregate)
publishArtifact := false,
publishLocal := {}
)
.aggregate(coreJs, coreJvm, catsJs, catsJvm, scalazJs, scalazJvm, examplesJs, examplesJvm)
lazy val core = crossProject
.crossType(CrossType.Pure)
.settings(
name := "diesel-core",
commonSettings,
metaMacroSettings,
publishSettings,
testSettings,
// A dependency on scala.meta is required to write new-style macros, but not
// to expand such macros. This is similar to how it works for old-style
// macros and a dependency on scala.reflect.
libraryDependencies ++= Seq(
"org.scalameta" %%% "scalameta" % "1.7.0",
"org.typelevel" %%% "cats-core" % catsVersion % Test
)
)
lazy val coreJs = core.js
lazy val coreJvm = core.jvm
lazy val examples = crossProject
.crossType(CrossType.Pure)
.settings(
name := "diesel-examples",
commonSettings,
testSettings,
metaMacroSettings,
publishSettings,
publishArtifact := false,
publishLocal := {},
libraryDependencies += "org.typelevel" %%% "cats-core" % catsVersion
)
.dependsOn(cats)
lazy val examplesJs = examples.js
lazy val examplesJvm = examples.jvm
lazy val cats = crossProject
.crossType(CrossType.Pure)
.settings(
name := "diesel-cats",
commonSettings,
metaMacroSettings,
publishSettings,
testSettings,
libraryDependencies += "org.typelevel" %%% "cats-core" % catsVersion
)
.dependsOn(core)
lazy val catsJs = cats.js
lazy val catsJvm = cats.jvm
lazy val scalaz = crossProject
.crossType(CrossType.Pure)
.settings(
name := "diesel-scalaz",
commonSettings,
metaMacroSettings,
publishSettings,
testSettings,
libraryDependencies += "org.scalaz" %%% "scalaz-core" % "7.2.12"
)
.dependsOn(core)
lazy val scalazJs = scalaz.js
lazy val scalazJvm = scalaz.jvm
lazy val commonSettings: Seq[Def.Setting[_]] = Seq(
organization := "com.beachape",
version := theVersion,
scalacOptions in (Compile, compile) ++= Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-unchecked",
"-Xfatal-warnings",
"-Xlint",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xfuture",
"-Ywarn-unused-import"
),
wartremoverErrors in (Compile, compile) ++= Warts.unsafe
)
lazy val testSettings = {
Seq(
libraryDependencies ++=
Seq(
"org.scalatest" %%% "scalatest" % scalaTestVersion % Test
),
doctestGenTests := {
if (isScalaJSProject.value)
Seq.empty
else
doctestGenTests.value
},
doctestTestFramework := DoctestTestFramework.ScalaTest,
doctestWithDependencies := false,
scalaJSStage in Test := FastOptStage
)
}
lazy val metaMacroSettings: Seq[Def.Setting[_]] = Seq(
// A dependency on macro paradise 3.x is required to both write and expand
// new-style macros. This is similar to how it works for old-style macro
// annotations and a dependency on macro paradise 2.x.
addCompilerPlugin("org.scalameta" % "paradise" % "3.0.0-M8" cross CrossVersion.full),
// if your project uses multiple Scala versions, use this for cross building
addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.3" cross CrossVersion.binary),
scalacOptions += "-Xplugin-require:macroparadise",
// temporary workaround for https://github.com/scalameta/paradise/issues/10
scalacOptions in (Compile, console) := Seq() // macroparadise plugin doesn't work in repl yet.
)
// Settings for publishing to Maven Central
lazy val publishSettings: Seq[Def.Setting[_]] = Seq(
pomExtra :=
<url>https://github.com/lloydmeta/freast</url>
<licenses>
<license>
<name>MIT</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>git@github.com:lloydmeta/diesel.git</url>
<connection>scm:git:git@github.com:lloydmeta/diesel.git</connection>
</scm>
<developers>
<developer>
<id>lloydmeta</id>
<name>Lloyd Chan</name>
<url>https://beachape.com</url>
</developer>
</developers>,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ =>
false
}
)