[REGRESSION] Xcode doesn't read CODE_SIGN_ENTITLEMENTS passed in xcconfig specified at CLI

Originator:nicholas.helke
Number:rdar://31342527 Date Originated:2017-03-30
Status:Closed Resolved:DUPLICATE OF 31456053 (CLOSED)
Product:Developer Tools Product Version:Xcode 8.3
Classification:Bug Reproducible:Always
 
Summary:
Prior to Xcode 8.2 (possibly 8.1) Xcode would seemingly completely ignore CODE_SIGN_ENTITLEMENTS passed to xcodebuild. When passing custom CODE_SIGN_ENTITLEMENTS at CLI, the original CODE_SIGN_ENTITLEMENTS would be read and the build would fail prerequisite checks because of the erroneous entitlements. Removing the entitlements file, to nudge Xcode to read the CODE_SIGN_ENTITLEMENTS file passed to xcodebuild would error because the original entitlements file could not be found. Leading me to believe that CODE_SIGN_ENTITLEMENTS passed as override is completely ignored.

Xcode 8.2 fixed this. Everything worked as expected.

Xcode 8.3 breaks this. CODE_SIGN_ENTITLEMENTS overrides are once more ignored. This time hiding the original entitlements file specified in the project, by temporarily renaming it, successfully gets Xcode to read the custom entitlements.

This currently requires us to have a rather dirty and failure prone hack in our build system:

    mv Project/project.entitlements Project/project.entitlements.bak
    xcodebuild archive -scheme Project CODE_SIGN_ENTITLEMENTS=custom.entitlements
    mv Project/project.entitlements.bak Project/project.entitlements

Steps to Reproduce:
Using a project with some entitlements (we'll use push for example)

1. Create an override entitlements without push
2. Run xcodebuild archive -scheme Project CODE_SIGN_ENTITLEMENTS=/path/to/custom.entitlements PROVISIONING_PROFILE=profile-id-without-push


Expected Results:
xcodebuild should build

Actual Results:
xcodebuild fails prerequisite check because profile-id-without-push doesn't support push, even though the entitlements in /path/to/custom.entitlements match those in profile-id-without-push

Version:
Xcode 8.3

Notes:


Configuration:


Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!