-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sbt
More file actions
44 lines (40 loc) · 1.36 KB
/
build.sbt
File metadata and controls
44 lines (40 loc) · 1.36 KB
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
// build.sbt
lazy val developers: List[Developer] = List(
Developer(
id = "reid-spencer",
"Reid Spencer",
"reid.spencer@ossuminc.com",
url("https://github.com/reid-spencer")
)
)
lazy val extractGrammar = taskKey[Unit]("Extract RIDDL grammar via Grammar API")
lazy val root = Root(
ghRepoName = "ossum-tech",
ghOrgName = "ossuminc",
startYr = 2025,
devs = developers
).configure(
With.Scala3.configure(version = Some("3.7.4")),
With.Riddl.library(version = "1.20.0", nonJVMDependency = false)
).settings(
resolvers += "GitHub Package Registry" at "https://maven.pkg.github.com/ossuminc/riddl",
// Extract RIDDL grammar by compiling and running ExtractGrammar
extractGrammar := {
(Compile / compile).value
val log = streams.value.log
val cp = (Runtime / fullClasspathAsJars).value
.map(_.data.getAbsolutePath)
.mkString(java.io.File.pathSeparator)
val target = baseDirectory.value / "docs" / "riddl" / "references" / "riddl-grammar.ebnf"
val script = baseDirectory.value / "tools" / "extract-grammar.sh"
log.info("Extracting RIDDL grammar...")
val exitCode = scala.sys.process.Process(
Seq("bash", script.getAbsolutePath, target.getAbsolutePath),
baseDirectory.value,
"CLASSPATH" -> cp
).!
if (exitCode != 0) {
throw new MessageOnlyException("Grammar extraction failed")
}
}
)