I'm using Xcode (4.6.2) and my target is an external build tool. The auto generated scheme calls that just fine during build.
On RUNNING, I wanted the scheme to execute another shell script. It wasn't intuitive, but I managed it by setting /bin/bash
as executable and passing my script as parameter.
The only step left is that I want to execute yet another script AFTER run. And here I thought it'd be easy and just tried to set it as a post-action.
BUT no matter what, I can't get xcode to execute my post-action script.
No matter what it is. I tried echo hi > /tmp/testfile
even...
I need that post-action to do a bit of cleanup.
Again in short:
build_me
that is my external build toolrun_me
that I set my scheme to runcleanup
that I want to have as run post-actionCan't get Xcode to run my post-action script or any.
The configurations that we just created now need to be associated with an XCode scheme. For more information on what a scheme is, check out the apple documentation reference here. To do so, we need to manage the schemes of the project. Open the scheme manager. Select Product -> Scheme -> Manage Schemes … from the toolbar. 2.
Give the project a Product Name, Team, Organization Name, Organization Identifier, and set the language to Swift. 3. Click Next and save the project in the location of your choice. The first part that needs to be taken care of is the creation of different configurations in XCode for each of the environments we want to support.
Start by opening XCode, and creating a new Xcode project. Use a Single View App as a template. 2. Give the project a Product Name, Team, Organization Name, Organization Identifier, and set the language to Swift. 3. Click Next and save the project in the location of your choice.
I suggest you enable logging to a file by adding exec > /tmp/xcode_build.log 2>&1
to the beginning of your run script phase.
You can than see the log by running cat /tmp/xcode_build.log
in terminal
This will allow you to print out paths, etc and verify functionality of your scripts.
To print location of the script, you can put following in your post-action:
exec > /tmp/my_log_file.txt 2>&1
pwd
This works on Xcode 5.0, tested, I figure it should work the same in 4.6.2.
It will not run when you click on Stop in Xcode, or terminate the program otherwise. For my case, it works when I press CMD-Q while the program is in focus.
These settings work:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With