• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: embedding build number
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: embedding build number


  • Subject: Re: embedding build number
  • From: Steve Checkoway <email@hidden>
  • Date: Sat, 5 Jul 2008 09:18:26 -0700


On Jul 5, 2008, at 7:16 AM, lajos kamocsay wrote:


I would like to embed an automatically incrementing build number. timestamp and possible svn version number in
my application during the build process. What's the best way of doing this?


The way that I do it is use a custom build tool target upon which my main target depends (build phases don't work, or didn't work when I made this <rdar://problem/4068837>) which runs the simple perl script:

#!/usr/bin/perl -w
use File::Copy;

$ver = 0;
if( open FH, '<ver.cpp' )
{
	<FH> =~ /version_num = (\d+);/ and $ver = $1 + 1;
	close FH;
}
chop( $date = `date` );
open FH, '>.ver.tmp' or die $!;
print FH <<"EOF";
extern const unsigned long version_num = $ver;
extern const char *const version_time = "$date";
EOF
close FH;
move '.ver.tmp', 'ver.cpp';

It opens up ver.cpp if it exists and grabs the version number (which is really just a build number) and increments it and then writes the date/time and build number back to the file.

--
Steve Checkoway

    "Anyone who says that the solution is to educate the users
    hasn't ever met an actual user." -- Bruce Schneier




Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: embedding build number
      • From: lajos kamocsay <email@hidden>
References: 
 >embedding build number (From: lajos kamocsay <email@hidden>)

  • Prev by Date: embedding build number
  • Next by Date: Re: embedding build number
  • Previous by thread: embedding build number
  • Next by thread: Re: embedding build number
  • Index(es):
    • Date
    • Thread