-
Notifications
You must be signed in to change notification settings - Fork 108
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
Make stacked preview annotations generate showkaseMetadata components for each annotation #259
Make stacked preview annotations generate showkaseMetadata components for each annotation #259
Conversation
8371ec2
to
ba69d50
Compare
showkase-processor/src/main/java/com/airbnb/android/showkase/processor/ShowkaseProcessor.kt
Show resolved
Hide resolved
...ase-processor/src/main/java/com/airbnb/android/showkase/processor/models/ShowkaseMetadata.kt
Outdated
Show resolved
Hide resolved
.../src/main/java/com/airbnb/android/showkase/processor/writer/ShowkaseCodegenMetadataWriter.kt
Outdated
Show resolved
Hide resolved
ba69d50
to
a6b003b
Compare
&& showkaseMetadata.componentIndex != null | ||
&& showkaseMetadata.componentIndex > 0 | ||
) { | ||
"${showkaseMetadata.showkaseGroup}_${showkaseMetadata.showkaseName}_${showkaseMetadata.componentIndex}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we were hoping for a better name but we can probably append componentIndex
for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking in good shape. You can do the ShowkaseComposable
support later on as it's not super pressing. I think you are at a point where you can move to the custom annotation stuff we discussed previously. Great job in making such a critical feature happen 👏🏻
There is another test for checking the old behaviour
...testing/src/test/java/com/airbnb/android/showkase_processor_testing/ShowkaseProcessorTest.kt
Show resolved
Hide resolved
Thank you very much @vinaygaba! And thank you so much valuable review 🙏 I tried to add support for stacked |
@oas004 Amazing! One final thing you can do is write a test for the ShowkaseBrowser that verifies the following:
Add the test cases here - https://github.com/airbnb/Showkase/blob/master/showkase-browser-testing/src/androidTest/java/com/airbnb/android/showkase_browser_testing/ShowkaseBrowserTest.kt |
That is a very good idea! 🙌 Is there a way for us to bypass it in KAPT on CI? I think if I added those BrowserTests, then it will fail on KAPT every time 🤔 |
@oas004 Oh no, you are right. We currently run these tests for both ksp and kapt and pass the |
@oas004 Can you try this - in the android.yml file, also add |
I think that can work! Will test this out first thing in the morning😊 |
@vinaygaba Can we re-run the UI Tests? It didn't provide me a log to check if it worked or not 😅 |
it seems like it was failing on the screenshot tests 🤔 I think I might need to take that into account as well somehow 🤔 |
It seems like the KAPT stage is working on all but one emulator and then fails, so I can't see the others that checks green to verify if the |
2b16ce2
to
d165e7d
Compare
@@ -37,31 +36,54 @@ class ShowcaseBrowserTest { | |||
} | |||
) | |||
|
|||
// This will alter now since KSP supports stacked preview annotations and KAPT does not. | |||
private val componentSize = if (System.getProperty("useKsp") == "true") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a more descriptive comment about why we are doing this. Along with link to the issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Added something in fb87f3c :) Does that look okay? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very exciting! Thank you for your patience and getting this to the finish line 👏
…e preview annotations
This is supercool! I will start on the actual mutlipreview annotation as soon as possible! 😄 🤩 Thank you so much for your valuable input! 🙏 Feel like I am learning a lot from this! 😃 😍 |
58a6ac2
to
84315b7
Compare
8d57459
to
fbf680a
Compare
...ting/src/androidTest/java/com/airbnb/android/showkase_browser_testing/ShowkaseBrowserTest.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we have everything covered at this point 🥳
This is the next step in supporting Multipreview annotations. Referencing #255 as the first step.
Here I have added functionality to make a
ShowkaseMetadata
object for eachPreview
annotation. Eg.Before, this would only make one component in Showkase. Now it should make one for each preview and place them in their respective group. Here they would both be placed in the group
font scales
Furthermore, I would advice to review this by commit as I had to update the tests because of some arrangement due to a check in the processor. I placed the test update in 8371ec2.
I'm leaving this as a draft PR because I'm having some issues with getting this to work with KAPT.
With KSP, the method
roundEnvironment.getElementsAnnotatedWith(PREVIEW_CLASS_NAME)
returns all the elements for multi stacked preview. However, with KAPT, it does not seem to work the same way. Is there some other function I should use here? Any suggestions are more than welcome 😄Added a slack post for anyone interested 😄