wspb generates .proto schemas and Protobuf lite sources from Kotlin models by combining an annotation, a KSP processor, and an Android Gradle plugin.
Kotlin model -> @WSProto -> KSP .proto generation -> Android proto source wiring -> protoc Java lite sources
wspb-annotation: defines@WSProtowspb-processor: KSP processor that generates.protofileswspb-gradle-plugin: Android Gradle plugin that wires generated proto directories into the buildsample-app: example consumer app for integration verification
These are the coordinates intended for published releases:
dependencies {
implementation("io.github.ows3090:wspb-annotation:1.0.1")
ksp("io.github.ows3090:wspb-processor:1.0.1")
}plugins {
id("io.github.ows3090.wspb.proto") version "1.0.1"
}The example below shows the intended public-consumer setup after the first release is published.
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.devtools.ksp")
id("io.github.ows3090.wspb.proto") version "1.0.1"
}
dependencies {
implementation("io.github.ows3090:wspb-annotation:1.0.1")
ksp("io.github.ows3090:wspb-processor:1.0.1")
}import com.wonseok.wspb.annotation.WSProto
@WSProto(name = "user_preference")
data class UserData(
val id: Int,
val name: String,
)ksp {
arg("wspb.proto.packagePath", "proto/com/example/schema")
arg("wspb.proto.javaPackage", "com.example.schema")
arg("wspb.processor.verbose", "true")
}wspb.proto.packagePath: output subdirectory for generated.protofileswspb.proto.javaPackage:option java_packagewritten into generated.protofileswspb.processor.verbose: enables processor warning logs
Default values:
wspb.proto.packagePath = proto/com/wonseok/wspbwspb.proto.javaPackage = com.wonseok.wspbwspb.processor.verbose = false
Current repo baseline:
- JDK 21
- Kotlin 2.0.21
- KSP 2.0.21-1.0.27
- AGP 8.13.1
These are the versions currently validated in this repository. A broader compatibility policy will be documented after the first public release.
- Supported field types are limited to primitives,
String,ByteArray,List,Set, andArray - Custom classes, enums, and nullable-specific mapping are not yet supported
- The generated proto path defaults to the repository package unless overridden with KSP options
Inside this repository, the safest verification flow is:
./gradlew :wspb-gradle-plugin:publishToMavenLocal --configure-on-demand
./gradlew :sample-app:assembleDebug
./gradlew :wspb-processor:test
./gradlew spotlessCheck
./gradlew lint