SchemaExtractionMain

The program the Gradle serialkompatExtract task launches on the target project's runtime classpath (design §4). Running on that classpath is what lets it Class.forName the project's @Serializable types, obtain their real compiled serializers, and walk the descriptors at highest fidelity.

It resolves each named type to a serializer, extracts a com.chrisjenx.serialkompat.core.Snapshot, and writes the canonical text form to a file for the check to consume.

Properties

Link copied to clipboard

Classpath manifest of discovered @Serializable FQNs, one per line (blank lines and # comments ignored). This is a producer-agnostic contract: the file may be authored by hand or emitted by a build-time discovery step. The extractor's own class-dir scan (SerializableClassScanner, issue #55) is the automated producer; KSP is explicitly not used (#22).

Functions

Link copied to clipboard
fun discoverTypeNames(loader: ClassLoader = Thread.currentThread().contextClassLoader ?: SchemaExtractionMain::class.java.classLoader): List<String>

Reads discovered @Serializable type names from every TYPES_RESOURCE on loader's classpath, ignoring blank lines and # comments; sorted + deduped.

Link copied to clipboard

CLI shim: --types a,b,c | --scan-classes dir1:dir2 --out path [--json fqn] [--discovery explicit|opt-out|opt-in]. Requires at least one of: --types, --scan-classes, or a non-explicit --discovery (which falls back to the classpath manifest, TYPES_RESOURCE). --scan-classes takes File.pathSeparator-separated class directories.

Link copied to clipboard
fun run(typeNames: List<String>, jsonInstanceFqn: String?, output: File, scanDirs: List<File> = emptyList(), discovery: DiscoveryMode = DiscoveryMode.EXPLICIT)

Extracts typeNames (fully-qualified @Serializable class names) into a snapshot written to output. If jsonInstanceFqn is set, that Json instance's configuration and module are read, and failing to load it throws (the check would otherwise run under the wrong config). If it is null, the default Json config is assumed (design §6 resolution order).