Skip to content

Enable code generation for Drifter modules with KSP plugin#16

Merged
teogor merged 1 commit intomainfrom
feature/drifter-annotation-processor
Feb 24, 2024
Merged

Enable code generation for Drifter modules with KSP plugin#16
teogor merged 1 commit intomainfrom
feature/drifter-annotation-processor

Conversation

@teogor
Copy link
Copy Markdown
Owner

@teogor teogor commented Feb 24, 2024

Auto-generate Kotlin Classes for Drifter Interaction via Annotations

This pull request introduces a powerful new feature: automatic generation of Kotlin classes based on specific annotations within your code. This significantly simplifies interaction with Drifter and streamlines development.

Changes:

  • Implements KSP (Kotlin Symbol Processor) and runtime modules for code generation.
  • Generates Kotlin classes representing Drifter modules and methods based on annotations like @DrifterModule and @DrifterUnityMethod.
  • Automatically handles parameter mapping and data conversion through annotations and custom encoders.

Generated Classes (Examples):

  • AquariumModule: Represents the "Aquarium" Drifter module with properties and methods based on annotations in dev.teogor.drifter.demo package.
  • AquariumMethods: Interface providing methods based on @DrifterUnityMethod annotations.
  • AquariumActionMappings: Static class with utility methods and constants for interacting with generated classes.
  • AquariumMessageSender: Class simplifying communication with the "Aquarium" module in Unity.

Benefits:

  • Reduced boilerplate code: Eliminates the need for manual class creation and mapping configurations.
  • Improved maintainability: Ensures consistency and reduces potential errors in manually written code.
  • Enhanced developer experience: Simplifies Drifter interaction and makes it more approachable.

@teogor teogor added @priority-medium @feature New feature or request labels Feb 24, 2024
@teogor teogor added this to the 1.0.0-alpha02 milestone Feb 24, 2024
@teogor teogor self-assigned this Feb 24, 2024
@teogor teogor merged commit 6152451 into main Feb 24, 2024
@zeobot zeobot Bot deleted the feature/drifter-annotation-processor branch February 24, 2024 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@feature New feature or request @priority-medium

Projects

Development

Successfully merging this pull request may close these issues.

1 participant