Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple code gen API from apt and kotlin-metadata #816

Open
wants to merge 11 commits into
base: master
from

Conversation

@ZacSweers
Copy link
Collaborator

commented Feb 25, 2019

This is a proposal implementation to decouple the code gen API from both annotation processing and kotlin-metadata APIs.

The idea here is that this separation allows for the implementation of data for the code gen to be an implementation detail, and thus allows the code gen to be reusable for different front-ends. Right now it's heavily coupled to annotation processing + kotlin-metadata, but we could conceivably easily implement new support for things like

  • kotlinx-metadata (or its value-based alternative)
  • Compiler plugins
  • Non-apt environments

etc. with KotlinPoet being the common foundation in the API for all of them.

At the time of writing, this PR is mostly about separating out API pieces, but not much has been put into the actual design of an API that anything other than APT can use. This also leans on a proposal PR in KotlinPoet to function: square/kotlinpoet#633. As such, CI will fail here, but all the tests pass locally for me with no changes currently.

@ZacSweers ZacSweers requested a review from swankjesse Feb 25, 2019

val annotationHolder = annotationHolders[name]
// Used for setter/getter/is lookups. Guaranteed to be safe because kotlin doesn't allow you to
// have both "AAA" and "aAA".
val decapitalizedName = name.decapitalizeAsciiOnly()

This comment has been minimized.

Copy link
@ZacSweers

ZacSweers Feb 25, 2019

Author Collaborator

I actually don't know how master passes without this currently

image

@ZacSweers ZacSweers force-pushed the z/codegenApi branch from fb14224 to 1f20100 Apr 18, 2019

@ZacSweers ZacSweers changed the title WIP Decouple code gen API from apt and kotlin-metadata Decouple code gen API from apt and kotlin-metadata Apr 18, 2019

@ZacSweers

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 18, 2019

I've updated this with KotlinPoet 1.2.0 and rebased, would be curious for thoughts on pursuing this. It works now, next (possibly separate PR) would be trying to tease out a designed API for this

@ZacSweers ZacSweers force-pushed the z/codegenApi branch from 1f20100 to 6bbf370 Aug 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.