Hottest Free Downloads - DownloadPipe.com Over 197,000 downloads! Bookmark Now!
DownloadPipe.com - New Downloads Every Minute
 SEARCH:
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

[XCode] adding a task to the build phase

 
   Mac (Home) -> Tools RSS
Next:  mod_auth_apple and Groups  
Author Message
pere.noel

External


Since: Jan 18, 2006
Posts: 21



(Msg. 1) Posted: Tue Nov 28, 2006 11:48 am
Post subject: [XCode] adding a task to the build phase
Archived from groups: comp>sys>mac>programmer>tools (more info?)

Hey all,

i'd like to add a build phase into my target.

in case of build success create a dmg archive of the resulting app and
put that in the dist folder of the project.

do u have some link about that ?

Yvon

--
une bévue
Back to top
Login to vote
David Phillip Oster

External


Since: Jul 21, 2005
Posts: 150



(Msg. 2) Posted: Tue Nov 28, 2006 3:17 pm
Post subject: Re: [XCode] adding a task to the build phase [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <1hpigln.17bfwzh1vtkohhN%pere.noel@laponie.com.invalid>,
pere.noel RemoveThis @laponie.com.invalid (Une bévue) wrote:

> i'd like to add a build phase into my target.
>
> in case of build success create a dmg archive of the resulting app and
> put that in the dist folder of the project.
>
> do u have some link about that ?
>

I add a new target called "Package" that depends on the previous target,
so it only runs when the previous target succeeds. It has only a single
shell script build phase, that runs a separate text file (so it is easy
to edit and not part of the .xcodeproj file.)

That shell script starts with:
#!/bin/sh
if [ $ACTION == "build" ] && [ $BUILD_VARIANTS == "normal" ] && [ `basename $BUILT_PRODUCTS_DIR` == "Release" ] ; then


end ends with


fi


In between, I use:
# This is the simple name of my product. A passed shell variable would probably be better here.
RESULT_NAME="My Product"

# VERSION - the version string. note the backquotes
VERSION=`defaults read "$BUILT_PRODUCTS_DIR/$RESULT_NAME.app/Contents/Info" CFBundleShortVersionString`


# FULL_NAME - append the version.
FULL_NAME="$RESULT_NAME $VERSION"


# use a prototype dmg that was previously hand made to hold a volume called "My Product", same as $RESULT_NAME
# copy a prototype DMG to the output directory
cp -f "Prototype.dmg" "$BUILT_PRODUCTS_DIR/$RESULT_NAME Work.dmg"

# Use the "find" command to remove .DS_Store files and .h files from the result.
# left as an exercise for the reader.

# mount it.
hdiutil attach "$BUILT_PRODUCTS_DIR/$RESULT_NAME Work.dmg" -quiet

# need Finder to do this next rename. "mv" will not work here
osascript -e tell\ application\ \"Finder\"\ to\ set\ name\ of\ disk\ \""$RESULT_NAME"\"\ to\ \""$FULL_NAME"\"

# " this comment is just to keep Xcode syntax coloring sane

#give Finder time to settle down.
sleep 2

# put the app into the disk image
cp -R "$BUILT_PRODUCTS_DIR/$RESULT_NAME"/* "/Volumes/$FULL_NAME"

# convert to read-only, compressed
hdiutil convert "$BUILT_PRODUCTS_DIR/$RESULT_NAME Work.dmg" -format UDZO -imagekey zlib-level=9 -o "$BUILT_PRODUCTS_DIR/$RESULT_NAME.dmg" -quiet














If you rename the disk represented by the .dmg, you'll also need
to use an applescript to reset the volume's background image,
since the Finder stores the path to the volume's background image
using an absolute pathname.


--
David Phillip Oster
Back to top
Login to vote
pere.noel

External


Since: Jan 18, 2006
Posts: 21



(Msg. 3) Posted: Tue Nov 28, 2006 4:48 pm
Post subject: Re: [XCode] adding a task to the build phase [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

David Phillip Oster <oster.DeleteThis@ieee.org> wrote:

>
> I add a new target called "Package" that depends on the previous target,
> so it only runs when the previous target succeeds. It has only a single
> shell script build phase, that runs a separate text file (so it is easy
> to edit and not part of the .xcodeproj file.)

Ok i see what you mean, then it isn't a new build phase but rather a new
target one (i'm following your above writing within XCode).

That's realy nice i've just added a new project > target > shell script
target.

in the window « Run Script Phase "Package" Info » their is a textfield
right to the first label "Shell", actually it's writen, by default
"/bin/sh" i think i could change that to any shell script including ruby
calling applescript ?

It seems to be so easy to do that i want to insure myself Wink

>
> That shell script starts with:

<snip/>

>
> If you rename the disk represented by the .dmg, you'll also need
> to use an applescript to reset the volume's background image,
> since the Finder stores the path to the volume's background image
> using an absolute pathname.

fine thanks very much, i appreciate.

yes i know for the background image BUT i've nerver been able to get
size of opened dmg window +/-= size of background image (on the end user
side) even if i do something like :

tell the_window
set the_bounds to bounds of the_window
set item 3 of the_bounds to (item 1 of the_bounds) + 545
set item 4 of the_bounds to (item 2 of the_bounds) + 355
set its bounds to the_bounds
end tell

545x355 being the size of the background image + borders thickness.

it seems these bounds aren't save even if i detach re-attach de dmg...

do you have solved that tricky point (at least for me) ?

anyway thanks for youur reply it helps me a lot !

--
une bévue
Back to top
Login to vote
David Phillip Oster

External


Since: Jul 21, 2005
Posts: 150



(Msg. 4) Posted: Wed Nov 29, 2006 6:56 am
Post subject: Re: [XCode] adding a task to the build phase [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <1hpitig.1x2ba371l4mlrxN%pere.noel@laponie.com.invalid>,
pere.noel.DeleteThis@laponie.com.invalid (Une bévue) wrote:

> Ok i see what you mean, then it isn't a new build phase but rather a new
> target one (i'm following your above writing within XCode).

A new build phase would also work, but I wanted an easy way to choose
between building an install image and not, so I wouldn't have to wait
for it to build when debugging.

> in the window Run Script Phase "Package" Info their is a textfield
> right to the first label "Shell", actually it's writen, by default
> "/bin/sh" i think i could change that to any shell script including ruby
> calling applescript ?

Yes, you can use any program you like to interpret the script.

> yes i know for the background image BUT i've nerver been able to get
> size of opened dmg window +/-= size of background image (on the end user
> side) even if i do something like :
>
> tell the_window
> set the_bounds to bounds of the_window
> set item 3 of the_bounds to (item 1 of the_bounds) + 545
> set item 4 of the_bounds to (item 2 of the_bounds) + 355
> set its bounds to the_bounds
> end tell
>
> 545x355 being the size of the background image + borders thickness.
>
> it seems these bounds aren't save even if i detach re-attach de dmg...
>
> do you have solved that tricky point (at least for me) ?

I've found that if the applescript brings the finder to the front, and
it resizes the window, then ejects the disk, that the window's size is
written to the disk.
Back to top
Login to vote
pere.noel

External


Since: Jan 18, 2006
Posts: 21



(Msg. 5) Posted: Wed Nov 29, 2006 2:56 pm
Post subject: Re: [XCode] adding a task to the build phase [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

David Phillip Oster <oster RemoveThis @ieee.org> wrote:

> > Ok i see what you mean, then it isn't a new build phase but rather a new
> > target one (i'm following your above writing within XCode).
>
> A new build phase would also work, but I wanted an easy way to choose
> between building an install image and not, so I wouldn't have to wait
> for it to build when debugging.

OK i see...

<snip/>

> >
> > it seems these bounds aren't save even if i detach re-attach de dmg...
> >
> > do you have solved that tricky point (at least for me) ?
>
> I've found that if the applescript brings the finder to the front, and
> it resizes the window, then ejects the disk, that the window's size is
> written to the disk.

just to add frontmost then... Smile

fine, thanks again !
--
une bévue
Back to top
Login to vote
David Phillip Oster

External


Since: Jul 21, 2005
Posts: 150



(Msg. 6) Posted: Wed Nov 29, 2006 3:10 pm
Post subject: Re: [XCode] adding a task to the build phase [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <1hpkhv9.p5uil31x405llN%pere.noel@laponie.com.invalid>,
pere.noel.TakeThisOut@laponie.com.invalid (Une bévue) wrote:

> > I've found that if the applescript brings the finder to the front, and
> > it resizes the window, then ejects the disk, that the window's size is
> > written to the disk.
>
> just to add frontmost then... Smile

activate

>
> fine, thanks again !

Apparently if you tell the Finder to do too many things between the
mount and the eject, then the Finder decides you didn't really mean to
record the window size.
Back to top
Login to vote
pere.noel

External


Since: Jan 18, 2006
Posts: 21



(Msg. 7) Posted: Wed Nov 29, 2006 6:32 pm
Post subject: Re: [XCode] adding a task to the build phase [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

David Phillip Oster <oster.RemoveThis@ieee.org> wrote:

> activate
>
> >
> > fine, thanks again !
>
> Apparently if you tell the Finder to do too many things between the
> mount and the eject, then the Finder decides you didn't really mean to
> record the window size.

that's funny finder )))

--
une bévue
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Xcode Book? - Hello everybody, I would like to learn Xcode, the problem I do not know anaything about programming...yeah I know it sounds strange, but I would like to learn how to do my own stuff, so far I've been simulating things using macromedia director, but I..

Xcode 2.3 Problems - Instead of being cautious like usual, I just went ahead and upgraded my version of Xcode to the new 2.3. Now my debugging is essentially non-existent. I have a dylib project which I debug using a custom executable (a non-Xcode controlled app). After..

Java development on OS X; XCode vs The World. - I'm doing some Java development on my OS X machines (Pismo/400/320MB, Quicksilver/733/1.2GB, both running 10.3.9). XCode ont he Pismo is dog slow but on the QS is relatively better. Are there any other alternatives to Java? Does CodeWarrior do it? ..

XCode - Key command to close all windows? - Hi, Is there a way to close all open editor windows within xcode 2.x? (The equivalent of opt-cmd-w that works in most apps and the Finder) Thanks Steve

errors galore in xcode for intel mac - char * _MSL_CDECL strtok2(char * string, const char * control); the above USED to compile flawlessly under codewarrior in my G4 non intel mac. now it doesnt. i have the macbook pro running 10.4.6 and xcode. help.
       Mac (Home) -> Tools All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows Forums
 Game Forums
 Linux Forums
  Mac Forums
 PDA Forums
 Mobile Forums
  Top  |  Store  |  RSS Feeds RSS  |  Data Feeds  |  Advertise  |  Submit  |  Bookmark  |  Newsletter  |  Contact