-
Notifications
You must be signed in to change notification settings - Fork 11
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
Conversation
There was a problem hiding this 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 incomponents/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 incomponents/generator/common/src/main/kotlin/io/github/composegears/valkyrie/generator/model/IconPackDsl.kt
, simplifying the definition of nested icon packs. - Refactor IconPackGeneratorConfig: Updates
IconPackGeneratorConfig
incomponents/generator/iconpack/src/main/kotlin/io/github/composegears/valkyrie/generator/iconpack/IconPackGenerator.kt
to use theIconPack
model instead of separateiconPackName
andnestedPacks
properties. - Update IconPackFileSpec: Modifies
IconPackFileSpec
incomponents/generator/iconpack/src/main/kotlin/io/github/composegears/valkyrie/generator/iconpack/IconPackFileSpec.kt
to use theIconPack
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 incomponents/generator/common/src/test/kotlin/io/github/composegears/valkyrie/generator/model/IconPackDslTest.kt
and updates existing tests incomponents/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 theIconPack
model for nested packs.
- Imported the
- cli/src/test/kotlin/io/github/composegears/valkyrie/cli/IconPackCliTest.kt
- Updated the expected resource for nested packs test to
IconPack.nested.L2.kt
.
- Updated the expected resource for nested packs test to
- components/generator/common/src/main/kotlin/io/github/composegears/valkyrie/generator/model/IconPack.kt
- Created a new
IconPack
data class withname
andnested
properties.
- Created a new
- components/generator/common/src/main/kotlin/io/github/composegears/valkyrie/generator/model/IconPackDsl.kt
- Created a DSL for defining
IconPack
models usingiconpack
andpack
functions.
- Created a DSL for defining
- 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.
- Added tests for the
- components/generator/iconpack/src/main/kotlin/io/github/composegears/valkyrie/generator/iconpack/IconPackFileSpec.kt
- Modified
createSpec
to useconfig.iconPack.name
instead ofconfig.iconPackName
. - Implemented
createNestedObjectSpec
to recursively create nested object specs based on theIconPack
model.
- Modified
- components/generator/iconpack/src/main/kotlin/io/github/composegears/valkyrie/generator/iconpack/IconPackGenerator.kt
- Updated
IconPackGeneratorConfig
to useIconPack
instead oficonPackName
andnestedPacks
.
- Updated
- components/generator/iconpack/src/test/kotlin/io/github/composegears/valkyrie/generator/iconpack/IcoPackWithIndentTest.kt
- Updated
createConfig
to use theIconPack
model for defining nested packs.
- Updated
- components/generator/iconpack/src/test/kotlin/io/github/composegears/valkyrie/generator/iconpack/IconPackGeneratorTest.kt
- Updated
createConfig
to use theIconPack
model. - Added tests for generating nested packs up to level 4, using the new
IconPack
DSL.
- Updated
- components/generator/imagevector/build.gradle.kts
- Changed
implementation
toapi
forprojects.components.generator.common
- Changed
- 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 theIconPack
model.
- Imported the
- 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 theIconPack
model.
- Imported the
- 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 theIconPack
model.
- Imported the
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
-
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. ↩
There was a problem hiding this 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 toIconPack.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
incomponents/generator/imagevector/build.gradle.kts
was changed fromimplementation
toapi
. 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.
cli/src/test/kotlin/io/github/composegears/valkyrie/cli/IconPackCliTest.kt
Show resolved
Hide resolved
0fd3f2b
to
b985c74
Compare
b985c74
to
3264ce9
Compare
No breaking changes for now 🙂
Ref: #212