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

Bugfix: xcode-project detect-bundle-id fails with KeyError #280

Merged
merged 4 commits into from
Oct 25, 2022

Conversation

priitlatt
Copy link
Contributor

Action xcode-project detect-bundle-id can fail with KeyError if the output of

xcodebuild -showBuildSettings -project ... -target ... -json

that we use under the hood outputs build settings that do not contain entry for PRODUCT_BUNDLE_IDENTIFIER.

Stacktrace:

Traceback (most recent call last):
File "/Users/builder/.pyenv/versions/3.8.7/lib/python3.8/site-packages/codemagic/cli/cli_app.py" line 204 in invoke_cli
    CliApp._running_app._invoke_action(args)
File "/Users/builder/.pyenv/versions/3.8.7/lib/python3.8/site-packages/codemagic/cli/cli_app.py" line 160 in _invoke_action
    return cli_action(**action_args)
File "/Users/builder/.pyenv/versions/3.8.7/lib/python3.8/site-packages/codemagic/cli/cli_app.py" line 428 in wrapper
    return func(*args, **kwargs)
File "/Users/builder/.pyenv/versions/3.8.7/lib/python3.8/site-packages/codemagic/tools/xcode_project.py" line 72 in detect_bundle_id
    bundle_ids = Counter[str](
File "/Users/builder/.pyenv/versions/3.8.7/lib/python3.8/typing.py" line 729 in __call__
    result = self.__origin__(*args, **kwargs)
File "/Users/builder/.pyenv/versions/3.8.7/lib/python3.8/collections/__init__.py" line 552 in __init__
    self.update(iterable, **kwds)
File "/Users/builder/.pyenv/versions/3.8.7/lib/python3.8/collections/__init__.py" line 637 in update
    _count_elements(self, iterable)
File "/Users/builder/.pyenv/versions/3.8.7/lib/python3.8/site-packages/codemagic/tools/xcode_project.py" line 75 in <genexpr>
    for bundle_id in self._detect_project_bundle_ids(
File "/Users/builder/.pyenv/versions/3.8.7/lib/python3.8/site-packages/codemagic/tools/xcode_project.py" line 582 in _detect_project_bundle_ids
    detected_bundle_ids = detector.detect()
File "/Users/builder/.pyenv/versions/3.8.7/lib/python3.8/site-packages/codemagic/models/bundle_id_detector.py" line 53 in detect
    return list(bundle_ids)
File "/Users/builder/.pyenv/versions/3.8.7/lib/python3.8/site-packages/codemagic/models/bundle_id_detector.py" line 81 in <genexpr>
    build_setting['buildSettings']['PRODUCT_BUNDLE_IDENTIFIER']
KeyError: PRODUCT_BUNDLE_IDENTIFIER

Just omit those build settings when detecting bundle identifier from a project.

Updated actions:

  • xcode-project detect-bundle-id

@priitlatt priitlatt added the bug Something isn't working label Oct 25, 2022
@priitlatt priitlatt marked this pull request as ready for review October 25, 2022 11:22
@priitlatt priitlatt merged commit ce052d8 into master Oct 25, 2022
@priitlatt priitlatt deleted the bugfix/bundle-id-detection branch October 25, 2022 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants