Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions codegen/src/main/scala/overflowdb/codegen/CodeGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,29 @@ class CodeGen(schema: Schema) {
val srcFile = nodeType.className + ".scala"
results.append(baseDir.createChild(srcFile).write(src))
}


val packageObject = {
val lastSeparatorIdx = basePackage.lastIndexOf('.')
val packageParent = basePackage.take(lastSeparatorIdx)
val packageSimpleName = basePackage.drop(lastSeparatorIdx + 1)

s"""package $packageParent
|
|package object $packageSimpleName {
| // some type aliases so that the domain-specific code can avoid referencing the `overflowdb` namespace
| type DiffGraphBuilder = _root_.overflowdb.BatchedUpdate.DiffGraphBuilder
|
| object help {
| type Doc = _root_.overflowdb.traversal.help.Doc
| type Traversal = _root_.overflowdb.traversal.help.Traversal
| type TraversalSource = _root_.overflowdb.traversal.help.TraversalSource
| }
|}
|""".stripMargin
}
results.append(baseDir.createChild("package.scala").write(packageObject))

results.toSeq
}

Expand Down