• 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: build numbers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: build numbers


  • Subject: Re: build numbers
  • From: Christian Schneider <email@hidden>
  • Date: Thu, 16 Sep 2004 09:07:27 +0200

Steve,

On Wed, Sep 15, 2004 at 04:55:51AM -0700, Steve Checkoway wrote:
> The script I use is this. I wrote it when I was using project builder
> and I couldn't seem to make it accept a perl script, hence calling perl
> inside the script.
>
> #!/bin/sh
>
> perl -w -e '
> open F, "<version.tst"||die;
> $ver = <F>;
> close F;
> chomp $ver;
> ++$ver;
> open F,">version.tst"||die;
> print F "$ver\n";
> close F;
> $date = `date`;
> chomp $date;
> open F, ">ver.cpp"||die;
> print F "unsigned long version_num = $ver;\n";
> print F "const char *version_time = \"$date\";\n";
> close F;
> '
>
> Then you just include ver.cpp and have Xcode run this script every time
> you build. This gives you  a version number accessible via
> extern unsigned long version_num;
> and a build date accessible via
> extern const char *version_time;
>
> Now that I think about it, the script should probably be changed to emit
> const char *const version_time = ...;
> But that's really not very important.
>


thanks, I based my solution on that. As I'm writing ObjC I use a
shell script in conjunction with an ObjC class:

=== Shell script ===
#/bin/sh
now=$(date)
perl -p -i -e "s/return @\"[^\"]*\"/return \@\"$now\"/" GFFBuildInfo.m

=== ObjC Class ===
@implementation GFFBuildInfo

+ (NSString *) buildDate
{
  return @"Wed Sep 15 17:01:08 CEST 2004";
}

@end


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

This email sent to email@hidden

  • Follow-Ups:
    • Re: build numbers
      • From: "M. Uli Kusterer" <email@hidden>
References: 
 >build numbers (From: Christian Schneider <email@hidden>)
 >Re: build numbers (From: Steve Checkoway <email@hidden>)

  • Prev by Date: Re: build numbers
  • Next by Date: Re: modifying self in init
  • Previous by thread: Re: build numbers
  • Next by thread: Re: build numbers
  • Index(es):
    • Date
    • Thread