Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor icon pack generator to use iconpack model for nested packs #379

Merged
merged 1 commit into from
Mar 9, 2025

Conversation

egorikftp
Copy link
Member

@egorikftp egorikftp commented Mar 8, 2025

No breaking changes for now 🙂

Ref: #212

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @egorikftp, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request refactors the icon pack generator to use an IconPack model for handling nested packs. This change introduces a new IconPack data class and a DSL for creating nested icon pack structures. The primary goal is to improve the organization and maintainability of the icon pack generation process, especially when dealing with complex nested structures.

Highlights

  • IconPack Model: Introduces a new IconPack data class in components/generator/common/src/main/kotlin/io/github/composegears/valkyrie/generator/model/IconPack.kt to represent icon packs and their nested structure.
  • IconPack DSL: Adds a DSL for creating IconPack models in components/generator/common/src/main/kotlin/io/github/composegears/valkyrie/generator/model/IconPackDsl.kt, simplifying the definition of nested icon packs.
  • Refactor IconPackGeneratorConfig: Updates IconPackGeneratorConfig in components/generator/iconpack/src/main/kotlin/io/github/composegears/valkyrie/generator/iconpack/IconPackGenerator.kt to use the IconPack model instead of separate iconPackName and nestedPacks properties.
  • Update IconPackFileSpec: Modifies IconPackFileSpec in components/generator/iconpack/src/main/kotlin/io/github/composegears/valkyrie/generator/iconpack/IconPackFileSpec.kt to use the IconPack model for generating nested icon pack structures.
  • Update CLI and Idea Plugin: Updates the CLI and Idea Plugin to use the new IconPack model when generating icon packs.
  • Add Tests: Adds tests for the new IconPack DSL in components/generator/common/src/test/kotlin/io/github/composegears/valkyrie/generator/model/IconPackDslTest.kt and updates existing tests in components/generator/iconpack/src/test/kotlin/io/github/composegears/valkyrie/generator/iconpack/IconPackGeneratorTest.kt to use the new model.

Changelog

Click here to see the changelog
  • cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/IconPackCommand.kt
    • Imported the IconPack model.
    • Modified the generateIconPack function to use the IconPack model for nested packs.
  • cli/src/test/kotlin/io/github/composegears/valkyrie/cli/IconPackCliTest.kt
    • Updated the expected resource for nested packs test to IconPack.nested.L2.kt.
  • components/generator/common/src/main/kotlin/io/github/composegears/valkyrie/generator/model/IconPack.kt
    • Created a new IconPack data class with name and nested properties.
  • components/generator/common/src/main/kotlin/io/github/composegears/valkyrie/generator/model/IconPackDsl.kt
    • Created a DSL for defining IconPack models using iconpack and pack functions.
  • components/generator/common/src/test/kotlin/io/github/composegears/valkyrie/generator/model/IconPackDslTest.kt
    • Added tests for the IconPack DSL, including simple, one-level nested, and multi-level nested icon packs.
  • components/generator/iconpack/src/main/kotlin/io/github/composegears/valkyrie/generator/iconpack/IconPackFileSpec.kt
    • Modified createSpec to use config.iconPack.name instead of config.iconPackName.
    • Implemented createNestedObjectSpec to recursively create nested object specs based on the IconPack model.
  • components/generator/iconpack/src/main/kotlin/io/github/composegears/valkyrie/generator/iconpack/IconPackGenerator.kt
    • Updated IconPackGeneratorConfig to use IconPack instead of iconPackName and nestedPacks.
  • components/generator/iconpack/src/test/kotlin/io/github/composegears/valkyrie/generator/iconpack/IcoPackWithIndentTest.kt
    • Updated createConfig to use the IconPack model for defining nested packs.
  • components/generator/iconpack/src/test/kotlin/io/github/composegears/valkyrie/generator/iconpack/IconPackGeneratorTest.kt
    • Updated createConfig to use the IconPack model.
    • Added tests for generating nested packs up to level 4, using the new IconPack DSL.
  • components/generator/imagevector/build.gradle.kts
    • Changed implementation to api for projects.components.generator.common
  • components/sharedTestResources/iconpack/IconPack.nested.L3.kt
    • Added a new test resource for a level 3 nested icon pack.
  • components/sharedTestResources/iconpack/IconPack.nested.L4.kt
    • Added a new test resource for a level 4 nested icon pack.
  • idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/creation/common/util/IconPackWriter.kt
    • Imported the IconPack model.
    • Modified the IconPackGeneratorConfig to use the IconPack model.
  • idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/ui/viewmodel/ExistingPackViewModel.kt
    • Imported the IconPack model.
    • Modified the IconPackGeneratorConfig to use the IconPack model.
  • idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/ui/viewmodel/NewPackViewModel.kt
    • Imported the IconPack model.
    • Modified the IconPackGeneratorConfig to use the IconPack model.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Trivia time!

What is KotlinPoet, which is used in this project?

Click here for the answer
KotlinPoet is a Kotlin and Java API for generating .kt source files. It's used to automate the generation of Kotlin code.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request refactors the icon pack generator to use an IconPack model for nested packs, improving the structure and maintainability of the code. The changes include creating a new IconPack data class and a DSL for defining icon packs, updating the generator to use the new model, and adding tests for the DSL. Overall, the changes seem well-organized and beneficial.

Summary of Findings

  • Test Resource Update: The test resource IconPack.nested.kt was renamed to IconPack.nested.L2.kt. Ensure that the old resource file is removed or updated if it's still relevant.
  • Dependency Scope: The dependency projects.components.generator.common in components/generator/imagevector/build.gradle.kts was changed from implementation to api. Verify that this change is intentional and doesn't expose unnecessary dependencies to consumers.

Merge Readiness

The pull request introduces significant refactoring and new features, and it appears to be well-tested. However, the change in dependency scope from implementation to api should be carefully considered. I am unable to approve this pull request, and recommend that others review and approve this code before merging. It would be best to address the dependency scope issue and ensure the old test resource is removed or updated before merging.

@egorikftp egorikftp force-pushed the task/update-iconpack-generation-logic branch 2 times, most recently from 0fd3f2b to b985c74 Compare March 8, 2025 17:16
@egorikftp egorikftp changed the base branch from feature/increase-nested-packs-limit to main March 9, 2025 06:25
@egorikftp egorikftp force-pushed the task/update-iconpack-generation-logic branch from b985c74 to 3264ce9 Compare March 9, 2025 06:26
@egorikftp egorikftp requested a review from Goooler March 9, 2025 06:26
@egorikftp egorikftp merged commit fdba361 into main Mar 9, 2025
4 checks passed
@egorikftp egorikftp deleted the task/update-iconpack-generation-logic branch March 9, 2025 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants