-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sbt
335 lines (314 loc) · 12.4 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
import org.scoverage.coveralls.Imports.CoverallsKeys.coverallsTokenFile
import com.ossuminc.sbt.{CrossModule, DocSite, OssumIncPlugin, Plugin}
import com.typesafe.tools.mima.core.{ProblemFilters, ReversedMissingMethodProblem}
import de.heikoseeberger.sbtheader.License.ALv2
import de.heikoseeberger.sbtheader.LicenseStyle.SpdxSyntax
import sbt.Append.{appendSeqImplicit, appendSet}
import sbt.Keys.{description, libraryDependencies}
import sbtbuildinfo.BuildInfoPlugin.autoImport.buildInfoPackage
import sbtcrossproject.{CrossClasspathDependency, CrossProject}
import sbttastymima.TastyMiMaPlugin.autoImport.*
Global / onChangedBuildSource := ReloadOnSourceChanges
(Global / excludeLintKeys) ++= Set(mainClass)
enablePlugins(OssumIncPlugin)
lazy val startYear: Int = 2019
lazy val license = ALv2(yyyy = "2019-2025", copyrightOwner = "Ossum Inc.", licenseStyle = SpdxSyntax)
def cpDep(cp: CrossProject): CrossClasspathDependency = cp % "compile->compile;test->test"
def pDep(p: Project): ClasspathDependency = p % "compile->compile;test->test"
def tkDep(cp: CrossProject): CrossClasspathDependency = cp % "compile->compile;test->test"
lazy val riddl: Project = Root("riddl", startYr = startYear /*, license = "Apache-2.0" */ )
.configure(With.noPublishing, With.git, With.dynver, With.noMiMa)
.aggregate(
utils,
utilsJS,
language,
languageJS,
passes,
passesJS,
testkit,
testkitJS,
diagrams,
diagramsJS,
riddlLib,
riddlLibJS,
command,
hugo,
commands,
riddlc,
docsite,
plugin
)
lazy val Utils = config("utils")
lazy val utils_cp: CrossProject = CrossModule("utils", "riddl-utils")(JVM, JS)
.configure(With.typical, With.headerLicense("Apache-2.0"))
.configure(With.build_info)
.settings(
scalacOptions += "-explain-cyclic",
buildInfoPackage := "com.ossuminc.riddl.utils",
buildInfoObject := "RiddlBuildInfo",
description := "Various utilities used throughout riddl libraries"
)
.jvmConfigure(With.coverage(70))
.jvmConfigure(With.publishing)
.jvmConfigure(With.MiMa("0.52.1", Seq("com.ossuminc.riddl.utils.RiddlBuildInfo")))
.jvmSettings(
coverageExcludedFiles := """<empty>;$anon;.*RiddlBuildInfo.scala""",
libraryDependencies ++= Seq(Dep.compress, Dep.lang3) ++ Dep.testing,
tastyMiMaConfig ~= { prevConfig =>
import java.util.Arrays.asList
import tastymima.intf._
prevConfig.withMoreProblemFilters(
asList(
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "com.ossuminc.riddl.utils.RiddlBuildInfo.version"),
ProblemMatcher
.make(ProblemKind.IncompatibleTypeChange, "com.ossuminc.riddl.utils.RiddlBuildInfo.builtAtString"),
ProblemMatcher
.make(ProblemKind.IncompatibleTypeChange, "com.ossuminc.riddl.utils.RiddlBuildInfo.builtAtMillis"),
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "com.ossuminc.riddl.utils.RiddlBuildInfo.isSnapshot")
)
)
}
)
.jsConfigure(With.js("RIDDL: utils", withCommonJSModule = true))
.jsConfigure(With.noMiMa)
.jsConfigure(With.publishing)
.jsSettings(
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "2.8.0",
"io.github.cquiroz" %%% "scala-java-time" % "2.6.0",
"org.scalacheck" %%% "scalacheck" % V.scalacheck % "test"
)
)
lazy val utils = utils_cp.jvm
lazy val utilsJS = utils_cp.js
val Language = config("language")
lazy val language_cp: CrossProject = CrossModule("language", "riddl-language")(JVM, JS)
.dependsOn(cpDep(utils_cp))
.configure(With.typical, With.headerLicense("Apache-2.0"))
.settings(
description := "Abstract Syntax Tree and basic RIDDL language parser",
scalacOptions ++= Seq("-explain", "--explain-types", "--explain-cyclic", "--no-warnings"),
Test / parallelExecution := false
)
.jvmConfigure(With.coverage(65))
.jvmConfigure(With.publishing)
.jvmConfigure(With.MiMa("0.52.1"))
.jvmSettings(
tastyMiMaConfig ~= { prevConfig =>
import java.util.Arrays.asList
import tastymima.intf._
prevConfig.withMoreProblemFilters(
asList(
ProblemMatcher.make(ProblemKind.NewAbstractMember, "com.ossuminc.riddl.language.AST.RiddlValue.loc"),
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "com.ossuminc.riddl.language.AST.OccursInProcessor")
)
)
},
coverageExcludedPackages := "<empty>;$anon",
libraryDependencies ++= Dep.testing ++ Seq(Dep.fastparse),
libraryDependencies += "org.wvlet.airframe" %% "airframe-ulid" % V.airframe_ulid,
libraryDependencies += "org.wvlet.airframe" %% "airframe-json" % V.airframe_json,
libraryDependencies += Dep.commons_io % Test
)
.jsConfigure(With.js("RIDDL: language", withCommonJSModule = true))
.jsConfigure(With.publishing)
.jsConfigure(With.noMiMa)
.jsSettings(
libraryDependencies += "com.lihaoyi" %%% "fastparse" % V.fastparse,
libraryDependencies += "org.wvlet.airframe" %%% "airframe-ulid" % "24.9.2"
)
lazy val language = language_cp.jvm.dependsOn(utils)
lazy val languageJS = language_cp.js.dependsOn(utilsJS)
val Passes = config("passes")
lazy val passes_cp = CrossModule("passes", "riddl-passes")(JVM, JS)
.dependsOn(cpDep(utils_cp), cpDep(language_cp))
.configure(With.typical, With.headerLicense("Apache-2.0"))
.settings(
Test / parallelExecution := false,
scalacOptions ++= Seq("-explain", "--explain-types", "--explain-cyclic"),
description := "AST Pass infrastructure and essential passes"
)
.jvmConfigure(With.coverage(30))
.jvmConfigure(With.MiMa("0.52.1"))
.jvmSettings(
coverageExcludedPackages := "<empty>;$anon",
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[ReversedMissingMethodProblem]("com.ossuminc.riddl.passes.PassVisitor.doRelationship")
),
tastyMiMaConfig ~= { prevConfig =>
import java.util.Arrays.asList
import tastymima.intf._
prevConfig.withMoreProblemFilters(
asList(
ProblemMatcher.make(ProblemKind.NewAbstractMember, "com.ossuminc.riddl.passes.PassVisitor.doRelationship")
)
)
}
)
.jsConfigure(With.js("RIDDL: passes", withCommonJSModule = true))
.jsConfigure(With.publishing)
.jsConfigure(With.noMiMa)
val passes = passes_cp.jvm
val passesJS = passes_cp.js
lazy val testkit_cp = CrossModule("testkit", "riddl-testkit")(JVM, JS)
.configure(With.typical, With.publishing, With.headerLicense("Apache-2.0"))
.settings(
description := "Testing kit for RIDDL language and passes"
)
.dependsOn(tkDep(utils_cp), tkDep(language_cp), tkDep(passes_cp))
.jvmSettings(
libraryDependencies ++= Seq(
"org.scalactic" %% "scalactic" % V.scalatest,
"org.scalatest" %% "scalatest" % V.scalatest
)
)
.jsConfigure(With.js("RIDDL: language", withCommonJSModule = true))
.jsConfigure(With.publishing)
.jsSettings(
// scalacOptions ++= Seq("-rewrite", "-source", "3.4-migration"),
libraryDependencies ++= Seq(
"org.scalactic" %%% "scalactic" % V.scalatest,
"org.scalatest" %%% "scalatest" % V.scalatest
)
)
val testkit = testkit_cp.jvm
val testkitJS = testkit_cp.js
val Diagrams = config("diagrams")
lazy val diagrams_cp: CrossProject = CrossModule("diagrams", "riddl-diagrams")(JVM, JS)
.dependsOn(cpDep(utils_cp), cpDep(language_cp), cpDep(passes_cp))
.configure(With.typical, With.publishing, With.headerLicense("Apache-2.0"))
.settings(
description := "Implementation of various AST diagrams passes other libraries may use"
)
.jvmConfigure(With.coverage(50))
.jvmConfigure(With.MiMa("0.52.1"))
.jvmSettings(
coverageExcludedFiles := """<empty>;$anon"""
)
.jsConfigure(With.js("RIDDL: diagrams", withCommonJSModule = true))
.jsConfigure(With.noMiMa)
val diagrams = diagrams_cp.jvm
val diagramsJS = diagrams_cp.js
lazy val riddlLib_cp: CrossProject = CrossModule("riddlLib", "riddl-lib")(JS, JVM)
.dependsOn(cpDep(utils_cp), cpDep(language_cp), cpDep(passes_cp), cpDep(diagrams_cp))
.configure(With.scala3, With.publishing)
.settings(
description := "Bundling of essential RIDDL libraries"
)
val riddlLib = riddlLib_cp.jvm
val riddlLibJS = riddlLib_cp.js
val Command = config("command")
lazy val command = Module("command", "riddl-command")
.configure(With.typical, With.coverage(30), With.MiMa("0.52.1"))
.configure(With.publishing, With.headerLicense("Apache-2.0"))
.settings(
coverageExcludedPackages := "<empty>;$anon",
description := "Command infrastructure needed to define a command",
Test / parallelExecution := false,
libraryDependencies ++= Seq(
Dep.scopt,
Dep.pureconfig,
"org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided"
) ++ Dep.testing
)
.dependsOn(pDep(utils), pDep(language), passes)
def testDep(project: Project): ClasspathDependency = project % "compile->compile;compile->test;test->test"
val Hugo = config("hugo")
lazy val hugo = Module("hugo", "riddl-hugo")
.configure(With.typical, With.publishing, With.headerLicense("Apache-2.0"))
.configure(With.coverage(65))
.configure(With.MiMa("0.52.1"))
.settings(
coverageExcludedFiles := """<empty>;$anon""",
scalacOptions += "-explain-cyclic",
description := "Implementation for the RIDDL hugo command, a website generator",
libraryDependencies ++= Dep.testing ++ Seq(
"org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided"
)
)
.dependsOn(utils, pDep(language), pDep(passes), diagrams, pDep(command))
val Commands = config("commands")
lazy val commands: Project = Module("commands", "riddl-commands")
.configure(With.typical, With.publishing, With.headerLicense("Apache-2.0"))
.configure(With.coverage(50))
.configure(With.MiMa("0.52.1"))
.settings(
coverageExcludedFiles := """<empty>;$anon""",
scalacOptions ++= Seq("-explain", "--explain-types", "--explain-cyclic"),
description := "RIDDL Command Infrastructure and basic command definitions",
libraryDependencies ++= Seq(Dep.scopt, Dep.pureconfig) ++ Dep.testing ++ Seq(
"org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided"
)
)
.dependsOn(
pDep(utils),
pDep(language),
pDep(passes),
command,
hugo
)
val Riddlc = config("riddlc")
lazy val riddlc: Project = Program("riddlc", "riddlc")
.configure(With.typical, With.publishing, With.headerLicense("Apache-2.0"))
.configure(With.coverage(50.0))
.configure(With.noMiMa)
.dependsOn(
utils,
language,
testDep(passes),
testDep(commands)
)
.settings(
coverageExcludedFiles := """<empty>;$anon""",
description := "The `riddlc` compiler and tests, the only executable in RIDDL",
coverallsTokenFile := Some("/home/reid/.coveralls.yml"),
maintainer := "reid@ossuminc.com",
mainClass := Option("com.ossuminc.riddl.RIDDLC"),
graalVMNativeImageOptions ++= Seq(
"--verbose",
"--no-fallback",
"--native-image-info",
"--enable-url-protocols=https,http",
"-H:ResourceConfigurationFiles=../../src/native-image.resources"
),
libraryDependencies ++= Seq(Dep.pureconfig) ++ Dep.testing
)
lazy val docProjects = List(
(utils, Utils),
(language, Language),
(passes, Passes),
(diagrams, Diagrams),
(command, Command),
(hugo, Hugo),
(commands, Commands),
(riddlc, Riddlc)
)
lazy val docOutput: File = file("doc") / "src" / "main" / "hugo" / "static" / "apidoc"
//def akkaMappings: Map[(String, String), URL] = Map(
// ("com.typesafe.akka", "akka-actor") -> url(s"http://doc.akka.io/api/akka/"),
// ("com.typesafe", "config") -> url("http://typesafehub.github.io/config/latest/api/")
//)
lazy val docsite = DocSite(
dirName = "doc",
apiOutput = file("src") / "main" / "hugo" / "static" / "apidoc",
baseURL = Some("https://riddl.tech/apidoc"),
inclusions = Seq(utils, language, passes, diagrams, command, hugo, commands),
logoPath = Some("doc/src/main/hugo/static/images/RIDDL-Logo-128x128.png")
)
.settings(
name := "riddl-doc",
description := "Generation of the documentation web site",
libraryDependencies ++= Dep.testing
)
.configure(With.noMiMa)
.dependsOn(utils, language, passes, diagrams, command, hugo, commands)
lazy val plugin = Plugin("sbt-riddl")
.configure(With.build_info, With.scala2, With.noMiMa, With.publishing)
.configure(With.headerLicense("Apache-2.0"))
.settings(
description := "An sbt plugin to embellish a project with riddlc usage",
buildInfoObject := "SbtRiddlPluginBuildInfo",
buildInfoPackage := "com.ossuminc.riddl.sbt",
buildInfoUsePackageAsPath := true,
scalaVersion := "2.12.20"
)