-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
232 lines (209 loc) · 6.95 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
import sbtcrossproject.CrossPlugin.autoImport.{CrossType, crossProject}
inThisBuild(
Seq(
homepage := Some(url("https://github.com/Katrix/perspective")),
organization := "net.katsstuff",
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
developers := List(Developer("Katrix", "Kathryn Frid", "[email protected]", url("http://katsstuff.net/"))),
versionScheme := Some("early-semver")
)
)
lazy val commonScala2Settings = Seq(
scalaVersion := "2.13.12",
moduleName := {
val old = moduleName.value
if (old == "perspective") "perspectivescala2"
else s"perspectivescala2-$old"
},
addCompilerPlugin(("org.typelevel" %% "kind-projector" % "0.13.2").cross(CrossVersion.full)),
scalacOptions += "-explaintypes"
)
lazy val commonDottySettings = Seq(
scalaVersion := "3.3.3",
moduleName := {
val old = moduleName.value
if (old == "perspective") old
else s"perspective-$old"
},
scalacOptions += "-Ykind-projector",
scalacOptions += "-feature",
libraryDependencies += "org.scalactic" %%% "scalactic" % "3.2.13" % Test,
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.13" % Test
)
lazy val publishSettings = Seq(
Test / publishArtifact := false,
autoAPIMappings := true
)
lazy val noPublishSettings = Seq(publish := {}, publishLocal := {}, publishArtifact := false, publish / skip := true)
lazy val scala2Perspective = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("scala2/perspective"))
.settings(
commonScala2Settings,
publishSettings,
name := "perspective",
scalacOptions += "-Ymacro-annotations",
libraryDependencies += "org.typelevel" %%% "cats-core" % "2.8.0",
libraryDependencies += "org.typelevel" %%% "simulacrum" % "1.0.1"
)
lazy val scala2PerspectiveJVM = scala2Perspective.jvm
lazy val scala2PerspectiveJS = scala2Perspective.js
lazy val circeVersion = "0.14.2"
lazy val scala2PerspectiveDerivation = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("scala2/derivation"))
.dependsOn(scala2Perspective)
.settings(
commonScala2Settings,
publishSettings,
name := "derivation",
libraryDependencies += "com.chuusai" %%% "shapeless" % "2.3.9",
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core",
"io.circe" %%% "circe-parser"
).map(_ % circeVersion % Test),
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.13" % Test
)
lazy val scala2PerspectiveDerivationJVM = scala2PerspectiveDerivation.jvm
lazy val scala2PerspectiveDerivationJS = scala2PerspectiveDerivation.js
lazy val scala2PerspectiveMacros = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("scala2/macros"))
.dependsOn(scala2Perspective)
.settings(
commonScala2Settings,
publishSettings,
name := "macro",
scalacOptions += "-Ymacro-annotations",
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
libraryDependencies += "org.typelevel" %%% "cats-tagless-macros" % "0.12"
)
lazy val scala2PerspectiveMacrosJVM = scala2PerspectiveMacros.jvm
lazy val scala2PerspectiveMacrosJS = scala2PerspectiveMacros.js
lazy val scala2PerspectiveExamples = project
.in(file("scala2/examples"))
.dependsOn(scala2PerspectiveDerivationJVM, scala2PerspectiveMacrosJVM)
.settings(
commonScala2Settings,
noPublishSettings,
name := "examples",
scalacOptions += "-Ymacro-annotations",
libraryDependencies ++= Seq(
"io.circe" %% "circe-core",
"io.circe" %% "circe-parser"
).map(_ % circeVersion)
)
lazy val dottyPerspective = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("dotty/perspective"))
.settings(
commonDottySettings,
publishSettings,
name := "perspective",
libraryDependencies += "org.typelevel" %%% "cats-core" % "2.8.0"
)
lazy val dottyPerspectiveJVM = dottyPerspective.jvm
lazy val dottyPerspectiveJS = dottyPerspective.js
lazy val dottyPerspectiveDerivation = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("dotty/derivation"))
.dependsOn(dottyPerspective)
.settings(
commonDottySettings,
publishSettings,
name := "derivation",
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core",
"io.circe" %%% "circe-parser"
).map(_ % circeVersion % Test)
)
lazy val dottyPerspectiveDerivationJVM = dottyPerspectiveDerivation.jvm
lazy val dottyPerspectiveDerivationJS = dottyPerspectiveDerivation.js
lazy val dottyPerspectiveExamples = project
.in(file("dotty/examples"))
.dependsOn(dottyPerspectiveDerivationJVM)
.settings(
commonDottySettings,
noPublishSettings,
name := "examples",
libraryDependencies ++= Seq(
"io.circe" %% "circe-core",
"io.circe" %% "circe-parser"
).map(_ % circeVersion)
// scalacOptions ++= Seq("-Xprint:typer")
)
lazy val docsMappingsAPIDir = settingKey[String]("Name of subdirectory in site target directory for api docs")
lazy val docs = project
.enablePlugins(ScalaUnidocPlugin)
.settings(
commonDottySettings,
autoAPIMappings := true,
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(
dottyPerspectiveJVM,
dottyPerspectiveDerivationJVM
),
ScalaUnidoc / unidoc / scalacOptions ++= Seq(
"-sourcepath",
(LocalRootProject / baseDirectory).value.getAbsolutePath,
"-siteroot",
"docs",
"-project",
"perspective",
"-project-version",
version.value,
"-social-links:github::https://github.com/Katrix/perspective",
"-source-links:github://Katrix/perspective",
"-revision",
"main",
"-Yapi-subdirectory",
"api"
)
)
lazy val perspectiveScala2 = project
.in(file("scala2"))
.aggregate(
scala2PerspectiveJVM,
scala2PerspectiveJS,
scala2PerspectiveDerivationJVM,
scala2PerspectiveDerivationJS,
scala2PerspectiveMacrosJVM,
scala2PerspectiveMacrosJS,
scala2PerspectiveExamples
)
.settings(
noPublishSettings
)
lazy val perspectiveDotty =
project
.in(file("dotty"))
.aggregate(
dottyPerspectiveJVM,
dottyPerspectiveJS,
dottyPerspectiveDerivationJVM,
dottyPerspectiveDerivationJS,
dottyPerspectiveExamples
)
.settings(
noPublishSettings
)
lazy val perspectiveRoot =
project
.in(file("."))
.aggregate(
scala2PerspectiveJVM,
scala2PerspectiveJS,
scala2PerspectiveDerivationJVM,
scala2PerspectiveDerivationJS,
scala2PerspectiveMacrosJVM,
scala2PerspectiveMacrosJS,
scala2PerspectiveExamples,
dottyPerspectiveJVM,
dottyPerspectiveJS,
dottyPerspectiveDerivationJVM,
dottyPerspectiveDerivationJS,
dottyPerspectiveExamples
)
.settings(
noPublishSettings
)