Ibotta / gradle-aspectj-pipeline-plugin

A Gradle plugin for Android projects which performs AspectJ weaving using Android's bytcode manipulation pipeline.
Apache License 2.0
76 stars 14 forks source link

does this impact incremental annotation processing #10

Closed bsautner closed 3 years ago

bsautner commented 3 years ago

Awesome plugin. This is the second time I've had to implement an analytic / logging framework on a very large android project and plan on using AOP. The first time i did it was with some custom gradle and loosely based on this plugin which weaves for debug logging. https://github.com/JakeWharton/hugo

I'm under the impression the reason that plugin hasn't been maintained in years is because it slows build times by breaking incremental annotation processing so i'm wondering if you have any thoughts on that.

https://docs.gradle.org/4.10.1/userguide/java_plugin.html#sec:incremental_annotation_processing

Build times are a pain point here so i wouldn't want to make that noticeably worse. Weaving obviously adds a step but my concern is around Android specifically having issues with it.

Thanks in advance, we have a huge team here and we're happy to help with this project where we can.

eschlenz commented 3 years ago

@bsautner Thanks for the kind words!

To your question: Does this break incremental annotation processing?

The answer, I believe, is maybe, and I'll explain why.

This plugin was actually developed specifically for our core Ibotta app to take on some tracking logic duties. We still heavily use it across many of our app modules. And, we have all of the incremental compilation features enabled throughout the project.

When we first implemented this plugin it for sure did not work with incremental compilation. We enlisted the help of Gary from the Gradle team, and believe we worked through those issues to fix this plugin.

However, in our Ibotta app, we will on occasion see a module randomly fail to compile after some arbitrary change. To fix it we usually have to force Gradle to rebuild by skipping the cache (--no-build-cache). I'm not 100% sure what's going on, but haven't ruled out this plugin.

The issue seems to come and go. For example, I haven't seen this issue personally in over a month, leaving me to believe it was potentially an issue with Android Gradle Build Tools or Gradle itself.

For the time being, we're keeping an eye on it. We certainly haven't found a way to reproduce the issue yet and for sure say it's this plugin that causes it.

P.S. Thanks for the offer to help with the project. We'd love that! We try to stay active in responding to issues and what-not, because we don't want this to be yet another project that goes dormant (drives us nuts). So we spend time on it where we can, but have our core business to run first.

eschlenz commented 3 years ago

Here's a related issue from the past where we worked through KAPT incremental issues: #3

bsautner commented 3 years ago

Thanks, I spoke to @jakewharton about this at a conference a few years ago and he said AOP would break incremental annotation processing which is why I asked. I'm a little optimistic that your bytecode manipulation pipeline magic may happen after that step. Franky the ability to use aspects instead polluting a huge multi-project code base with logging callbacks is worth a slower build on the main app project. Thanks for the quick response!

eschlenz commented 3 years ago

No problem. I think the approach this plugin takes is fundamentally different than the others I've come across. That certainly has created some challenges, but seems to generally work well.

And as for slower builds, yeah, there's a definite cost to weaving. But I agree, the ability to not pollute the core code base with logging/tracking concerns was the core impetus behind using AOP for us in the first place.