Xcode should set an environment variable with the action selected from the Product menu

Originator:hello
Number:rdar://17887874 Date Originated:01-Aug-2014 12:37 PM
Status:Open Resolved:
Product:Developer Tools Product Version:5.1.1 (5B1008)
Classification:Enhancement Reproducible:Always
 
Summary:
I would like to run certain script phases only when Product->Analyze is selected. Mostly these would be 3rd-party tools like ObjClean and Faux Pas. There’s no reliable way to tell from a script phase that analyze was selected vs. build.

Expected Results:
I would have expected the ACTION env var to be set to the command used in Xcode but I realize that’s probably overloaded at this point. Perhaps setting XCODE_ACTION would work?

Actual Results:
With a stock configuration the only hint that we’re analyzing instead of building is that these are set
  export RUN_CLANG_STATIC_ANALYZER=YES
  export CLANG_STATIC_ANALYZER_MODE=deep

Obviously these can’t be relied on since they can be changed in build settings.

Comments

This can be done today as a scheme pre- or post- action, and that is the recommended way to do what you are trying to do. Go to Edit Scheme Select the Analyze action Select the pre- or post- action, add a script.


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!