Skip to content

Commit b14f318

Browse files
mpollmeierclaude
andauthored
Wire generateDomainClasses into sbt stage; document in README (#1858)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3021531 commit b14f318

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,25 @@ Additional build-time dependencies are automatically downloaded as
4747
part of the build process. To build and install into your local Maven
4848
cache, issue the command `sbt clean test publishM2`.
4949

50+
# Domain class generation
51+
52+
The Scala domain classes under `domainClasses/src/main/generated/` are generated from the schema defined in `schema/src/main/scala/io/shiftleft/codepropertygraph/schema/`. They are checked into the repository, so you only need to regenerate them when the schema changes.
53+
54+
Generation is handled by the `sbt-flatgraph` plugin via the `generateDomainClasses` task in the `schema` subproject. It reads `CpgSchema.instance`, which composes all schema modules, and writes Scala source files to `domainClasses/src/main/generated/`.
55+
56+
The task is wired as a dependency of `domainClasses/compile` and `stage`, so it runs automatically when you compile or stage:
57+
58+
```
59+
sbt compile # triggers generateDomainClasses, then compiles
60+
sbt stage # triggers generateDomainClasses, then packages
61+
```
62+
63+
To run generation on its own:
64+
65+
```
66+
sbt schema/generateDomainClasses
67+
```
68+
5069
# Code style
5170

5271
Code style is automatically verified by [scalafmt](https://github.com/scalameta/scalafmt)

schema2json/build.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ Test / fork := true
1414
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v")
1515

1616
enablePlugins(JavaAppPackaging)
17+
18+
stage := stage.dependsOn(Projects.schema / Compile / generateDomainClasses).value

0 commit comments

Comments
 (0)