-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.sbt
490 lines (469 loc) · 16.7 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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
import org.scoverage.coveralls.Imports.CoverallsKeys.coverallsTokenFile
import com.ossuminc.sbt.OssumIncPlugin
import com.typesafe.tools.mima.core.{ProblemFilters, ReversedMissingMethodProblem}
import de.heikoseeberger.sbtheader.License.ALv2
import de.heikoseeberger.sbtheader.LicenseStyle.SpdxSyntax
import os./
import sbt.Append.{appendSeqImplicit, appendSet}
import sbt.Keys.{description, libraryDependencies, scalacOptions}
import sbtbuildinfo.BuildInfoPlugin.autoImport.buildInfoPackage
import sbtcrossproject.{CrossClasspathDependency, CrossProject}
import sbttastymima.TastyMiMaPlugin.autoImport.*
import scala.collection.Seq
Global / onChangedBuildSource := ReloadOnSourceChanges
(Global / excludeLintKeys) ++= Set(mainClass, maintainer)
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)
.settings(concurrentRestrictions += Tags.limit(NativeTags.Link, 1))
.aggregate(
utils,
utilsNative,
utilsJS,
language,
languageNative,
languageJS,
passes,
passesNative,
passesJS,
testkit,
testkitNative,
testkitJS,
diagrams,
diagramsNative,
diagramsJS,
riddlLib,
riddlLibNative,
riddlLibJS,
commands,
commandsNative,
riddlc,
riddlcNative,
docsite,
plugin
)
lazy val Utils = config("utils")
lazy val utils_cp: CrossProject = CrossModule("utils", "riddl-utils")(JVM, JS, Native)
.configure(With.GithubPublishing)
.configure(With.typical, With.headerLicense("Apache-2.0"))
.settings(
scalacOptions += "-explain-cyclic",
description := "Various utilities used throughout riddl libraries"
)
.jvmConfigure(With.coverage(70))
.jvmConfigure(With.build_info)
.jvmConfigure(With.MiMa("0.57.0", Seq("com.ossuminc.riddl.utils.RiddlBuildInfo")))
.jvmSettings(
buildInfoPackage := "com.ossuminc.riddl.utils",
buildInfoObject := "RiddlBuildInfo",
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.build_info_plus_keys(
"scalaJSVersion" -> org.scalajs.sbtplugin.ScalaJSPlugin.autoImport.scalaJSVersion
)
)
.jsSettings(
buildInfoPackage := "com.ossuminc.riddl.utils",
buildInfoObject := "RiddlBuildInfo",
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "2.8.0",
"io.github.cquiroz" %%% "scala-java-time" % "2.6.0",
"org.scalactic" %%% "scalactic" % V.scalatest % Test,
"org.scalatest" %%% "scalatest" % V.scalatest % Test
)
)
.nativeConfigure(
With.native(
mode = "fast",
buildTarget = "static",
linkOptions = Seq(
"-I/usr/include",
"-I/usr/local/opt/curl/include",
"-I/opt/homebrew/opt/curl/include"
)
)
)
.nativeConfigure(
With.build_info_plus_keys(
"scalaNativeVersion" -> scalanative.sbtplugin.ScalaNativePlugin.autoImport.nativeVersion
)
)
.nativeSettings(
buildInfoPackage := "com.ossuminc.riddl.utils",
buildInfoObject := "RiddlBuildInfo",
libraryDependencies ++= Seq(
"com.softwaremill.sttp.client4" %%% "core" % V.sttp,
"org.scala-native" %%% "java-net-url-stubs" % "1.0.0",
"io.github.cquiroz" %%% "scala-java-time" % "2.6.0",
"org.scalactic" %%% "scalactic" % V.scalatest % Test,
"org.scalatest" %%% "scalatest" % V.scalatest % Test
)
)
lazy val utils = utils_cp.jvm
lazy val utilsJS = utils_cp.js
lazy val utilsNative = utils_cp.native
val Language = config("language")
lazy val language_cp: CrossProject = CrossModule("language", "riddl-language")(JVM, JS, Native)
.dependsOn(cpDep(utils_cp))
.configure(With.GithubPublishing)
.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.MiMa("0.57.0"))
.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.noMiMa)
.jsSettings(
libraryDependencies += "com.lihaoyi" %%% "fastparse" % V.fastparse,
libraryDependencies += "org.wvlet.airframe" %%% "airframe-ulid" % V.airframe_ulid
)
.nativeConfigure(
With.native(
mode = "fast",
buildTarget = "static",
linkOptions = Seq(
"-I/usr/include",
"-I/usr/local/opt/curl/include",
"-I/opt/homebrew/opt/curl/include"
)
)
)
.nativeConfigure(With.noMiMa)
.nativeSettings(
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "fastparse" % V.fastparse,
"org.wvlet.airframe" %%% "airframe-ulid" % V.airframe_ulid,
"org.scalactic" %%% "scalactic" % V.scalatest % Test,
"org.scalatest" %%% "scalatest" % V.scalatest % Test
)
)
lazy val language = language_cp.jvm.dependsOn(utils)
lazy val languageJS = language_cp.js.dependsOn(utilsJS)
lazy val languageNative = language_cp.native.dependsOn(utilsNative)
val Passes = config("passes")
lazy val passes_cp = CrossModule("passes", "riddl-passes")(JVM, JS, Native)
.dependsOn(cpDep(utils_cp), cpDep(language_cp))
.configure(With.GithubPublishing)
.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.57.0"))
.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.noMiMa)
.nativeConfigure(With.native(mode = "fast"))
.nativeConfigure(With.noMiMa)
val passes = passes_cp.jvm
val passesJS = passes_cp.js
val passesNative = passes_cp.native
lazy val testkit_cp = CrossModule("testkit", "riddl-testkit")(JVM, JS, Native)
.configure(With.GithubPublishing)
.configure(With.typical, 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
)
)
.jvmConfigure(With.MiMa("0.57.0"))
.jsConfigure(With.js("RIDDL: language", withCommonJSModule = true))
.jsConfigure(With.noMiMa)
.jsSettings(
// scalacOptions ++= Seq("-rewrite", "-source", "3.4-migration"),
libraryDependencies ++= Seq(
"org.scalactic" %%% "scalactic" % V.scalatest,
"org.scalatest" %%% "scalatest" % V.scalatest
)
)
.nativeConfigure(With.noMiMa)
.nativeConfigure(With.native(mode = "fast"))
.nativeSettings(
evictionErrorLevel := sbt.util.Level.Warn,
libraryDependencies ++= Seq(
"org.scalactic" %%% "scalactic" % V.scalatest,
"org.scalatest" %%% "scalatest" % V.scalatest
)
)
val testkit = testkit_cp.jvm
val testkitJS = testkit_cp.js
val testkitNative = testkit_cp.native
val Diagrams = config("diagrams")
lazy val diagrams_cp: CrossProject = CrossModule("diagrams", "riddl-diagrams")(JVM, JS, Native)
.dependsOn(cpDep(utils_cp), cpDep(language_cp), cpDep(passes_cp))
.configure(With.GithubPublishing)
.configure(With.typical, 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.57.0"))
.jvmSettings(coverageExcludedFiles := """<empty>;$anon""")
.jsConfigure(With.js("RIDDL: diagrams", withCommonJSModule = true))
.jsConfigure(With.noMiMa)
.nativeConfigure(With.native(mode = "fast"))
.nativeConfigure(With.noMiMa)
val diagrams = diagrams_cp.jvm
val diagramsJS = diagrams_cp.js
val diagramsNative = diagrams_cp.native
lazy val riddlLib_cp: CrossProject = CrossModule("riddlLib", "riddl-lib")(JS, JVM, Native)
.dependsOn(
cpDep(utils_cp),
cpDep(language_cp),
cpDep(passes_cp),
cpDep(diagrams_cp)
)
.configure(With.GithubPublishing)
.configure(With.typical)
.settings(
description := "Bundling of essential RIDDL libraries"
)
.jvmConfigure(With.coverage(50))
.jvmConfigure(With.MiMa("0.57.0"))
.jvmConfigure(
With.packagingUniversal(
maintainerEmail = "[email protected]",
pkgName = "riddlLib",
pkgSummary = "Library for RIDDL language, Universal packaging",
pkgDescription = ""
)
)
.jvmSettings(
coverageExcludedFiles := """<empty>;$anon"""
)
.jsConfigure(With.js("RIDDL: diagrams", withCommonJSModule = true))
.jsConfigure(With.noMiMa)
.nativeConfigure(With.native(mode = "fast", buildTarget = "static"))
.nativeConfigure(With.noMiMa)
val riddlLib = riddlLib_cp.jvm
val riddlLibJS = riddlLib_cp.js
val riddlLibNative = riddlLib_cp.native
val Commands = config("commands")
lazy val commands_cp: CrossProject = CrossModule("commands", "riddl-commands")(JVM, Native)
.dependsOn(cpDep(utils_cp), cpDep(language_cp), cpDep(passes_cp), cpDep(diagrams_cp))
.configure(With.typical, With.headerLicense("Apache-2.0"))
.configure(With.GithubPublishing)
.settings(
scalacOptions ++= Seq("-explain", "--explain-types", "--explain-cyclic", "--no-warnings"),
description := "RIDDL Command Infrastructure and command definitions"
)
.jvmConfigure(With.coverage(50))
.jvmConfigure(With.MiMa("0.57.0"))
.jvmSettings(
libraryDependencies ++= Seq(Dep.scopt, Dep.sconfig),
libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided",
coverageExcludedFiles := """<empty>;$anon"""
)
// .jsConfigure(With.js("RIDDL: diagrams", withCommonJSModule = true))
// .jsConfigure(With.noMiMa)
// .jsSettings(
// libraryDependencies ++= Seq(
// "com.github.scopt" %%% "scopt" % V.scopt,
// "org.ekrich" %%% "sconfig" % V.sconfig
// )
// )
.nativeConfigure(With.native(mode = "fast"))
.nativeConfigure(With.noMiMa)
.nativeSettings(
libraryDependencies ++= Seq(
"com.github.scopt" %%% "scopt" % V.scopt,
"org.ekrich" %%% "sconfig" % V.sconfig
)
)
val commands: Project = commands_cp.jvm
val commandsNative = riddlLib_cp.native
val Riddlc = config("riddlc")
lazy val riddlc_cp: CrossProject = CrossModule("riddlc", "riddlc")(JVM, Native)
.configure(With.GithubPublishing)
.configure(With.typical, With.headerLicense("Apache-2.0"))
.configure(With.coverage(50.0))
.configure(With.noMiMa)
.dependsOn(cpDep(utils_cp), cpDep(language_cp), cpDep(passes_cp), cpDep(commands_cp))
.settings(
description := "The `riddlc` compiler and tests, the only executable in RIDDL",
maintainer := "[email protected]",
mainClass := Option("com.ossuminc.riddl.RIDDLC")
)
.jvmConfigure(With.coverage(50))
.jvmConfigure(
With.packagingUniversal(
maintainerEmail = "[email protected]",
pkgName = "riddlc",
pkgSummary = "Compiler for RIDDL language, Universal packaging",
pkgDescription = ""
)
)
.jvmSettings(
coverageExcludedFiles := """<empty>;$anon""",
coverallsTokenFile := Some("/home/reid/.coveralls.yml"),
libraryDependencies ++= Seq(Dep.sconfig)
)
.nativeConfigure(With.native(mode = "fast", buildTarget = "application"))
.nativeConfigure(With.noMiMa)
.nativeSettings(
libraryDependencies += "org.ekrich" %%% "sconfig" % V.sconfig
)
val riddlc = riddlc_cp.jvm
val riddlcNative = riddlc_cp.native
lazy val docProjects = List(
(utils, Utils),
(language, Language),
(passes, Passes),
(diagrams, Diagrams),
(commands, Commands),
(riddlc, Riddlc)
)
lazy val docOutput: File = file("doc") / "src" / "main" / "hugo" / "static" / "apidoc"
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, commands),
logoPath = Some("doc/src/main/hugo/static/images/RIDDL-Logo-128x128.png")
)
.dependsOn(utils, language, passes, diagrams, commands)
.configure(With.noMiMa)
.configure(With.GithubPublishing)
.settings(
name := "riddl-doc",
description := "Generation of the documentation web site",
libraryDependencies ++= Dep.testing
)
lazy val plugin = Plugin("sbt-riddl")
.configure(With.GithubPublishing)
.configure(With.build_info, With.scala2, With.noMiMa)
.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"
)
addCommandAlias(
"cJVM",
"; utils/Test/compile ; language/Test/compile ; passes/Test/compile; testkit/Test/compile ; " +
"diagrams/Test/compile ; commands/Test/compile ; riddlLib/Test/compile ; riddlc/Test/compile"
)
addCommandAlias(
"cNative",
"; utilsNative/Test/compile ; languageNative/Test/compile ; passesNative/Test/compile ; " +
"testkitNative/Test/compile ; diagramsNative/Test/compile ; commandsNative/Test/compile ; " +
"riddlLibNative/Test/compile ; riddlcNative/Test/compile"
)
addCommandAlias(
"cJS",
"; utilsJS/Test/compile ; languageJS/Test/compile ; passesJS/Test/compile ; " +
"testkitJS/Test/compile ; diagramsJS/Test/compile ; riddlLibJS/Test/compile"
)
addCommandAlias(
"tJVM",
"; utils/test ; language/test ; passes/test ; testkit/test ; diagrams/test ; commands/test ; " +
"riddlLib/test ; riddlc/test"
)
addCommandAlias(
"tNative",
"; utils/test ; language/test ; passesNative/test ; testkit/test ; diagrams/test ; " +
"commands/test ; riddlLib/test ; riddlcNative/test ; riddlcNative/nativeLink"
)
addCommandAlias(
"tJS",
"; utilsJS/test ; languageJS/test ; passesJS/test ; testkitJS/test ; diagramsJS/test ; " +
"riddlLibJS/test"
)
addCommandAlias(
"packageArtifacts",
"; riddlc/Universal/packageBin " +
"; riddlcNative/nativeLink " +
"; riddlLibJS/fullLinkJS" +
"; riddlLibNative/nativeLink" +
"; riddlLib/Universal/packageBin"
)