-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to skip vanilla preview functions
- Loading branch information
Showing
9 changed files
with
192 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...ssorTest/composable_functions_with_preview_annotation_are_skipped/input/TestComposable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input | ||
|
||
import androidx.compose.runtime.Composable | ||
import com.airbnb.android.showkase.annotation.ShowkaseComposable | ||
import androidx.compose.ui.tooling.preview.Preview | ||
|
||
@ShowkaseComposable(name = "name1", group = "group1") | ||
@Composable | ||
public fun TestShowkaseComposable1() { | ||
|
||
} | ||
|
||
@ShowkaseComposable(name = "name2", group = "group2") | ||
@Composable | ||
public fun TestShowkaseComposable2() { | ||
|
||
} | ||
|
||
@Preview(name = "name3", group = "group3") | ||
@Composable | ||
public fun TestPreviewComposable3() { | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
...orTest/composable_functions_with_preview_annotation_are_skipped/input/TestShowkaseRoot.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input | ||
|
||
import com.airbnb.android.showkase.annotation.ShowkaseComposable | ||
import androidx.compose.runtime.Composable | ||
import com.airbnb.android.showkase.annotation.ShowkaseRoot | ||
import com.airbnb.android.showkase.annotation.ShowkaseRootModule | ||
|
||
@ShowkaseRoot | ||
public class TestShowkaseRoot: ShowkaseRootModule { | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
...a_showkaseprocessortest_composable_functions_with_preview_annotation_are_skipped_input.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// This is an auto-generated file. Please do not edit/modify this file. | ||
package com.airbnb.android.showkase | ||
|
||
import com.airbnb.android.showkase.`annotation`.ShowkaseCodegenMetadata | ||
|
||
public class | ||
ShowkaseMetadata_showkaseprocessortest_composable_functions_with_preview_annotation_are_skipped_input | ||
{ | ||
@ShowkaseCodegenMetadata( | ||
showkaseName = "name1", | ||
showkaseGroup = "group1", | ||
packageName = | ||
"ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input", | ||
packageSimpleName = "input", | ||
showkaseElementName = "TestShowkaseComposable1", | ||
insideObject = false, | ||
insideWrapperClass = false, | ||
showkaseKDoc = "", | ||
generatedPropertyName = "TestShowkaseComposable1group1name1", | ||
showkaseMetadataType = "COMPONENT", | ||
isDefaultStyle = false, | ||
) | ||
public | ||
fun ShowkaseProcessorTestcomposablefunctionswithpreviewannotationareskippedinputTestShowkaseComposable1group1name1() { | ||
} | ||
|
||
@ShowkaseCodegenMetadata( | ||
showkaseName = "name2", | ||
showkaseGroup = "group2", | ||
packageName = | ||
"ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input", | ||
packageSimpleName = "input", | ||
showkaseElementName = "TestShowkaseComposable2", | ||
insideObject = false, | ||
insideWrapperClass = false, | ||
showkaseKDoc = "", | ||
generatedPropertyName = "TestShowkaseComposable2group2name2", | ||
showkaseMetadataType = "COMPONENT", | ||
isDefaultStyle = false, | ||
) | ||
public | ||
fun ShowkaseProcessorTestcomposablefunctionswithpreviewannotationareskippedinputTestShowkaseComposable2group2name2() { | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...unctions_with_preview_annotation_are_skipped/output/TestShowkaseComposable1group1name1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// This is an auto-generated file. Please do not edit/modify this file. | ||
package ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input | ||
|
||
import androidx.compose.runtime.Composable | ||
import com.airbnb.android.showkase.models.ShowkaseBrowserComponent | ||
|
||
public val TestShowkaseComposable1group1name1: ShowkaseBrowserComponent = ShowkaseBrowserComponent( | ||
group = "group1", | ||
componentName = "name1", | ||
componentKDoc = "", | ||
componentKey = | ||
"""ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input_TestShowkaseComposable1_null_group1_name1_0_null""", | ||
isDefaultStyle = false, | ||
component = @Composable { TestShowkaseComposable1() } | ||
) |
15 changes: 15 additions & 0 deletions
15
...unctions_with_preview_annotation_are_skipped/output/TestShowkaseComposable2group2name2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// This is an auto-generated file. Please do not edit/modify this file. | ||
package ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input | ||
|
||
import androidx.compose.runtime.Composable | ||
import com.airbnb.android.showkase.models.ShowkaseBrowserComponent | ||
|
||
public val TestShowkaseComposable2group2name2: ShowkaseBrowserComponent = ShowkaseBrowserComponent( | ||
group = "group2", | ||
componentName = "name2", | ||
componentKDoc = "", | ||
componentKey = | ||
"""ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input_TestShowkaseComposable2_null_group2_name2_0_null""", | ||
isDefaultStyle = false, | ||
component = @Composable { TestShowkaseComposable2() } | ||
) |
37 changes: 37 additions & 0 deletions
37
...omposable_functions_with_preview_annotation_are_skipped/output/TestShowkaseRootCodegen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// This is an auto-generated file. Please do not edit/modify this file. | ||
package ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input | ||
|
||
import com.airbnb.android.showkase.`annotation`.ShowkaseRootCodegen | ||
import com.airbnb.android.showkase.models.ShowkaseBrowserColor | ||
import com.airbnb.android.showkase.models.ShowkaseBrowserComponent | ||
import com.airbnb.android.showkase.models.ShowkaseBrowserTypography | ||
import com.airbnb.android.showkase.models.ShowkaseProvider | ||
import kotlin.collections.List | ||
|
||
@ShowkaseRootCodegen( | ||
numComposablesWithoutPreviewParameter = 2, | ||
numComposablesWithPreviewParameter = 0, | ||
numColors = 0, | ||
numTypography = 0, | ||
) | ||
public class TestShowkaseRootCodegen : ShowkaseProvider { | ||
override fun getShowkaseComponents(): List<ShowkaseBrowserComponent> { | ||
|
||
return listOf<ShowkaseBrowserComponent>( | ||
TestShowkaseComposable1group1name1, | ||
TestShowkaseComposable2group2name2, | ||
) | ||
} | ||
|
||
override fun getShowkaseColors(): List<ShowkaseBrowserColor> { | ||
|
||
return listOf<ShowkaseBrowserColor>( | ||
) | ||
} | ||
|
||
override fun getShowkaseTypography(): List<ShowkaseBrowserTypography> { | ||
|
||
return listOf<ShowkaseBrowserTypography>( | ||
) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...review_annotation_are_skipped/output/TestShowkaseRootShowkaseExtensionFunctionsCodegen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// This is an auto-generated file. Please do not edit/modify this file. | ||
package ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import com.airbnb.android.showkase.models.Showkase | ||
import com.airbnb.android.showkase.models.ShowkaseElementsMetadata | ||
import com.airbnb.android.showkase.models.ShowkaseProvider | ||
import com.airbnb.android.showkase.ui.ShowkaseBrowserActivity | ||
|
||
/** | ||
* Helper function that's autogenerated and gives you an intent to start the ShowkaseBrowser. | ||
*/ | ||
public fun Showkase.getBrowserIntent(context: Context): Intent { | ||
val intent = Intent(context, ShowkaseBrowserActivity::class.java) | ||
intent.putExtra("SHOWKASE_ROOT_MODULE", | ||
"ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input.TestShowkaseRoot") | ||
return intent | ||
} | ||
|
||
/** | ||
* Helper function that's give's you access to Showkase metadata. This contains data about the | ||
* composables, colors and typography in your codebase that's rendered in showkase. | ||
*/ | ||
public fun Showkase.getMetadata(): ShowkaseElementsMetadata { | ||
try { | ||
val showkaseComponentProvider = | ||
Class.forName("ShowkaseProcessorTest.composable_functions_with_preview_annotation_are_skipped.input.TestShowkaseRootCodegen") | ||
.getDeclaredConstructor() | ||
.newInstance() as ShowkaseProvider | ||
return showkaseComponentProvider.metadata() | ||
} catch(exception: ClassNotFoundException) { | ||
error("The class wasn't generated correctly. Make sure that you have setup Showkase correctly by following the steps here - https://github.com/airbnb/Showkase#Installation.") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters