Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Hey, wait up, Xcode shell script build phase!

Hey, wait up, Xcode shell script build phase!
Thread Tools
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
Oct 28, 2003, 05:44 PM
 
Okay, I have a shell script build phase in a target in an Xcode project. It runs at the end of the build process, copying the app bundle into a distribution folder and getting it packaged up nice and neat for distribution. This build phase ran great in Jaguar, but after upgrading to the new-style targets in Xcode, the thing is getting run at the same time as the linking phase (due to dual processors), resulting in an app bundle with no binary in the distribution folder.

I'm wondering if there's any way to get the shell script to wait until compiling is done before it does its thing. I'm interested in the "Inputs" and "Outputs" tables in the shell script's Info window, but I can't figure out how to add files to them. According to the docs,

The Inputs and Outputs tables let you specify the input and output files used by the script. The Inputs table specifies the files that the script operates on; the Outputs table specifies the files that the script produces. To add an entry to either of these tables, click in the table and type the name of the input or output file. Xcode determines whether to run the script by analyzing the input and output files. If the input files were modified more recently than the output files, Xcode executes the shell script. If you provide no outputs, Xcode runs the script every time you build the target.
However, clicking on the tables and typing does nothing.

What am I doing wrong?

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
Junior Member
Join Date: Dec 2000
Location: Houston, TX, USA
Status: Offline
Reply With Quote
Oct 30, 2003, 09:47 AM
 
A response i got about this on the xcode-users list from Apple, which worked for me:

"The bad news is the Shell Script Build Phase inspector is fairly broken in Xcode 1.0. The good news is that it is fixed in the next release.

With the current version you might be able to enter project-relative paths in the given table by clicking in the table, hitting return and then clicking in the new row to add the item."
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Oct 30, 2003, 10:42 AM
 
Originally posted by mikebeam:
A response i got about this on the xcode-users list from Apple, which worked for me:

"The bad news is the Shell Script Build Phase inspector is fairly broken in Xcode 1.0. The good news is that it is fixed in the next release.

With the current version you might be able to enter project-relative paths in the given table by clicking in the table, hitting return and then clicking in the new row to add the item."
Another workaround might be to "sleep" your shell script until the compiled output is present on the drive. Something like this:

Code:
sleep=true while [ sleep ]; do if [ ! -f ${somefile} ]; then sleep 10 else sleep=false fi done
Untested, but it might work for you.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
Oct 30, 2003, 11:24 AM
 
^ ^ I tried that quite a while ago, but it didn't work. What happens is that the [ ! -f somefile ] evaluates to false as soon as the file exists, but doesn't necessarily wait until the file is finished writing, so you end up working on a half-written file, and needless to say, you end up with something that doesn't work.

I ended up doing this, which does work:

Code:
while ps -cx | grep gcc do sleep 1 done
Now that I know how to get something into the Inputs table (thanks, mikebeam!), I may try removing this part of the script and seeing if I can get it to work with the inputs and outputs rather than this somewhat kludgey method.

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:20 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2