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

Disabling code gen in debug builds #99

Open
seyedjafariy opened this issue Oct 1, 2018 · 3 comments
Open

Disabling code gen in debug builds #99

seyedjafariy opened this issue Oct 1, 2018 · 3 comments

Comments

@seyedjafariy
Copy link

Is there a way to disable the adapter code generation?
something similar to @JsonClass(generateAdapter = false) in Moshi code gen.

its especially useful in debug builds since we need fast iteration. (Moshi also provides Kotlin Reflect Adapter which we can make use of in debug build tool)

@JakeWharton
Copy link
Contributor

Use releaseAnnotationProcessor or check if (properties.containsKey('android.injected.invoked.from.ide')) before adding the regular annotationProcessor dependency.

@seyedjafariy
Copy link
Author

releaseAnnotationProcessor is a good way to block the code gen.
but then I have to make my Moshi builder flavored specific(release and debug), in order to overcome the generation of KotshiApplicationJsonAdapterFactory() class in release builds only.

@ansman
Copy link
Owner

ansman commented Oct 2, 2018

The answer is no, there is no way besides not applying the processor. As you mention you would have to have a separate factory in another source set. I will consider adding this feature when I switch to generating Kotlin code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants