bitrise-steplib / steps-set-xcode-build-number

Sets the Build Number to the specified value in the Info.plist file for the next build
MIT License
7 stars 11 forks source link

Missing `CFBundleVersion` when using Xcode generate info plist #26

Closed markst closed 11 months ago

markst commented 2 years ago

Issue description

When using GENERATE_INFOPLIST_FILE in Xcode the CFBundleVersion is automatically removed from the Info.plist.

PlistBuddy fails to print current CFBundleVersion.

Bitrise info

+------------------------------------------------------------------------------+

| (4) set-xcode-build-number@1                                                 |
+------------------------------------------------------------------------------+
| id: set-xcode-build-number                                                   |
| version: 1.0.11                                                              |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: bash                                                                |
| time: 2022-06-03T15:18:40Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
INFO[15:18:40]  * [OK] Step dependency (xcode) installed, available. 
 (i) Provided Info.plist path: ./xxx/Resources/Info.plist
 (i) Build number: 762
# ---- Current Bundle Version:
/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${CONFIG_project_info_plist_path}"
Print: Entry, "CFBundleVersion", Does Not Exist
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | set-xcode-build-number@1 (exit code: 1)                       | 1.81 sec |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-io/set-xcode-build-number/issues   |
| Source: https://github.com/bitrise-io/set-xcode-build-number                 |
+---+---------------------------------------------------------------+----------+
  
markst commented 2 years ago

If Xcode is going to continue removing entries from Info.plist if using GENERATE_INFOPLIST_FILE then perhaps the step needs to conditionally to check presence of CFBundleVersion?

Something like this for instance:

set val=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${CONFIG_project_info_plist_path}"`
if ( "$val" == 0 ) then
    # ---- Current Bundle Version:
    /usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${CONFIG_project_info_plist_path}"

    # ---- Set Bundle Version:
    /usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${CONFIG_new_bundle_version}" "${CONFIG_project_info_plist_path}"
else 
    # ---- Add Bundle Version:
    /usr/libexec/PlistBuddy -c "Add :CFBundleVersion ${CONFIG_new_bundle_version}" "${CONFIG_project_info_plist_path}"
endif
bitrise-coresteps-bot commented 2 years ago

Hello there, I'm a bot. On behalf of the community I thank you for opening this issue.

To help our human contributors focus on the most relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 90 days, so I marked it as stale.

The community would appreciate if you could check if the issue still persists. If it isn't, please close it. If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me".

If no comment left within 21 days, this issue will be closed.

markst commented 2 years ago

still an issue

mharper commented 1 year ago

Still a problem.

dipkasyap commented 1 year ago

Still a problem.

dipkasyap commented 1 year ago
Screenshot 2022-11-09 at 1 20 08 pm
scottymack commented 1 year ago

Still an Issue.

Here is an alternate solution that has worked for us: https://discuss.bitrise.io/t/set-xcode-build-number-not-works-xcode-13-project/19138/4

More info on agvtool tool here: https://developer.apple.com/library/archive/qa/qa1827/_index.html

a-honcharov-it commented 1 year ago

Hi @viktorbenei @ofalvai We have the same issue, the problem is actual for both Xcode 13 and 14 projects.

Are you planning on any solution?

bitrise-coresteps-bot commented 1 year ago

Hello there, I'm a bot. On behalf of the community I thank you for opening this issue.

To help our human contributors focus on the most relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 90 days, so I marked it as stale.

The community would appreciate if you could check if the issue still persists. If it isn't, please close it. If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me".

If no comment left within 21 days, this issue will be closed.

markst commented 1 year ago

not tested lately. but still as issue far as I’m concerned

bitrise-coresteps-bot commented 1 year ago

Hello there, I'm a bot. On behalf of the community I thank you for opening this issue.

To help our human contributors focus on the most relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 90 days, so I marked it as stale.

The community would appreciate if you could check if the issue still persists. If it isn't, please close it. If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me".

If no comment left within 21 days, this issue will be closed.

bitrise-coresteps-bot commented 11 months ago

I'll close this issue as it doesn't seem to be relevant anymore. We believe an old issue probably has a bunch of context that's no longer relevant, therefore, if the problem still persists, please open a new issue.