Conversation
WalkthroughVector output write operations are moved to the IO dispatcher by wrapping Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/conversion/IconPackConversionViewModel.kt (1)
166-238: Consider splitting CPU conversion vs filesystem writes + ensure state is reset on failure/cancel.
Switching toDispatchers.IOmatcheswriteToKt, butImageVectorGenerator.convert(...)may be CPU-bound; also any exception/cancellation can strand the UI inExportingState.- fun export() = viewModelScope.launch(Dispatchers.IO) { + fun export() = viewModelScope.launch(Dispatchers.IO) { val icons = when (val state = _state.value) { is BatchProcessing.IconPackCreationState -> state.icons else -> return@launch } _state.updateState { BatchProcessing.ExportingState } - val settings = inMemorySettings.current - - icons - .filterIsInstance<BatchIcon.Valid>() - .forEach { icon -> - when (val iconPack = icon.iconPack) { + try { + val settings = inMemorySettings.current + icons + .filterIsInstance<BatchIcon.Valid>() + .forEach { icon -> + when (val iconPack = icon.iconPack) { is IconPack.Nested -> { - val vectorSpecOutput = ImageVectorGenerator.convert( + val vectorSpecOutput = kotlinx.coroutines.withContext(Dispatchers.Default) { + ImageVectorGenerator.convert( vector = icon.irImageVector, iconName = icon.iconName.name, config = ImageVectorGeneratorConfig( packageName = icon.iconPack.iconPackage, iconPackPackage = settings.iconPackPackage, packName = settings.iconPackName, nestedPackName = iconPack.currentNestedPack, outputFormat = settings.outputFormat, useComposeColors = settings.useComposeColors, generatePreview = settings.generatePreview, previewAnnotationType = settings.previewAnnotationType, useFlatPackage = settings.flatPackage, useExplicitMode = settings.useExplicitMode, addTrailingComma = settings.addTrailingComma, indentSize = settings.indentSize, ), - ) + ) + } vectorSpecOutput.content.writeToKt( outputDir = when { settings.flatPackage -> settings.iconPackDestination else -> "${settings.iconPackDestination}/${iconPack.currentNestedPack.lowercase()}" }, nameWithoutExtension = vectorSpecOutput.name, ) } is IconPack.Single -> { - val vectorSpecOutput = ImageVectorGenerator.convert( + val vectorSpecOutput = kotlinx.coroutines.withContext(Dispatchers.Default) { + ImageVectorGenerator.convert( vector = icon.irImageVector, iconName = icon.iconName.name, config = ImageVectorGeneratorConfig( packageName = icon.iconPack.iconPackage, iconPackPackage = settings.iconPackPackage, packName = settings.iconPackName, nestedPackName = "", outputFormat = settings.outputFormat, useComposeColors = settings.useComposeColors, generatePreview = settings.generatePreview, previewAnnotationType = settings.previewAnnotationType, - useFlatPackage = settings.flatPackage, + useFlatPackage = false, useExplicitMode = settings.useExplicitMode, addTrailingComma = settings.addTrailingComma, indentSize = settings.indentSize, ), - ) + ) + } vectorSpecOutput.content.writeToKt( outputDir = settings.iconPackDestination, nameWithoutExtension = vectorSpecOutput.name, ) } - } - } - - _events.emit(ConversionEvent.ExportCompleted) - reset() + } + } + + _events.emit(ConversionEvent.ExportCompleted) + reset() + } finally { + // optional: if you want to guarantee leaving ExportingState on failures, update state here + } }(Setting
useFlatPackage = falseforIconPack.Singleis based on retrieved learnings about nested-only applicability; if this plugin intentionally differs, ignore that part.) Based on learnings,useFlatPackageis intended to apply only when nested packs are configured.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/conversion/IconPackConversionViewModel.kt(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 750
File: tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt:71-85
Timestamp: 2025-12-07T20:07:49.753Z
Learning: In the Valkyrie Gradle plugin (Kotlin), the `useFlatPackage` flag in `IconPackExtension` is only applicable when nested packs are configured. For single icon packs (without nested packs), the flag is intentionally not propagated to `ImageVectorGeneratorConfig` as there is no package hierarchy to flatten.
📚 Learning: 2025-12-07T20:07:49.753Z
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 750
File: tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt:71-85
Timestamp: 2025-12-07T20:07:49.753Z
Learning: In the Valkyrie Gradle plugin (Kotlin), the `useFlatPackage` flag in `IconPackExtension` is only applicable when nested packs are configured. For single icon packs (without nested packs), the flag is intentionally not propagated to `ImageVectorGeneratorConfig` as there is no package hierarchy to flatten.
Applied to files:
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/conversion/IconPackConversionViewModel.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build (ubuntu-latest)
🔇 Additional comments (1)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/conversion/IconPackConversionViewModel.kt (1)
317-320: Formatting-only change inprocessTextis fine.
No semantic change;runCatching { ... }.getOrNull()still behaves the same.
dd4e5a2 to
a210cb5
Compare
No description provided.