Re: Build problem
Re: Build problem
- Subject: Re: Build problem
- From: Ondra Cada <email@hidden>
- Date: Mon, 4 Apr 2005 18:47:37 +0200
Gavin,
On 4.4.2005, at 18:34, Gavin Eadie wrote:
... this behavior has persisted through all versions of Project
Builder and all versions of XCode up to v1.5 -- I do have to ask
myself why this is the case. Having to provide a workaround like this
in a product's README for four years is pretty bad.
Myself, I would guess the real reason nobody really cares is that it is
*much* better to build for deployment from the commandline anyway :))
It's mainly as a result of this (and a need to build on unix),
that I do my development with XCode, but I do all my deployment builds
with ant now.
What for, on earth? Presumed you develop in XCode, I fail to see any
need for deployment builds over (a) building into an archive to be
unpacked on the server, (b) in some special cases (like if you want to
check the deployment build for some strange bug) building directly into
the current machine. For both, I would venture to say, commandline is
the easiest variant :)
Well, here's the script I use myself: perhaps it might help you to make
them deployment builds easier?
#!/bin/zsh
# a quick and VERY dirty script to automate server builds: edit the
admin name below to the admin account name on your development machine
ADMINNAME=admin
if [[ ! "$1" == "local" && ! "$1" == "server" ]] then
print 'Usage:'
print 'bldserver local|server [targetname]'
print 'local .... installs in the local machine'
print 'server ... prepares a server installation into an archive'
exit 0
fi
if [[ "$1" == "local" ]] then ; LOCAL="YES" ; fi
TGTNAME=$2
if [[ ! -z $LOCAL && ! "$USER" == "root" ]] then
if ( groups | fgrep -q admin ) then
print "Run by '$USER', re-launching as root"
sudo $0 $*
exit $?
else
print "Run by '$USER', re-launching as administrator
'$ADMINNAME'"
su $ADMINNAME -c "$0 $*"
exit $?
fi
fi
setopt NO_NOMATCH
NAME=(*.pbproj) # if no name matches will be used as a literal
if [[ "$NAME" == "*.pbproj" ]] then
NAME=(*.xcode)
fi
if [[ "$NAME" == "*.xcode" ]] then
print "The bldserver script must be run inside a folder with a project
(.pbproj or .xcode). Use cd or pushd"
exit 1
fi
NAME=$NAME:r
TMPDIR=/tmp/TempDir_${NAME}_${USER}
if [[ ! -z $LOCAL ]] then
DSTROOT=/
else
DSTROOT=$TMPDIR
fi
print Building $NAME for server into $DSTROOT
if [[ ! -z $TGTNAME ]] then
print "folder $TGTNAME"
fi
print
if [[ -d $TMPDIR ]] then
print Removing a previous tempdir
print
rm -rf $TMPDIR
fi
mkdir $TMPDIR
rm -rf build # if there happened to be
print Cleaning a previous build
xcodebuild clean -buildstyle Deployment DSTROOT=$TMPDIR >
$TMPDIR/Clean.log 2> $TMPDIR/Clean.error.log
if [[ $? -gt 0 ]] then
print Oops, clean failed. See files
print
ls -l $TMPDIR/Clean*.log
exit 1
fi
print Preparing a deployment build
xcodebuild install -buildstyle Deployment DSTROOT=$TMPDIR >
$TMPDIR/Deployment.log 2> $TMPDIR/Deployment.error.log
if [[ $? -gt 0 ]] then
print Oops, deployment build failed. See files
print
ls -l $TMPDIR/Deployment*.log
exit 1
fi
print Preparing a webserver build
xcodebuild install -buildstyle WebServer DSTROOT=$TMPDIR >
$TMPDIR/WebServer.log 2> $TMPDIR/WebServer.error.log
if [[ $? -gt 0 ]] then
print
print Oops, webserver build failed. See files
print
ls -l $TMPDIR/WebServer*.log
exit 1
fi
rm -rf build # remove the one we just generated
print
APPDIR=Library/WebObjects/Applications
WSRVDIR=Library/WebServer/Documents/WebObjects
if [[ ! -z $TGTNAME ]] then
mv $TMPDIR/$APPDIR/$NAME.woa $TMPDIR/$APPDIR/$TGTNAME.woa
mv $TMPDIR/$WSRVDIR/$NAME.woa $TMPDIR/$WSRVDIR/$TGTNAME.woa
NAME=$TGTNAME
fi
if [[ ! -z $LOCAL ]] then
print Build ok, installing the application...
if [[ -d $DSTROOT/$APPDIR/$NAME.woa ]] then
print ' removing a previous application'
print
rm -rf $DSTROOT/$APPDIR/$NAME.woa
fi
if [[ -d $DSTROOT/$WSRVDIR/$NAME.woa ]] then
print ' removing a previous server data'
print
rm -rf $DSTROOT/$WSRVDIR/$NAME.woa
fi
if [[ ! -d $DSTROOT/$APPDIR ]] then
print ' creating application folder'
print
mkdirs $DSTROOT/$APPDIR
fi
if [[ -d $TMPDIR/$APPDIR/$NAME.woa ]] then
print ' copying application files'
cp -R $TMPDIR/$APPDIR/$NAME.woa $DSTROOT/$APPDIR
if [[ $? -gt 0 ]] then
print CANNOT COPY THE APP FROM $TMPDIR
exit 1
fi
fi
if [[ ! -d $DSTROOT/$WSRVDIR ]] then
print ' creating server data folder'
print
mkdirs $DSTROOT/$WSRVDIR
fi
if [[ -d $TMPDIR/$WSRVDIR/$NAME.woa ]] then
print ' copying server data files'
cp -R $TMPDIR/$WSRVDIR/$NAME.woa $DSTROOT/$WSRVDIR
if [[ $? -gt 0 ]] then
print CANNOT COPY THE SERVER DATA FROM $TMPDIR
exit 1
fi
fi
print OK, done
else
print Build ok, preparing the archive...
ARCHIVE=/tmp/$NAME.server.`date +%Y%m%d-%H%M%S`.tgz
pushd $TMPDIR
gnutar czf $ARCHIVE Library
popd
if [[ $? -gt 0 ]] then
print
print Oops, archiver failed. Results in $TMPDIR.
exit 1
fi
print
print "OK, done. The archive for server is in\n\n$ARCHIVE\n\nMove
it to the server, optionally remove the old build, and just unarchive
it in the rootdir."
fi
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden