From 457f0484795fec2244eb4da49d6ff4b07c47cb47 Mon Sep 17 00:00:00 2001 From: DevSrSouza Date: Fri, 15 Jan 2021 11:54:07 -0300 Subject: [PATCH] Update the Compose vector classes that was renamed --- build.gradle.kts | 2 +- .../material/icons/generator/AllIconAccessorGenerator.kt | 4 +--- .../androidx/compose/material/icons/generator/Names.kt | 4 ++-- .../material/icons/generator/VectorAssetGenerator.kt | 6 +++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2761c5f4..83e8b2e6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "br.com.devsrsouza" -version = "0.4.0" +version = "0.5.0" repositories { mavenCentral() diff --git a/src/main/kotlin/androidx/compose/material/icons/generator/AllIconAccessorGenerator.kt b/src/main/kotlin/androidx/compose/material/icons/generator/AllIconAccessorGenerator.kt index 6aa77d84..094faf54 100644 --- a/src/main/kotlin/androidx/compose/material/icons/generator/AllIconAccessorGenerator.kt +++ b/src/main/kotlin/androidx/compose/material/icons/generator/AllIconAccessorGenerator.kt @@ -3,9 +3,7 @@ package androidx.compose.material.icons.generator import androidx.compose.material.icons.generator.util.backingPropertySpec import androidx.compose.material.icons.generator.util.withBackingProperty import br.com.devsrsouza.svg2compose.GeneratedGroup -import br.com.devsrsouza.svg2compose.Svg2Compose import com.squareup.kotlinpoet.* -import com.squareup.kotlinpoet.MemberName.Companion.member import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy class AllIconAccessorGenerator( @@ -21,7 +19,7 @@ class AllIconAccessorGenerator( // preventing that a asset has the name List and conflict with Kotlin List import fileSpec.addAliasedImport(list, "____KtList") - val allIconsType = list.parameterizedBy(ClassNames.VectorAsset) + val allIconsType = list.parameterizedBy(ClassNames.ImageVector) val allIconsBackingProperty = backingPropertySpec("__$allAssetsPropertyName", allIconsType) // preventing import conflict when different groups has the same asset name. diff --git a/src/main/kotlin/androidx/compose/material/icons/generator/Names.kt b/src/main/kotlin/androidx/compose/material/icons/generator/Names.kt index 4763d493..aa6c202f 100644 --- a/src/main/kotlin/androidx/compose/material/icons/generator/Names.kt +++ b/src/main/kotlin/androidx/compose/material/icons/generator/Names.kt @@ -34,7 +34,7 @@ enum class PackageNames(val packageName: String) { */ object ClassNames { val Icons = PackageNames.MaterialIconsPackage.className("Icons") - val VectorAsset = PackageNames.VectorPackage.className("VectorAsset") + val ImageVector = PackageNames.VectorPackage.className("ImageVector") val PathFillType = PackageNames.GraphicsPackage.className("PathFillType") val StrokeCap = PackageNames.GraphicsPackage.className("StrokeCap") val StrokeJoin = PackageNames.GraphicsPackage.className("StrokeJoin") @@ -44,7 +44,7 @@ object ClassNames { * [MemberName]s used for icon generation. */ object MemberNames { - val VectorAssetBuilder = MemberName(PackageNames.VectorPackage.packageName, "VectorAssetBuilder") + val ImageVectorBuilder = MemberName(ClassNames.ImageVector, "Builder") val Path = MemberName(PackageNames.VectorPackage.packageName, "path") diff --git a/src/main/kotlin/androidx/compose/material/icons/generator/VectorAssetGenerator.kt b/src/main/kotlin/androidx/compose/material/icons/generator/VectorAssetGenerator.kt index 46efd465..576d19cf 100644 --- a/src/main/kotlin/androidx/compose/material/icons/generator/VectorAssetGenerator.kt +++ b/src/main/kotlin/androidx/compose/material/icons/generator/VectorAssetGenerator.kt @@ -57,13 +57,13 @@ class VectorAssetGenerator( // the size from ~6000 to 1, and speed up compilation time for these icons. @OptIn(ExperimentalStdlibApi::class) val backingPropertyName = "_" + iconName.decapitalize(Locale.ROOT) - val backingProperty = backingPropertySpec(name = backingPropertyName, ClassNames.VectorAsset) + val backingProperty = backingPropertySpec(name = backingPropertyName, ClassNames.ImageVector) val generation = FileSpec.builder( packageName = iconGroupPackage, fileName = iconName ).addProperty( - PropertySpec.builder(name = iconName, type = ClassNames.VectorAsset) + PropertySpec.builder(name = iconName, type = ClassNames.ImageVector) .receiver(groupClassName) .getter(iconGetter(backingProperty)) .build() @@ -94,7 +94,7 @@ class VectorAssetGenerator( val parameters = parameterList.joinToString(prefix = "(", postfix = ")") val members: Array = listOfNotNull( - MemberNames.VectorAssetBuilder, + MemberNames.ImageVectorBuilder, vector.width.memberName, vector.height.memberName ).toTypedArray()