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

Integrate Preview annotation type for icon generation and CLI #376

Merged
merged 1 commit into from
Mar 7, 2025

Conversation

egorikftp
Copy link
Member

@egorikftp egorikftp commented Mar 6, 2025

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 introduces a new PreviewAnnotationType to allow users to specify whether to use AndroidX or Jetbrains Preview annotations when generating ImageVector code. This change affects both the CLI tool and the core generator library. The PR also updates the CLI to accept a --preview-annotation-type argument and modifies the test suite to include tests for both annotation types.

Highlights

  • New Feature: Preview Annotation Type: Introduces the ability to specify the type of Preview annotation (AndroidX or Jetbrains) for generated ImageVector code.
  • CLI Integration: Updates the CLI tool to accept a --preview-annotation-type argument, allowing users to select the desired annotation type.
  • Test Suite Expansion: Adds new tests to verify the correct generation of both AndroidX and Jetbrains Preview annotations in various scenarios (with/without icon pack, nested pack).
  • Codebase Updates: Updates codebase to include the new PreviewAnnotationType in relevant classes and functions.

Changelog

Click here to see the changelog
  • README.md
    • Updates the CLI build artifact name to use a wildcard for versioning.
  • cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/SvgXmlToImageVectorCommand.kt
    • Adds PreviewAnnotationType import.
    • Adds --preview-annotation-type option to the CLI.
    • Passes previewAnnotationType to the svgXml2ImageVector function.
    • Updates help messages for output format.
  • cli/src/test/kotlin/io/github/composegears/valkyrie/cli/SvgXmlToImageVectorCliTest.kt
    • Adds ImageVectorPreviewAnnotationType to test commands.
    • Adds tests for AndroidX and Jetbrains preview generation with and without icon packs and nested packs.
    • Modifies existing preview generation tests to be more specific (AndroidX).
    • Adds previewAnnotationType parameter to testConversion function.
  • components/generator/imagevector/src/main/kotlin/io/github/composegears/valkyrie/generator/imagevector/ImageVectorFileSpec.kt
    • Adds previewAnnotationType to ImageVectorSpecConfig.
  • components/generator/imagevector/src/main/kotlin/io/github/composegears/valkyrie/generator/imagevector/ImageVectorGenerator.kt
    • Adds previewAnnotationType to ImageVectorGeneratorConfig.
    • Passes previewAnnotationType to ImageVectorFileSpec.convert.
  • components/generator/imagevector/src/main/kotlin/io/github/composegears/valkyrie/generator/imagevector/spec/Common.kt
    • Passes previewAnnotationType to iconPreviewSpecForNestedPack and iconPreviewSpec.
  • components/generator/imagevector/src/main/kotlin/io/github/composegears/valkyrie/generator/imagevector/util/Names.kt
    • Adds AndroidXPreview and JetbrainsPreview class names.
  • components/generator/imagevector/src/main/kotlin/io/github/composegears/valkyrie/generator/imagevector/util/PreviewSpec.kt
    • Adds addPreviewAnnotation function to add the correct annotation based on the type.
    • Removes the hardcoded showBackground = true from the preview annotation.
    • Modifies iconPreviewSpecForNestedPack and iconPreviewSpec to use the new addPreviewAnnotation function.
  • components/generator/imagevector/src/test/kotlin/io/github/composegears/valkyrie/generator/imagevector/ImageVectorWithPreviewTest.kt
    • Adds tests for AndroidX and Jetbrains preview generation with and without icon packs and nested packs.
    • Modifies existing preview generation tests to be more specific (AndroidX).
  • components/generator/imagevector/src/test/kotlin/io/github/composegears/valkyrie/generator/imagevector/common/TestImageVectorConfig.kt
    • Adds previewAnnotationType parameter to createConfig function.
  • components/sharedTestResources/imagevector/kt/backing/*
    • Adds new test resources for AndroidX and Jetbrains preview annotations in various scenarios.
    • Removes showBackground = true from the preview annotation.
  • components/sharedTestResources/imagevector/kt/lazy/*
    • Adds new test resources for AndroidX and Jetbrains preview annotations in various scenarios.
    • Removes showBackground = true from the preview annotation.
  • idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/conversion/IconPackConversionViewModel.kt
    • Passes previewAnnotationType to ImageVectorGenerator.convert.
  • idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/viewmodel/SimpleConversionViewModel.kt
    • Passes previewAnnotationType to ImageVectorGenerator.convert.
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.


The Valkyrie soars, with wings of code,
Crafting vectors, a visual ode.
With previews bright, in shades so fine,
Annotations chosen, a design divine.

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 introduces a new previewAnnotationType to allow users to specify whether to use AndroidX or Jetbrains Preview annotations. This is a useful feature for projects targeting different platforms. The code is generally well-structured and the changes seem to be correctly implemented.

Summary of Findings

  • Help message improvements: The help messages for --output-format and --preview-annotation-type could be slightly improved for clarity and consistency.
  • Test case naming: The test case names could be more descriptive to clearly indicate the purpose of each test.
  • Redundant showBackground parameter: The showBackground = true parameter in the Preview annotation is redundant and can be removed.

Merge Readiness

The pull request is almost ready for merging. Addressing the comments regarding the help messages and test case naming would improve the overall quality of the code. I am unable to approve this pull request, and recommend that others review and approve this code before merging.

@egorikftp egorikftp requested a review from Goooler March 6, 2025 19:55
@egorikftp egorikftp merged commit 462f009 into main Mar 7, 2025
5 checks passed
@egorikftp egorikftp deleted the feature/integrate-preview-annotation-type branch March 7, 2025 05:28
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.

2 participants