https://github.com/stackgenhq/flatgraph-codegen-gradle
https://github.com/stackgenhq/flatgraph-codegen-gradle
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/stackgenhq/flatgraph-codegen-gradle
- Owner: stackgenhq
- License: mit
- Created: 2025-02-12T15:25:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-13T02:28:11.000Z (over 1 year ago)
- Last Synced: 2025-02-13T03:25:40.257Z (over 1 year ago)
- Language: Kotlin
- Size: 64.5 KB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Flatgraph Codegen Gradle
A Gradle version of the Flatgraph codegen sbt plugin
## Usage
Configure the task in your `build.gradle.kts`, eg:
```kotlin
tasks.named("generateDomainClasses") {
classWithSchema = "CpgExtSchema$"
fieldName = "instance"
outputDirectory = file("build/generated/flatgraph/main/scala")
}
```
...where your `src/main/scala` directory contains the `CpgExtSchema` object with the `instance` field containing any
desired schema extensions.
```scala
import flatgraph.schema.SchemaBuilder
import flatgraph.schema.Property.ValueType
import io.shiftleft.codepropertygraph.schema.CpgSchema
class CpgExtSchema(builder: SchemaBuilder, cpgSchema: CpgSchema) {
// Add node types, edge types, and properties here
val myProperty = builder
.addProperty(name = "MYPROPERTY", valueType = ValueType.String)
.mandatory("")
val myNodeType = builder
.addNodeType("MYNODETYPE")
.addProperty(myProperty)
}
object CpgExtSchema {
val builder = new SchemaBuilder(domainShortName = "Cpg", basePackage = "flatgraph.generated")
val cpgSchema = new CpgSchema(builder)
val cpgExtSchema = new CpgExtSchema(builder, cpgSchema)
val instance = builder.build
}
```
See also [example](example/build.gradle.kts)
## Contributing
Please read [CONTRIBUTING.md](.github/CONTRIBUTING.md) for details on contributing and our code of conduct.