跳到主要内容

KSP Modules

自动收集自 lib/ksp/README.md

lib/ksp no longer follows a universal plugin-first rule.

  • Keep a published consumer plugin only when the consumer side needs companion dependencies, extra processors, compileOnly injection, or other non-trivial wiring.
  • If a processor is just a single artifact with no companion wiring, use raw KSP directly.
  • Policy details live in ../../docs/ksp-gradle-plugin-policy.md.

Retained Consumer Plugins

These remain the official plugin-first entrypoints:

Plugin idProcessor artifactAuto wiring
site.addzero.ksp.compose-propscompose-props-processorcompose-props-annotations
site.addzero.ksp.gen-reifiedgen-reified-processorgen-reified-core
site.addzero.ksp.iocioc-processorioc-core
site.addzero.ksp.jimmer-entity-externaljimmer-entity-external-processorSPI subprocessors entity2iso, entity2form, entity2mcp
site.addzero.ksp.ksp-dsl-builderksp-dsl-builder-processorksp-dsl-builder-core
site.addzero.ksp.method-semanticizermethod-semanticizer-processormethod-semanticizer-api
site.addzero.ksp.multireceivermultireceiver-processorkcp-multireceiver-annotations
site.addzero.ksp.singleton-adaptersingleton-adapter-processorsingleton-adapter-api
site.addzero.ksp.spring2ktor-serverspring2ktor-server-processorspring2ktor-server-core and compileOnly("org.springframework:spring-web")
site.addzero.ksp.routeroute-processorroute-core

All retained consumer plugins are implemented as precompiled script plugins under .gradle.kts, not .kt implementationClass entrypoints.

Local Composite Build Flow

For retained consumer plugins, keep the consumer entrypoint as a precompiled script plugin and make sure the build logic stays easy to audit in-repo.

  • Use repo-visible generated build logic only when it truly reduces maintenance and still leaves one clear source of truth.
  • If the generated route starts turning a processor module into a second plugin authoring hub, prefer folding back to hand-written precompiled scripts.
  • Either way, downstream users should only apply the retained plugin and configure its typed extension.

This keeps local build logic small without leaking internal processor/module structure to consumers.

Raw-Only Processors

These processors no longer have sibling consumer plugins:

  • jdbc2controller-processor
  • jdbc2entity-processor
  • jdbc2enum-processor
  • controller2api-processor
  • controller2feign-processor
  • controller2iso2dataprovider-processor
  • enum-processor
  • modbus-ksp

See each processor README for the raw option keys that now replace the old typed plugin DSL.

Raw KMP Usage

For a KMP-declared processor with no companion wiring, prefer:

plugins {
kotlin("multiplatform")
id("com.google.devtools.ksp")
}

kotlin {
jvm()
sourceSets.getByName("commonMain").kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
sourceSets.getByName("jvmMain").kotlin.srcDir("build/generated/ksp/jvm/jvmMain/kotlin")
}

dependencies {
kspCommonMainMetadata("site.addzero:controller2api-processor:VERSION")
}

ksp {
arg("apiClientPackageName", "demo.generated.api")
arg("apiClientAggregatorObjectName", "Apis")
arg("apiClientAggregatorStyle", "koin")
arg("apiClientAggregatorOutputDir", "/tmp/generated/apis")
arg("apiClientOutputDir", "/tmp/generated/clients")
}

For JVM-only processors, use ksp(...) or kspJvm(...) instead of forcing a consumer plugin that adds no value.

Non-Matrix Items

  • logger stays as a demo/sample KSP group and is intentionally outside the official retained-plugin matrix.
  • entity2iso, entity2form, and entity2mcp stay SPI-only.
  • lib/openapi-codegen is tracked as a repo-scan outlier and is not part of the lib/ksp keep/drop migration set.

Maven / Gradle

已发布至 Maven Central。

implementation("site.addzero:ksp:latest version")
<dependency>
<groupId>site.addzero</groupId>
<artifactId>ksp</artifactId>
<version>latest version</version>
</dependency>