CodeGen Navigation Routing

Rough POC for using Kotlin Poet to codegen interfaces for Navigation Routes with annotation processing

This will generate the SAM interfaces only, as part of the build process


  • Provides annotations to setup specific navigation routes, or auto routing when no additional arguments are required, which generates an interface, an implementation and a dagger module binding, then moves the interfaces into a shared module by location & namespace to be shared across different gradle module
  • Determines the method name passed on the return type
  • Uses return type reference exactly, so not need for reflection of acceptable types
  • Creates a Dagger module for binding implementations to the respective navigation interfaces
  • Provides an AutoRoute annotation to create a default route interface and interface to reference the current class
  • Provides a convention plugin for navigation routing to provide options ie where to place interfaces, route name suffix, etc.

Annotations:

Processors:

Generators:

Examples:

TODO:

  • Detect when more than one method is going to be generated from a class, and change from a SAM interface to one which has methods for all routes
  • Cleanup KPoet classes
  • Reduce, simplify, document