xcodebuild exportArchive error is less helpful than it should be

Originator:mayoff
Number:rdar://35594336 Date Originated:16-Nov-2017 01:44 PM
Status:Open Resolved:
Product:Developer Tools Product Version:macOS 10.12.6 (16G29) / Xcode 9.2 beta (9C34b)
Classification:UI/Usability Reproducible:Always
 
Summary:
Dear Xcoderinos,

Please consider the attached project. It contains two targets: a macOS app (“test”) and a macOS command line program (“cmdline”). The test app depends on the cmdline program.

I build the project from the command line, then try to export a Developer ID signed app. Here’s my command line:

    rm -rf build && xcodebuild -jobs 8 -scheme test -configuration Release -derivedDataPath build -archivePath build/test-1.xcarchive archive && xcodebuild -exportArchive -exportOptionsPlist options.plist -archivePath build/test-1.xcarchive -exportPath build

The exportArchive command fails with this error:

    error: exportArchive: exportOptionsPlist error for key 'method': expected one of {}, but found developer-id

    Error Domain=IDEFoundationErrorDomain Code=1 "exportOptionsPlist error for key 'method': expected one of {}, but found developer-id" UserInfo={NSLocalizedDescription=exportOptionsPlist error for key 'method': expected one of {}, but found developer-id}

But the problem is **not** my method setting. The problem is the file build/test-1.xcarchive/Products/usr/local/bin/cmdline.

I can prevent the earlier archive command from creating this file by setting SKIP_INSTALL = NO for the cmdline target. If I do that, then the exportArchive command succeeds.

Please change the xcodebuild -exportArchive command to describe what part of the archive is preventing the export.

Thanks,
Rob


Steps to Reproduce:
1. Do that stuff I described above.


Expected Results:
A helpful error message.


Actual Results:
An unhelpful error message.


Version:
macOS 10.12.6 (16G29) / Xcode 9.2 beta (9C34b)

Notes:
I found some guidance in https://developer.apple.com/library/content/technotes/tn2215/_index.html but the note doesn’t mention setting Skip Install for command-line targets, only for static libraries.  It would be great to update the note to also mention command-line targets, and then the exportArchive command could link to the note in its error message.

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!