cmake: Find Apple ID via IDEProvisioningTeamByIdentifier for Xcode 16.2

The format of the Xcode preferences has changed, so we need to account
for the new format when looking up the default development team.

Pick-to: 6.5
Change-Id: Ib34c2e5245c13db4d81218a5a2460417e4fc6347
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 469e4237cf32d27609661132727555490086750b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8f837f6e6f4a9d5c118514dcc80894406e9b5dcb)
This commit is contained in:
Tor Arne Vestbø 2025-02-04 12:36:21 +01:00 committed by Qt Cherry-pick Bot
parent b750a02916
commit 1e6ba42f12

View File

@ -116,10 +116,24 @@ function(_qt_internal_find_apple_development_team_id out_var)
# Extract the first account name (email) from the user's Xcode preferences
message(DEBUG "Trying to extract an Xcode development team id from '${xcode_preferences_path}'")
execute_process(COMMAND "/usr/libexec/PlistBuddy"
-x -c "print IDEProvisioningTeams" "${xcode_preferences_path}"
OUTPUT_VARIABLE teams_xml
ERROR_VARIABLE plist_error)
# Try Xcode 16.2 format first
_qt_internal_plist_buddy("${xcode_preferences_path}"
COMMANDS "print IDEProvisioningTeamByIdentifier"
EXTRA_ARGS -x
OUTPUT_VARIABLE teams_xml
ERROR_VARIABLE plist_error
)
# Then fall back to older format
if(plist_error OR NOT teams_xml)
_qt_internal_plist_buddy("${xcode_preferences_path}"
COMMANDS "print IDEProvisioningTeams"
EXTRA_ARGS -x
OUTPUT_VARIABLE teams_xml
ERROR_VARIABLE plist_error
)
endif()
# Parsing state.
set(is_free "")
@ -152,6 +166,16 @@ function(_qt_internal_find_apple_development_team_id out_var)
# ...
# </dict>
# </array>
# <key>AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE</key>
# <array>
# <dict>
# <key>isFreeProvisioningTeam</key>
# <false/>
# <key>teamID</key>
# <string>CCC</string>
# ...
# </dict>
# </array>
#</dict>
#</plist>
if(teams_xml AND NOT plist_error)