Created
October 25, 2010 04:46
-
-
Save loghound/644419 to your computer and use it in GitHub Desktop.
script to auto create version info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// LHSitemapVersionClass.h | |
// SiteMap | |
// | |
// Created by John McLaughlin on 6/24/10. | |
// Copyright 2010 Loghound.com. All rights reserved. | |
// | |
#import <Cocoa/Cocoa.h> | |
@interface LHSitemapVersionClass : NSObject { | |
} | |
+(NSString*) scmVersionString ; | |
+(NSString*) buildNumber; | |
+(NSString*) pluginVersion; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// LHSitemapVersionClass.m | |
// SiteMap | |
// | |
// Created by John McLaughlin on 6/24/10. | |
// Copyright 2010 Loghound.com. All rights reserved. | |
// | |
#import "LHSitemapVersionClass.h" | |
#import "version.h" | |
@implementation LHSitemapVersionClass | |
+(NSString*) scmVersionString { | |
return [NSString stringWithFormat:@"%s","Git checkin # "SVN_VERSION " hash: "GIT_HASH]; | |
} | |
+(NSString*) buildNumber { | |
return [NSString stringWithFormat:@"Build: %d",BUILD_NUMBER]; | |
} | |
+(NSString*) pluginVersion { | |
NSBundle *thisBundle=[NSBundle bundleForClass:self]; | |
NSString *bundleVersion=[[thisBundle infoDictionary]valueForKey:@"CFBundleVersion"]; | |
return bundleVersion; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo -n "note: Finding revision in " | |
pwd | |
revnum=`/usr/local/git/bin/git rev-list HEAD | /usr/bin/wc -l | sed -e 's/^ *//g;s/ *$//g'` | |
fullrevnum=`/usr/local/git/bin/git rev-parse HEAD` | |
buildNumber=`grep -e "BUILD_NUMBER " version.h | grep -o "[0-9].*"` | |
let buildNumber=$buildNumber+1 | |
# Now write the constant declaration to the file: | |
echo "#define SVN_VERSION \"$revnum\"" > version.h | |
echo "#define GIT_HASH \"$fullrevnum\"" >> version.h | |
echo "#define SVN_VERSION_NUM $revnum" >> version.h | |
echo "#define BUILD_NUMBER $buildNumber" >> version.h | |
echo "note: Wrote revision $revnum to version.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "version.h" | |
#import "version_h.h" | |
#include <stdio.h> | |
static char version[]="Git checkin # "SVN_VERSION " hash: "GIT_HASH; | |
void printVersion() { | |
fprintf(stderr,"%s",version); | |
} | |
char *versionString() { | |
return version; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void printVersion(); | |
char *versionString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment