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 10 forks source link

Setting version in Info.plist in unit testing targets doesn't work since 2.0.0 #38

Closed nathansalaun-sofia closed 9 months ago

nathansalaun-sofia commented 9 months ago

Troubleshooting

Useful information

Issue description

With the new 2.0.0 version released yesterday, setting the build number in Info.plist doesn't seem to work anymore on unit test targets (CI/CD in pull requests to make sure tests pass).

The simulator refuses to run the test app because The application's Info.plist does not contain a valid CFBundleVersion..

Here are the step logs:

Input:
- project_path: REDACTED/REDACTED.xcworkspace
- scheme: REDACTED - Dev
- target: <unset>
- configuration: <unset>
- build_version: 12110
- build_version_offset: 0
- build_short_version_string: <unset>
[15:09:09] Locating built project for xcode project: REDACTED/REDACTED.xcworkspace, scheme: REDACTED - Dev
Read REDACTED - AppStore scheme in 0s.
Read REDACTED - Dev scheme in 0s.
Read REDACTED - Functional Test scheme in 0s.
Read REDACTED - Release scheme in 0s.
Read REDACTED2 - AppStore scheme in 0s.
Read REDACTED2 - Dev scheme in 0s.
Read REDACTED2 - Release scheme in 0s.
[15:09:09] Located built project for scheme: REDACTED - Dev
The version numbers are stored in the plist file.
Version numbers successfully updated.

It says "version numbers successfully updated" but the plist doesn't seem to be updated.

The plist in the repo contains the following data:

    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>

The previous step version works properly. Here are the logs from the 1.x step:

 (i) Provided Info.plist path: /Users/vagrant/git/REDACTED/REDACTED/Info.plist
 (i) Build number offset: 0
 (i) Build number: 12111
# ---- Current Bundle Version:
/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${CONFIG_project_info_plist_path}"
$(CURRENT_PROJECT_VERSION)
# ---- Set Bundle Version:
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${CONFIG_new_bundle_version}" "${CONFIG_project_info_plist_path}"
 if [ ! -z "${CONFIG_new_build_short_version_string}" ] ; then
   # ---- Current Bundle Short Version String:
   /usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${CONFIG_project_info_plist_path}"
  # ---- Set Bundle Short Version String:
  /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${CONFIG_new_build_short_version_string}" "${CONFIG_project_info_plist_path}"
fi
# ==> Bundle Version and Short Version changed

I rolled back the step to the latest 1.x version as a temporary workaround. It immediately worked and our builds are back to normal.

Regular app builds (not testing runs) work fine.

Bitrise info

oronbz commented 9 months ago

Same here, I've reverted to 1.x.x since tests are failing due to this exact issue.

naninydhruva commented 9 months ago

I have also one issue with new 2.x.x version, with this version I am unable to upload the ipa to app store connect through bitrise. 2024-02-10 08:28:29.410 altool[33709:1[REDACTED]867] -[NSCFNumber length]: unrecognized selector sent to instance 0x87bfd06d130bb5ab 2024-02-10 08:28:29.411 *** Error: ERROR: [ContentDelivery.Uploader] createRequestBuildCreateJsonWithResponse: caught an exception: -[NSCFNumber length]: unrecognized selector sent to instance 0x87bfd06d130bb5ab 2024-02-10 08:28:29.411 *** Error: Exception caught. -[NSCFNumber length]: unrecognized selector sent to instance 0x87bfd06d130bb5ab (-1010) { NSLocalizedDescription = "Exception caught."; NSLocalizedFailureReason = "-[NSCFNumber length]: unrecognized selector sent to instance 0x87bfd06d130bb5ab"; } Uploading IPA failed: exit status 1

this issue occured while deploying can anyone help me with this error?

tothszabi commented 9 months ago

Thanks for reporting this. I have released a new version fixing this: https://github.com/bitrise-steplib/steps-set-xcode-build-number/releases/tag/2.0.1