Migrate Avro integration to IR extension architecture#680
Merged
Conversation
…e (IR mode) Replace the Java/Kotlin Avro LanguageEmitters with one AvroExtension (IrExtension) that appends an <Type>Avro schema/converter file per record and enum. It detects the target language from the IR and renders Java or Kotlin source accordingly, reusing the existing emitter rendering helpers. Wire the maven-spring-avro example to run the Java IR emitter in IR mode with the extension (languages/ir/extensionClasses), and update the example service/test to the new Sender channel API. Update the Avro integration and plugin-architecture docs to match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SsK267uB3Ybm7UNXLT4aLs
… templates Replace the per-language multi-line code templates in AvroExtension with the IR DSL: the file/package/import/namespace and from/to method structure is now built from IR nodes (file, namespace, function, ConstructorStatement, assign, returns) and rendered idiomatically by the Java and Kotlin generators (Java interface with static methods; Kotlin object). Only the irreducibly language-specific leaves stay as code strings: the SCHEMA field initializer, the record constructor, and the per-field conversion expressions (casts, streams vs map, byte handling). Update the extension unit-test fixtures to the regenerated output. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SsK267uB3Ybm7UNXLT4aLs
…Listener - JavaIrTransformer: keep the fully-qualified channel reference as a single Name part so `Name.of` no longer splits it on dots and pascalCases the segments (com.example.model.Foo -> ComExampleModelFoo), which broke the generated channel Sender/Listener signatures and the maven-spring-avro example compile. - AvroExtension: select the Java/Kotlin source from a `language: FileExtension` constructor parameter (mirrors SpringNativeHintsExtension) instead of sniffing the IR. Maven and Gradle plugins inject the emitter's FileExtension per language. - maven-spring-avro example: AvroExampleService now implements both TestAvroRecord.Sender and TestAvroRecord.Listener. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SsK267uB3Ybm7UNXLT4aLs
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Refactors the Avro integration from standalone emitters (
AvroJavaEmitter,AvroKotlinEmitter) to a unifiedIrExtensionthat works with both Java and Kotlin IR emitters. This aligns with the Wirespec IR pipeline architecture and simplifies configuration.Key Changes
Removed: Language-specific emitter classes
src/integration/avro/src/jvmMain/kotlin/community/flock/wirespec/integration/avro/java/emit/AvroEmitter.ktsrc/integration/avro/src/jvmMain/kotlin/community/flock/wirespec/integration/avro/kotlin/emit/AvroEmitter.ktAvroJavaEmitterTest.kt,AvroKotlinEmitterTest.kt)Added: Unified IR extension
AvroExtensionclass that implementsIrExtensionand detects the target language (Java/Kotlin) from the IRJavaAvroSource,KotlinAvroSource) that produce<Type>Avroconverter classesAvroExtensionTestwith comprehensive test coverage for both Java and Kotlin outputUpdated: Documentation and examples
extensionClassesmaven-spring-avroexample to demonstrate the new IR-based approachHow It Works
The
AvroExtensionregisters on a Java or KotlinIrEmitterrunning in IR mode. It:TypeandEnumdefinition, generates a corresponding<Type>Avroclass in the<package>.avrosub-packageThis approach eliminates the need for separate emitter classes and allows a single extension to support multiple languages through language detection.
Type of Change
Checklist
Breaking Changes
Configuration Migration Required: Projects using the old Avro emitters must update their plugin configuration:
Before (Maven):
After (Maven):
Similar changes apply to Gradle configurations (see updated examples).
https://claude.ai/code/session_01SsK267uB3Ybm7UNXLT4aLs