About-Panel: Show git-describe using Info.plist

This patch adds a CFBundleGitRevision key to Info.plist which is set to
the output of "git describe" when building.

The menu-entry for "About GitX" was reconnected to a custom method in
the AppController, which reads the CF-string from the .plist and also
indicates if the build is a DEBUG-build.

Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
This commit is contained in:
Johannes Gilger
2009-09-05 13:24:10 +02:00
committed by Pieter de Bie
parent 8cdb2e6c9d
commit 0b81911d76
5 changed files with 27 additions and 4 deletions
+1
View File
@@ -28,6 +28,7 @@
- (NSManagedObjectContext *)managedObjectContext; - (NSManagedObjectContext *)managedObjectContext;
- (IBAction)openPreferencesWindow:(id)sender; - (IBAction)openPreferencesWindow:(id)sender;
- (IBAction)showAboutPanel:(id)sender;
- (IBAction)installCliTool:(id)sender; - (IBAction)installCliTool:(id)sender;
+14
View File
@@ -92,6 +92,20 @@
[[PBPrefsWindowController sharedPrefsWindowController] showWindow:nil]; [[PBPrefsWindowController sharedPrefsWindowController] showWindow:nil];
} }
- (IBAction)showAboutPanel:(id)sender
{
NSString *gitversion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleGitVersion"];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
if (gitversion)
[dict addEntriesFromDictionary:[[NSDictionary alloc] initWithObjectsAndKeys:gitversion, @"Version", nil]];
#ifdef DEBUG_BUILD
[dict addEntriesFromDictionary:[[NSDictionary alloc] initWithObjectsAndKeys:@"GitX (DEBUG)", @"ApplicationName", nil]];
#endif
[NSApp orderFrontStandardAboutPanelWithOptions:dict];
}
- (IBAction)installCliTool:(id)sender; - (IBAction)installCliTool:(id)sender;
{ {
BOOL success = NO; BOOL success = NO;
+4 -2
View File
@@ -886,8 +886,8 @@
</object> </object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection"> <object class="IBActionConnection" key="connection">
<string key="label">orderFrontStandardAboutPanel:</string> <string key="label">showAboutPanel:</string>
<reference key="source" ref="519751875"/> <reference key="source" ref="859235683"/>
<reference key="destination" ref="1039244063"/> <reference key="destination" ref="1039244063"/>
</object> </object>
<int key="connectionID">142</int> <int key="connectionID">142</int>
@@ -2278,6 +2278,7 @@
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<string>installCliTool:</string> <string>installCliTool:</string>
<string>openPreferencesWindow:</string> <string>openPreferencesWindow:</string>
<string>showAboutPanel:</string>
<string>saveAction:</string> <string>saveAction:</string>
<string>showHelp:</string> <string>showHelp:</string>
</object> </object>
@@ -2287,6 +2288,7 @@
<string>id</string> <string>id</string>
<string>id</string> <string>id</string>
<string>id</string> <string>id</string>
<string>id</string>
</object> </object>
</object> </object>
<object class="NSMutableDictionary" key="outlets"> <object class="NSMutableDictionary" key="outlets">
+6 -2
View File
@@ -767,7 +767,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`\"$TARGET_BUILD_DIR\"/gitx --git-path`\nVERSION=$(cd \"$PROJECT_DIR\";git describe)\nLONG_VERSION=$(echo $VERSION | sed -e \"s/\\-/\\./\" -e \"s/^v//\" -e \"s/-.*//\")\nSHORT_VERSION=$(echo $VERSION | sed -e \"s/\\-.*//\" -e \"s/^v//\")\n\necho -n \"#define LONG_VERSION $LONG_VERSION\n#define SHORT_VERSION $SHORT_VERSION\" > \"$PROJECT_TEMP_DIR/revision\"\ntouch Info.plist"; shellScript = "export PATH=$PATH:$HOME/bin:$HOME/local/bin:/sw/bin:/opt/local/bin:`\"$TARGET_BUILD_DIR\"/gitx --git-path`\nVERSION=$(cd \"$PROJECT_DIR\";git describe)\nLONG_VERSION=$(echo $VERSION | sed -e \"s/\\-/\\./\" -e \"s/^v//\" -e \"s/-.*//\")\nSHORT_VERSION=$(echo $VERSION | sed -e \"s/\\-.*//\" -e \"s/^v//\")\n\necho -n \"#define LONG_VERSION $LONG_VERSION\n#define GIT_VERSION $VERSION\n#define SHORT_VERSION $SHORT_VERSION\" > \"$PROJECT_TEMP_DIR/revision\"\ntouch Info.plist";
}; };
F5792DFB0EDB570C001B0C31 /* Compile libgit2 */ = { F5792DFB0EDB570C001B0C31 /* Compile libgit2 */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
@@ -985,7 +985,7 @@
HEADER_SEARCH_PATHS = libgit2/src; HEADER_SEARCH_PATHS = libgit2/src;
INFOPLIST_FILE = Info.plist; INFOPLIST_FILE = Info.plist;
INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional"; INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
INFOPLIST_PREFIX_HEADER = build/revision; INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision;
INFOPLIST_PREPROCESS = YES; INFOPLIST_PREPROCESS = YES;
INSTALL_PATH = "$(HOME)/Applications"; INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = libgit2; LIBRARY_SEARCH_PATHS = libgit2;
@@ -1001,6 +1001,7 @@
GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = DEBUG_BUILD; GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = DEBUG_BUILD;
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_PREPROCESS = YES;
PREBINDING = NO; PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
}; };
@@ -1016,6 +1017,8 @@
GCC_ENABLE_OBJC_GC = required; GCC_ENABLE_OBJC_GC = required;
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision;
INFOPLIST_PREPROCESS = YES;
PREBINDING = NO; PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
}; };
@@ -1084,6 +1087,7 @@
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_ENABLE_FIX_AND_CONTINUE = NO;
INFOPLIST_PREPROCESS = YES;
PRODUCT_NAME = "Generate PList Prefix"; PRODUCT_NAME = "Generate PList Prefix";
ZERO_LINK = NO; ZERO_LINK = NO;
}; };
+2
View File
@@ -50,6 +50,8 @@
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>LONG_VERSION</string> <string>LONG_VERSION</string>
<key>CFBundleGitVersion</key>
<string>GIT_VERSION</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>SHORT_VERSION</string> <string>SHORT_VERSION</string>
<key>NSMainNibFile</key> <key>NSMainNibFile</key>