xcodebuild -showBuildSettings ignores configuration from scheme

Originator:daniel
Number:rdar://26950139 Date Originated:22-Jun-2016 12:31 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.3 (7D175) and Xcode 8.0 (8S128d)
Classification:Serious Bug Reproducible:Always
 
Summary:
A scheme contains the combination of target and configuration for a number of possible actions. In theory and according to its manpage, `xcodebuild -showBuildSettings` should list the resolved build settings for a scheme.

In practice `xcodebuild -showBuildSettings` completely ignores the configuration set in the scheme, and instead uses the configuration set in the project’s info tab for “Use <Configuration> for command-line builds”.
This is extremely unpleasant, as it makes it unnecessarily hard to get at the build output of an `xcodebuild build` — which in fact uses the configuration set for the `Run` action.

Steps to Reproduce:
1. create a new static library target for iOS
2. verify that in the info tab of the project, the “Release” configuration is selected for command–line builds
3. Duplicate the “Release” configuration under the name “Run”
4. Duplicate the “Release” configuration under the name “Archive”
5. Duplicate the “Release” configuration under the name “Analyze”
6. Turn the default scheme into a shared one,
7. Select “Run” as the configuration to use for the “Run” action, and use the other freshly created configurations for the other actions accordingly
8. In Terminal, change into the directory containing the project.
9. Run the following command, substituting `build`, `archive`, and `analyze` for `${build_action}`:

xcodebuild \
      -scheme "${your_scheme_name}" \
      -showBuildSettings \
      ${build_action} \
    | grep -E '^[[:space:]]*CONFIGURATION =' \
    | sed -E 's/^[[:space:]]*CONFIGURATION = (.+)$/\1/'

Expected Results:
When run with the build actions `build`, `archive`, and `analyze`, this should yield `Run`, `Archive`, and `Analyze` — in that order.

Actual Results:
The output of the command is `Release`, `Release`, and `Release`.

Version:
Happens on both Xcode 7.3 (7D175) and Xcode 8.0 (8S128d)

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!