Skip to content

Commit

Permalink
Fix the use of the incorrect package in the performance refactor (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinaygaba authored Dec 17, 2022
1 parent 7c303f4 commit 44951ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.airbnb.android.submodule.showkasesample
package com.airbnb.android.submodule.showkasesample.payments

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ class ShowkaseProcessor @JvmOverloads constructor(
val aggregateMetadataList = componentMetadata + colorMetadata + typographyMetadata
if (aggregateMetadataList.isEmpty()) return ShowkaseBrowserProperties()

val packageName = aggregateMetadataList.first().packageName
ShowkaseCodegenMetadataWriter(environment).apply {
generateShowkaseCodegenFunctions(aggregateMetadataList)
}
Expand All @@ -143,7 +142,6 @@ class ShowkaseProcessor @JvmOverloads constructor(
componentMetadata = componentMetadata,
colorMetadata = colorMetadata,
typographyMetadata = typographyMetadata,
packageName
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class ShowkaseBrowserPropertyWriter(private val environment: XProcessingEnv) {
componentMetadata: Set<ShowkaseMetadata.Component>,
colorMetadata: Set<ShowkaseMetadata>,
typographyMetadata: Set<ShowkaseMetadata>,
packageName: String,
): ShowkaseBrowserProperties {
val (showkaseMetadataWithParameterList, showkaseMetadataWithoutParameterList) =
componentMetadata
Expand All @@ -32,15 +31,15 @@ class ShowkaseBrowserPropertyWriter(private val environment: XProcessingEnv) {
val withoutParameterPropertyNames =
showkaseMetadataWithoutParameterList.mapIndexed { index, showkaseMetadata ->
val propertyName = generatePropertyNameFromMetadata(showkaseMetadata)
val fileBuilder = getFileBuilder(packageName, propertyName)
val fileBuilder = getFileBuilder(showkaseMetadata.packageName, propertyName)
val property =
getPropertyForComponentWithoutParameter(propertyName, showkaseMetadata)

fileBuilder.addPropertyAndGenerateFile(property)
return@mapIndexed ShowkaseGeneratedMetadata(
element = showkaseMetadata.element,
propertyName = propertyName,
propertyPackage = packageName,
propertyPackage = showkaseMetadata.packageName,
type = ShowkaseGeneratedMetadataType.COMPONENTS_WITHOUT_PARAMETER,
group = showkaseMetadata.showkaseGroup,
name = showkaseMetadata.showkaseName,
Expand All @@ -52,15 +51,15 @@ class ShowkaseBrowserPropertyWriter(private val environment: XProcessingEnv) {
val withParameterPropertyNames =
showkaseMetadataWithParameterList.mapIndexed { index, showkaseMetadata ->
val propertyName = generatePropertyNameFromMetadata(showkaseMetadata)
val fileBuilder = getFileBuilder(packageName, propertyName)
val fileBuilder = getFileBuilder(showkaseMetadata.packageName, propertyName)
val property = getPropertyForComponentWithParameter(propertyName, showkaseMetadata)

fileBuilder.addPropertyAndGenerateFile(property)

return@mapIndexed ShowkaseGeneratedMetadata(
element = showkaseMetadata.element,
propertyName = propertyName,
propertyPackage = packageName,
propertyPackage = showkaseMetadata.packageName,
type = ShowkaseGeneratedMetadataType.COMPONENTS_WITH_PARAMETER,
group = showkaseMetadata.showkaseGroup,
name = showkaseMetadata.showkaseName,
Expand All @@ -71,7 +70,7 @@ class ShowkaseBrowserPropertyWriter(private val environment: XProcessingEnv) {
// Generate top level property file for colors
val colorPropertyNames = colorMetadata.mapIndexed { index, color ->
val propertyName = generatePropertyNameFromMetadata(color)
val fileBuilder = getFileBuilder(packageName, propertyName)
val fileBuilder = getFileBuilder(color.packageName, propertyName)
val colorProperty = getPropertyForMetadata(
propertyName,
color,
Expand All @@ -82,7 +81,7 @@ class ShowkaseBrowserPropertyWriter(private val environment: XProcessingEnv) {
return@mapIndexed ShowkaseGeneratedMetadata(
element = color.element,
propertyName = propertyName,
propertyPackage = packageName,
propertyPackage = color.packageName,
type = ShowkaseGeneratedMetadataType.COLOR,
group = color.showkaseGroup,
name = color.showkaseName,
Expand All @@ -93,7 +92,7 @@ class ShowkaseBrowserPropertyWriter(private val environment: XProcessingEnv) {
val typographyPropertyNames =
typographyMetadata.mapIndexed { index, typography ->
val propertyName = generatePropertyNameFromMetadata(typography)
val fileBuilder = getFileBuilder(packageName, propertyName)
val fileBuilder = getFileBuilder(typography.packageName, propertyName)
val typographyProperty = getPropertyForMetadata(
propertyName,
typography,
Expand All @@ -103,7 +102,7 @@ class ShowkaseBrowserPropertyWriter(private val environment: XProcessingEnv) {
return@mapIndexed ShowkaseGeneratedMetadata(
element = typography.element,
propertyName = propertyName,
propertyPackage = packageName,
propertyPackage = typography.packageName,
type = ShowkaseGeneratedMetadataType.COLOR,
group = typography.showkaseGroup,
name = typography.showkaseName,
Expand Down

0 comments on commit 44951ff

Please sign in to comment.