airbnb / Showkase

🔦 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements
https://medium.com/airbnb-engineering/introducing-showkase-a-library-to-organize-discover-and-visualize-your-jetpack-compose-elements-d5c34ef01095
Apache License 2.0
2.11k stars 107 forks source link

ShowkaseModuleCodegen not regenerated nor updated when preview components are removed. #273

Open crjacinro opened 1 year ago

crjacinro commented 1 year ago

Prerequisite:

Scenario:

Actual Result:

Expected Result:

Workaround: Clean / Rebuild the app

vinaygaba commented 1 year ago

I'm guessing you are using kapt and not ksp? @crjacinro

crjacinro commented 1 year ago

Yes. Kapt.

trod-123 commented 1 year ago

I'm having a similar issue as well, using kapt. I am not sure if there's caching happening, but for me even cleaning and rebuilding the app, or Invalidating caches and restarting AS does not solve the issue... ShowkaseModuleCodegen continues to somehow reference the removed previews, even after I removed all references completely from my code, so I am not sure just how it's still referencing code that no longer exists.

It's a pretty blocking issue which I am surprised why it's not raised often.

I am running the latest 1.0.0-beta15.

bdwyer-newrelic commented 1 year ago

I'm having a similar issue as well, using kapt. I am not sure if there's caching happening, but for me even cleaning and rebuilding the app, or Invalidating caches and restarting AS does not solve the issue... ShowkaseModuleCodegen continues to somehow reference the removed previews, even after I removed all references completely from my code, so I am not sure just how it's still referencing code that no longer exists.

It's a pretty blocking issue which I am surprised why it's not raised often.

I am running the latest 1.0.0-beta15.

Also seeing this

je-ramos-acc commented 1 year ago

@trod-123 have you found a workaround with this?

trod-123 commented 1 year ago

@je-ramos-acc I went with using ksp instead of kapt, which has been working great so far after numerous iterations on my end.

charliebrownwork commented 1 year ago

@je-ramos-acc Update the name in @Preview make it regenerate for me: @Preview(name= "Change to specific name") Updated: No, it not work :(

MAdrianOvidiu commented 1 year ago

Having the same problem, I would appreciate some help on this, I realise you are suggesting moving to ksp would solve the issue but commercial project realities prevent me from doing that atm. Is there any way to force regeneration of code for kapt?

vinaygaba commented 1 year ago

The only way to force regeneration in my experience has been to just make some manual changes to the generated root file. That causes it to run again. I think the only real solution is using ksp as that's been working really well so far.

I'm open to ideas though.

designedbyz commented 1 year ago

I've also had trouble with this recently, and Showkase is also integrated with kapt in the app I work on. My workaround has been as follows:

  1. run clean for any module that is providing components I want to see in the browser
  2. run a build with --no-build-cache

@vinaygaba, it sounds like you're not currently sure why ksp is picking up the changes and kapt does not?

The only way to force regeneration in my experience has been to just make some manual changes to the generated root file. That causes it to run again.

To me, this makes it sound like a gradle task input or output is improperly declared, but Showkase obviously doens't provide it's own tasks, it just hooks into kapt ... 🤔

It all sounds very similar to this old issue for Kapt version 1.3, but I've only noticed this particular problem with Showkase and not other annotation processors. Definitely a tricky problem

kmalmur commented 9 months ago

voting this up. The issue is still there and is quite painful when switching between branches. Any plans to fix this?