Skip to content

fix: conform CFBundleVersion to documentation #167

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

Merged
merged 3 commits into from
May 28, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented May 27, 2025

Second PR for #47.

Previously, we were setting CFBundleVersion to the output of git describe --tags (vX.Y.Z or vX.Y.Z-N-gHASH for preview builds).

To support Sparkle, and potentially to avoid a breakage with macOS failing to update an installed LaunchDaemon when it can't parse CFBundleVersion, we'll conform the string to the specification.

Given that:

You can include more integers but the system ignores them.

We set CFBundleVersion to a value of the form X.Y.Z[.N] where N is the number of commits since the X.Y.Z tag (omitted if 0)

Sparkle did previously allow you to supply a manual version comparator, but it was deprecated to help require CFBundleVersion start with X.Y.Z sparkle-project/Sparkle#2585

That issue recommends instead putting marketing version information in CFBundleShortVersionString, but that actually has even stricter requirements: https://developer.apple.com/documentation/bundleresources/information-property-list/cfbundleshortversionstring

Though not documented, from testing & reading the Sparkle source, I discovered that X.Y.Z.N+1 will be deemed a later version than X.Y.Z.N, which is what we'll do for the preview stream of auto-updates.

For non-preview builds (i.e. builds on a tag), both version strings will be X.Y.Z.

Since we're no longer including the commit hash in a version string, we instead embed it separately in the Info.plist so we can continue to display it in the UI:
image

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ethanndickson ethanndickson marked this pull request as ready for review May 27, 2025 10:10
Copy link
Member

@deansheather deansheather left a comment

Choose a reason for hiding this comment

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

We set CFBundleVersion to a value of the form X.Y.Z[.N] where N is the number of commits since the X.Y.Z tag (omitted if 0)

I think we should just always include the .0.

@@ -33,5 +33,7 @@
</dict>
<key>SUPublicEDKey</key>
<string>Ae2oQLTcx89/a73XrpOt+IVvqdo+fMTjo3UKEm77VdA=</string>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<string>Ae2oQLTcx89/a73XrpOt+IVvqdo+fMTjo3UKEm77VdA=</string>
<string>Ae2oQLTcx89/a73XrpOt+IVvqdo+fMTjo3UKEm77VdA=</string>

@ethanndickson
Copy link
Member Author

ethanndickson commented May 28, 2025

I think we should just always include the .0.

There's some other documentation on CFBundleVersion that says:

While developing a new version of your app, you can include a suffix after the number that is being updated; for example 3.1.3a1. The character in the suffix represents the stage of development for the new version. For example, you can represent development, alpha, beta, and final candidate, by d, a, b, and fc. The final number in the suffix is the build version, which cannot be 0 and cannot exceed 255. When you release the new version of your app, remove the suffix.

https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102364

This documentation might be outdated? I have no clue why it's documented twice, but I'm happy to just omit it if it's 0. I think what they've said here makes sense.

Relevant: https://developer.apple.com/forums/thread/704458

Copy link
Member Author

ethanndickson commented May 28, 2025

Merge activity

  • May 28, 5:24 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 28, 5:25 AM UTC: @ethanndickson merged this pull request with Graphite.

@ethanndickson ethanndickson merged commit 7af0cdc into main May 28, 2025
4 checks passed
@ethanndickson ethanndickson deleted the ethan/cfbundleversion-fix branch May 28, 2025 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants