Repository navigation
fix(example): align generated icons source root - #42
Conversation
kingsword09
commented
Jun 4, 2026
- move generated icons out of src/commonMain/kotlin to avoid IDE package-path warnings
- register src/commonMain/generated/symbols as a commonMain Kotlin source root
- switch official Material Symbols example source to esm.sh
- update generated icon references from Fill1 to Fill
- streamline preview annotation normalization
- move generated icons out of src/commonMain/kotlin to avoid IDE package-path warnings - register src/commonMain/generated/symbols as a commonMain Kotlin source root - switch official Material Symbols example source to esm.sh - update generated icon references from Fill1 to Fill - streamline preview annotation normalization
|
Documentation Updates 1 document(s) were updated by changes in this PR: Multi-Library Icon SupportView Changes@@ -23,9 +23,9 @@
// 官方库多变体图标
externalIcon("home", libraryName = "official") {
- urlTemplate = "https://example.com/{name}_{fill}_24px.svg"
+ urlTemplate = "https://esm.sh/@material-symbols/svg-400@latest/rounded/{name}{fill}.svg"
styleParam("fill") {
- values("", "fill1") // 未填充、填充变体
+ values("", "-fill") // 未填充、填充变体
}
}
}
@@ -45,9 +45,9 @@
// 官方库批量多变体
externalIcons("home", "search", "person", "settings", "arrow_back", libraryName = "official") {
- urlTemplate = "https://rawcdn.githack.com/google/material-design-icons/master/symbols/web/{name}/materialsymbolsrounded/{name}{fill}_24px.svg?min=1"
+ urlTemplate = "https://esm.sh/@material-symbols/svg-400@latest/rounded/{name}{fill}.svg"
styleParam("fill") {
- values("", "fill1")
+ values("", "-fill")
}
}
}
@@ -92,8 +92,8 @@
// Google Material Symbols 多变体
externalIcons("home", "search", "person", "settings", "arrow_back", libraryName = "official") {
- urlTemplate = "https://rawcdn.githack.com/google/material-design-icons/master/symbols/web/{name}/materialsymbolsrounded/{name}{fill}_24px.svg?min=1"
- styleParam("fill") { values("", "fill1") }
+ urlTemplate = "https://esm.sh/@material-symbols/svg-400@latest/rounded/{name}{fill}.svg"
+ styleParam("fill") { values("", "-fill") }
}
}
``` |
There was a problem hiding this comment.
Code Review
This pull request updates the SymbolCraft output directory configuration, moving generated symbols from the Kotlin source directory to a dedicated generated source root, and updates the documentation and example app accordingly. It also updates the Material Symbols URL template and regenerates the official icons with correct dimensions. In Svg2ComposeConverter.kt, the preview annotation replacement logic was refactored; however, a review comment suggests optimizing this by performing a substring check before executing the regular expression replacement on every line.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| /** Adds an import after the existing import block, or immediately after the package line. */ | ||
| private fun addImportIfMissing(content: String, qualifiedName: String): String { | ||
| if (content.lines().any { it == "import $qualifiedName" }) return content | ||
| normalizedLines.add(line.replace(PREVIEW_ANNOTATION_REGEX, "@$annotationName")) |
There was a problem hiding this comment.
Running a regular expression replacement on every single line of the generated file can be highly inefficient, especially for large SVG/XML path files with hundreds of lines. Since most lines do not contain the @Preview annotation, we can significantly optimize this by performing a simple substring check (line.contains("@Preview")) before executing the regex replacement.
val processedLine = if (line.contains("@Preview")) {
line.replace(PREVIEW_ANNOTATION_REGEX, "@$annotationName")
} else {
line
}
normalizedLines.add(processedLine)|
"update generated icon references from Fill1 to Fill" My icons are still named "Fill1" with 0.4.0. |
Thanks for catching this,it will be fixed as a breaking change in 0.5.0 by generating ...Fill instead. |