Reputation: 5028
In Xcode build ref:
It says:
ACTION
Description:
Identifier. Identifies the type of build to perform on the target.
Then I make a small script in scheme->build->pre-actions:
echo "action:"
echo ${ACTION}
But $ACTION
seems empty.
I also tried other variables like $BUILD_VARIANTS
and they are normal, so I'm pretty sure it's not my script's fault.
Does anyone have the same issue?
Upvotes: 2
Views: 1980
Reputation: 5028
I've found the solution below:
Now I add the script in "build phases" then it worked. I also found some interesting stuff in Xcode's build log:
cd /Users/developer/project/resourceTest
setenv ACTION build
setenv AD_HOC_CODE_SIGNING_ALLOWED NO
setenv ALTERNATE_GROUP staff
setenv ALTERNATE_MODE u+w,go-w,a+rX
......
So it seems Xcode set these environment variables in "build phase" but not in "post actions". You can run some scripts or send an E-mail in "post actions" but not all of these environment variables used by project are guaranteed that can be used properly.
Furthermore, you can't get any script error message when it's running at "post actions". Xcode also ignores these errors so your build process won't crash.
Upvotes: 1