hollow icon indicating copy to clipboard operation
hollow copied to clipboard

Avoid import conflicts for generated API

Open DanielThomas opened this issue 7 years ago • 1 comments

The generated API shadows the concrete class names in the model, which causes import confusion and the need for full qualified class references when dealing with legacy code that contains both views of the model.

  • Support adding a prefix/suffix to generated classes to differentiate them
  • Consider support in examples/codegen for producing two model artifacts, say <project>-model and <project>-model-producer so for 'pure' Hollow projects it's possible to avoid leaking the concrete model to consumers at all

DanielThomas avatar Oct 09 '18 21:10 DanielThomas

I ended up splitting our project into two halves - the producer pieces are runtime only in downstream projects, and are wired at runtime, so we don't have import ambiguity in the projects where we're using the generated model.

I created a separate consumer-model project and had it depend on compileOnly ':model'.

DanielThomas avatar Oct 22 '18 23:10 DanielThomas