airbnb / Showkase

🔦 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements

Home Page:https://medium.com/airbnb-engineering/introducing-showkase-a-library-to-organize-discover-and-visualize-your-jetpack-compose-elements-d5c34ef01095

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow a way to configure ignoring @Preview

undermark5 opened this issue · comments

It would be wonderful if there was a way to disable generating elements for all items annotated with @Preview regardless of their visibility modifiers. Allowing the codebase owners to determine which annotation should be used.

Theoretically one possible way to do this could actually to be via providing a way to configure a list of annotations (custom or builtin) that should generate elements for.

@undermark5 One way in which you can do this today is to mark the @Preview functions that you don't need as private and then pass then leverage the skipPrivatePreviews flag

ksp {
 arg("skipPrivatePreviews", "true")
}

or

kapt {
 arguments {
  arg("skipPrivatePreviews", "true")
 }
}

That would work in most instances, however, in my current scenario, it isn't totally feasible. I'd like to start using Showkase, but we are also starting to move our foundational components into a separate module, however, there are existing components that are both the preview and the actual component, and thus they must be public, but I don't want them included in the showcase as they aren't supposed to be a part of our foundational components. I could create new preview wrappers for these that are previews, or, if the functionality I suggest was available, I could simply specify that a new custom annotation that I create are the only things to get added into the Showkase (or some other way to ignore them @ShowkaseIgnore for example).

So, while the need isn't major, it would be beneficial for those that are adding Showkase to existing codebases that may not already have all previews being private.