Skip to content

Embed the application icon into the openapi2zig binary - #117

Merged
christianhelle merged 9 commits into
mainfrom
feature/app-icon-output-binary-7a5802
Sep 15, 2026
Merged

christianhelle merged 9 commits into
mainfrom
feature/app-icon-output-binary-7a5802

Conversation

@christianhelle

@christianhelle christianhelle commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

Uses docs/icon.png as the application icon wherever the platform supports it.

What changed

  • Windows: resources/openapi2zig.ico (16–256 px, generated from docs/icon.png) and resources/openapi2zig.rc are embedded into the executable. build.zig has a new addApplicationIcon helper called for every exe definition: the default zig build, build-all cross builds, and the install-release* steps.
  • Linux: ELF binaries have no icon standard, so the snap package now declares icon: resources/openapi2zig.png in snapcraft.yaml (a 256×256 copy of docs/icon.png, the size the Snap Store requires).
  • macOS: not supported. Icons only apply to .app bundles, not to a bare Mach-O CLI binary distributed as a tarball.
  • resources is added to .paths in build.zig.zon and to the package snapshot file list, so downstream packages still have the files.
  • docs/icon.png is updated to the latest 240×240 version from main (identical content, so no conflict on merge).

Notes for reviewers

  • Module.addWin32ResourceFile is a no-op for non-COFF targets, so the helper needs no per-target check.
  • The 256 px ICO entry is a slight upscale from the 240 px source.
  • If docs/icon.png changes again, the .ico must be regenerated (e.g. with Pillow).

Verification

  • zig build: the embedded icon was extracted back out of openapi2zig.exe and matches.
  • zig build build-all: all 5 targets build.
  • zig build test-package: passes.
  • The snap package was not built.

Summary by CodeRabbit

  • New Features
    • Added a custom application icon for Windows executables.
    • Added a custom icon for the Snap package.
    • Included icon resources in packaged distributions.

Copilot AI lite review requested due to automatic review settings September 15, 2026 08:18
@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 4cd5233c-9b27-4e30-b840-a4f4f07069a1

📥 Commits

Reviewing files that changed from the base of the PR and between a74cfc7 and feb9cd7.

⛔ Files ignored due to path filters (1)
  • resources/openapi2zig.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • snapcraft.yaml

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 17f02d90-83c0-4b84-82b9-c47b73263d3d

📥 Commits

Reviewing files that changed from the base of the PR and between 512811e and a74cfc7.

⛔ Files ignored due to path filters (2)
  • docs/icon.png is excluded by !**/*.png
  • resources/openapi2zig.ico is excluded by !**/*.ico
📒 Files selected for processing (4)
  • build.zig
  • build.zig.zon
  • resources/openapi2zig.rc
  • snapcraft.yaml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The build now embeds a Windows icon in CLI executables. The resources directory is included in package snapshots and Zig package paths. Snap metadata now references docs/icon.png.

Changes

Application icon packaging

Layer / File(s) Summary
Windows executable icon embedding
build.zig, resources/openapi2zig.rc
The build defines a Windows resource script and applies it to main, cross-compiled, and installed executables.
Package icon asset inclusion
build.zig, build.zig.zon, snapcraft.yaml
Package snapshots and Zig package paths include resources. Snap metadata references docs/icon.png.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Feature

Suggested reviewers: copilot

Merge Risk: ⚪ Minimal · up to a74cf

The localized icon packaging changes have no confirmed failure in the supported Windows and Snap metadata paths, so the change is mergeable.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary change: embedding the application icon into the openapi2zig executables. It does not mention the related Snap metadata and packaging updates, but the title does…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/app-icon-output-binary-7a5802

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The Snap icon must be provided as a 256×256 PNG.

Pull request overview

Adds application icon support for Windows executables and Snap packages.

Changes:

  • Embeds the Windows icon resource across executable builds.
  • Includes resource files in package contents.
  • Declares the application icon in Snap metadata.
File summaries
File Summary
snapcraft.yaml Declares the Snap icon path; the icon must be 256×256 for acceptance.
resources/openapi2zig.rc Defines the embedded Windows icon resource.
build.zig.zon Includes resources in package contents.
build.zig Embeds the icon across executable build paths.
Review details

Suppressed comments (1)

snapcraft.yaml:14

  • Snap metadata requires a 256×256 PNG icon, but docs/icon.png is the 240×240 source used by this PR. Point icon at a 256×256 PNG (or add a resized snap-specific copy) so the snap can be accepted and display its icon; the ICO's 256 px entry does not satisfy this field.
icon: docs/icon.png
  • Files reviewed: 4/6 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@christianhelle christianhelle self-assigned this Sep 15, 2026
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.06%. Comparing base (4d0918b) to head (feb9cd7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #117   +/-   ##
=======================================
  Coverage   97.06%   97.06%           
=======================================
  Files         136      136           
  Lines       16941    16941           
=======================================
  Hits        16444    16444           
  Misses        497      497           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@christianhelle
christianhelle merged commit c85e185 into main Sep 15, 2026
7 checks passed
@christianhelle
christianhelle deleted the feature/app-icon-output-binary-7a5802 branch September 15, 2026 08:32
@christianhelle christianhelle added the enhancement New feature or request label Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants