mkbuild, an iPhone project build script

February 27th, 2009 § 1 comment § permalink

Note: The information in this post is over three years old, and has been obsoleted by Xcode 4′s Archive feature.

When I wrote “Good Practices: iPhone Development“, I promised to share the script I wrote to create numbered builds of iPhone applications. I am certain that I am not the only programmer who feels uncomfortable sharing source code until it is ready (i.e., Perfect), but we must not forget that Real Artists Ship. This is a long winded way of saying that I finally cleaned up my build script and made it available for download.

The impatient can get it here: mkbuild.zip

The basic idea is that you create a build-config.sh file with some instructions on how to build your particular project, place it into a checked-out working copy of your project, and run mkbuild.sh from within the same directory. When you ask it to create a new build (mkbuild.sh new), it will:

  1. Tag your repository with a build number (e.g., build-0023).
  2. Export that tag to a RAM disk.
  3. Compile and package your app as instructed by the configuration file.
  4. Destroy the RAM disk.

I like using RAM disks for this sort of thing, since there is no doubt the build is clean.

The build number is always a four digit, monotonically increasing integer. When you make a new build, the script scans your existing tags and automatically determines the next available build number. I briefly experimented with using the repository revision number, but decided it would be better to decouple the build numbering from the revision control system used.

That turned out to be a good move, because although I developed the script to work against a Subversion repository, I made a git version for a different project I worked on. I have since merged the two, so the mkbuild.sh script will talk to either Subversion or git, depending on how you configure it.

Here is a summary of the operations it supports:

  • mkbuild.sh new creates a new build
  • mkbuild.sh rebuild n recreates build n, in case you deleted it
  • mkbuild.sh log n prints changes between build n and build n – 1
  • mkbuild.sh log n m prints changes between build n and build m
  • mkbuild.sh list lists all builds in the repository
  • mkbuild.sh archive n creates a zip file of the source of build n

Everywhere it asks for a build number, you can specify 3 and it will automatically interpret that as 0003.

Although I wrote the script to simplify iPhone project builds, it could be easily adapted to handle any Xcode project.

Please try it out and let me know what you think. This link will always redirect you to the latest version and I’ll make previous versions available here. Since the script will tag your repository, be responsible and make a backup before you start experimenting. The zip file contains a sample configuration file and there is documentation is in the script source itself.

Struck by Lightning

February 17th, 2009 § 5 comments § permalink

I am totally hooked on the nonexistent ’80s glam rock band, Property of the Queen.

Hulu was nice enough to let me embed the video for “Struck by Lightning”, one of the songs on their fictitious Greatest Hits album from 1983. It really holds up.

Here are the lyrics, in case you can’t see it:

I got struck (ROCK) by lightning

and it really hurt.

I got struck (ROCK ROCK!) by lightning

and it really burned.

If you wanna know what happened to me

I’ll explain it all in depth:

I got struck (ROCK ROCK!) by lightning

but I’m not dead!

I’m hoping they break the fourth wall, like Spinal Tap before them, and release a real album. Until then, can you recommend any similar real bands to tide me over?

Solving the Plastic Bag Problem

February 5th, 2009 § Comments Off § permalink

You can’t bear to throw out plastic bags because they are reusable. Unfortunately, you also accumulate them at a far faster rate than you use them, leading to a surplus of plastic bags laying around your home. What do you do?

First, buy a reusable cloth shopping bag from your grocery store. They usually cost 99 cents. If you remember to take it when you go grocery shopping, you will cut down on your bag accumulation.

Bonus:

  • Some stores, like Whole Foods, will give you a discount if you bring your own bag.
  • At home, store your shopping list (and a pen) in or near the bag, and you won’t forget to take it with you when you go to the store.
  • Do the same with coupons.

Now, what to do about the millions of plastic bags that you already have? Find somewhere on the way to your grocery store that you can drop off plastic bags for recycling. If you’re lucky, that place will be at the grocery store itself, near the entrance.

When you’re at home, grab a bunch of the plastic bags and put them inside your cloth shopping bag. Each time you go shopping, you can drop off a bunch of bags to be recycled. Over time, you will slowly dig a tunnel to plastic bag freedom much like Andy Dufresne in The Shawshank Redemption.

Where am I?

You are currently viewing the archives for February, 2009 at Whatever happened to Benjamin Ragheb?.

Performance Optimization WordPress Plugins by W3 EDGE