codemagic-ci-cd / cli-tools

Various utilities to managing Android and iOS app builds, code signing, and deployment.
https://codemagic.io/start/
GNU General Public License v3.0
245 stars 42 forks source link

Fix setting provisioning profile specifiers for specific SDKs #371

Closed priitlatt closed 11 months ago

priitlatt commented 11 months ago

Setting code signing settings for Xcode project with xcode-project use-profiles does not override platform-specific provisioning profile assignations. For example, if my project file already contains entry such as

"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Original Profile";

then running xcode-project use-profile just adds another PROVISIONING_PROFILE_SPECIFIER definition for the target:

PROVISIONING_PROFILE_SPECIFIER = "Another Profile";

which results in a conflicting provisioning code signing setup because both profiles are defined in the project.pbxproj file:

"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Original Profile";
PROVISIONING_PROFILE_SPECIFIER = "Another Profile";

Now, if the original profile that is referenced for specific SDK does not exist in ~/Library/MobileDevice/Provisioning Profiles, which might very well be the case when build is running on a VM from CI environment, then xcodebuild build is destined to fail.

Changes to code_signing_manager.rb ensure that all PROVISIONING_PROFILE_SPECIFIER build settings for target are properly updated when xcode-project use-profiles is launched.

Updated actions: