Showkase icon indicating copy to clipboard operation
Showkase copied to clipboard

ShowkaseModuleCodegen not regenerated nor updated when preview components are removed.

Open crjacinro opened this issue 2 years ago • 11 comments

Prerequisite:

  • Add a Foo and a FooPreview composable accordingly, with FooPreview as a preview function for Foo.
  • Build the project

Scenario:

  • Remove FooPreview function.

Actual Result:

  • Project will not compile since ShowkaseModuleCodegen is still looking and referencing for FooPreview.

Expected Result:

  • ShowkaseModuleCodegen should be regenerated or updated since a preview component was removed from the codebase.

Workaround: Clean / Rebuild the app

crjacinro avatar Oct 13 '22 06:10 crjacinro

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

vinaygaba avatar Nov 01 '22 20:11 vinaygaba

Yes. Kapt.

crjacinro avatar Nov 02 '22 00:11 crjacinro

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.

trod-123 avatar Dec 15 '22 23:12 trod-123

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

bdwyer-newrelic avatar Dec 16 '22 20:12 bdwyer-newrelic

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

je-ramos-acc avatar Dec 20 '22 09:12 je-ramos-acc

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

trod-123 avatar Dec 20 '22 15:12 trod-123

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

charliebrownwork avatar Feb 09 '23 09:02 charliebrownwork

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?

MAdrianOvidiu avatar Mar 20 '23 10:03 MAdrianOvidiu

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.

vinaygaba avatar Apr 05 '23 18:04 vinaygaba

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

designedbyz avatar Apr 25 '23 15:04 designedbyz

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

kmalmur avatar Nov 27 '23 09:11 kmalmur