-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sbt
394 lines (375 loc) · 14.5 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
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 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, 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.typical, With.headerLicense("Apache-2.0"))
.configure(With.publishing)
.settings(
scalacOptions += "-explain-cyclic",
description := "Various utilities used throughout riddl libraries"
)
.jvmConfigure(With.coverage(70))
.jvmConfigure(With.build_info)
.jvmConfigure(With.MiMa("0.52.1", 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"))
.nativeConfigure(
With.build_info_plus_keys(
"scalaNativeVersion" -> scalanative.sbtplugin.ScalaNativePlugin.autoImport.nativeVersion
)
)
.nativeSettings(
buildInfoPackage := "com.ossuminc.riddl.utils",
buildInfoObject := "RiddlBuildInfo",
libraryDependencies ++= Seq(
"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.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.noMiMa)
.jsSettings(
libraryDependencies += "com.lihaoyi" %%% "fastparse" % V.fastparse,
libraryDependencies += "org.wvlet.airframe" %%% "airframe-ulid" % V.airframe_ulid
)
.nativeConfigure(With.native(mode = "fast"))
.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.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.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.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
)
)
.jvmConfigure(With.MiMa("0.52.1"))
.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.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.52.1"))
.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
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"))
.settings(
description := "RIDDL Command Infrastructure and command definitions"
)
.jvmConfigure(With.coverage(50))
.jvmConfigure(With.MiMa("0.52.1"))
.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 commandsJS: Project = commands_cp.js
val commandsNative = riddlLib_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)) /*, cpDep(commands_cp) */
.configure(With.typical)
.settings(
description := "Bundling of essential RIDDL libraries"
)
.jvmConfigure(With.coverage(50))
.jvmConfigure(With.MiMa("0.52.1"))
.jvmSettings(
coverageExcludedFiles := """<empty>;$anon"""
)
.jsConfigure(With.js("RIDDL: diagrams", withCommonJSModule = true))
.jsConfigure(With.noMiMa)
.nativeConfigure(With.native(mode = "fast"))
.nativeConfigure(With.noMiMa)
val riddlLib = riddlLib_cp.jvm
val riddlLibJS = riddlLib_cp.js
val riddlLibNative = riddlLib_cp.native
val Riddlc = config("riddlc")
lazy val riddlc_cp: CrossProject = CrossModule("riddlc", "riddlc")(JVM, Native)
.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")
// graalVMNativeImageOptions ++= Seq(
// "--verbose",
// "--no-fallback",
// "--native-image-info",
// "--enable-url-protocols=https,http",
// "-H:ResourceConfigurationFiles=../../src/native-image.resources"
// ),
)
.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"
//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, 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, 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"
)