The Gradle plugin runs the schema engine as part of your build and owns two output trees: generated sources and a discovery resource. This page is the reference for that machinery; for the end-to-end setup, start at the quickstart.
The generator block#
A Kotlin generator block sets four things the other languages don't need:
generator kotlinSdk {
language = "kotlin"
output = "../build/generated/sources/repost/kotlinSdk/kotlin"
resourceOutput = "../build/generated/resources/repost/kotlinSdk"
packageName = "com.example.repost"
clientName = "RepostClient"
}| Field | What it owns |
|---|---|
output | The source root. Generated .kt files land under the packageName subdirectory. Repost owns this tree: it replaces its own files atomically and never touches anything else. |
resourceOutput | The resource root. One client.json registry per client is written to META-INF/repost/generated-clients/v1/<id>/ here, so a framework or the aggregator can discover the client at build time. |
packageName | The Kotlin package for the generated models, Webhooks tree, and client. |
clientName | The generated client class name. Pick a distinct name per schema when a build hosts more than one. |
Source and resources are one transaction: a regeneration replaces both together or restores the previous tree. A crash never leaves a half-written client or a stale registry. Point output/resourceOutput at build/ directories (as above); they are regenerated, not committed.
The engine#
The plugin resolves and runs a signed, platform-specific schema engine (sh.repost:repost-schema-engine:0.9.0), with nothing else to install. Pin a different engine build with repostSdk { engineVersion.set("…") }; its checksum and signature are verified before it runs. The generated code emits Kotlin language/API 2.1, so it compiles on the 2.1 baseline and every newer compiler.
Generate and check#
The plugin binds repostGenerate before compileKotlin, so a normal build already has your client, and wires repostGenerateCheck into check:
./gradlew repostGeneraterepostGenerateCheck regenerates into an isolated directory, hashes the result, and fails if it differs from the committed output without writing to your source tree, the CI gate that proves generated code is in sync. The repost CLI produces the identical tree from the same schema.
GENERATE versus multi-module AGGREGATE_ONLY#
Every module runs in one of two modes (repostSdk { schemaMode.set(...) }; default GENERATE):
GENERATE: run the engine on this module's schema, emit the client and its registry, and aggregate any client registries found on the compile classpath. A single-module app or a schema library uses this.AGGREGATE_ONLY: run no engine and generate no client. Only merge the registries published by dependency modules into one application registry. An application module that consumes clients from several schema libraries uses this so it never regenerates code it doesn't own.
import sh.repost.gradle.RepostSchemaMode
import sh.repost.gradle.RepostIntegration
repostSdk {
schemaMode.set(RepostSchemaMode.AGGREGATE_ONLY)
integration.set(RepostIntegration.SPRING_BOOT)
}