Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode doesn't seem to execute my scheme's post-action

Tags:

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:

  1. I have a script build_me that is my external build tool
  2. I have a script run_me that I set my scheme to run
  3. I have a script cleanup that I want to have as run post-action

Can't get Xcode to run my post-action script or any.

like image 971
Daij-Djan Avatar asked May 20 '13 22:05

Daij-Djan


People also ask

How do I manage Xcode schemes?

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.

How to create a swift project in Xcode?

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.

How do I create a single view app in Xcode?

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.


2 Answers

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
like image 71
Ondrej Rafaj Avatar answered Oct 04 '22 00:10

Ondrej Rafaj


This works on Xcode 5.0, tested, I figure it should work the same in 4.6.2.

Post-actions only works when you quit the program from within the program

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.

Using a bash script file for Post-actions

These settings work: enter image description here

like image 32
Dannie Avatar answered Oct 04 '22 00:10

Dannie