Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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>
  • Loading branch information...
commit 0b81911d76a819fea58d7c1aba98302cb8703d70 1 parent 8cdb2e6
Johannes Gilger authored September 05, 2009 pieter committed September 06, 2009
1  ApplicationController.h
@@ -28,6 +28,7 @@
28 28
 - (NSManagedObjectContext *)managedObjectContext;
29 29
 
30 30
 - (IBAction)openPreferencesWindow:(id)sender;
  31
+- (IBAction)showAboutPanel:(id)sender;
31 32
 
32 33
 - (IBAction)installCliTool:(id)sender;
33 34
 
14  ApplicationController.m
@@ -92,6 +92,20 @@ - (IBAction)openPreferencesWindow:(id)sender
92 92
 	[[PBPrefsWindowController sharedPrefsWindowController] showWindow:nil];
93 93
 }
94 94
 
  95
+- (IBAction)showAboutPanel:(id)sender
  96
+{
  97
+	NSString *gitversion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleGitVersion"];
  98
+	NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
  99
+	if (gitversion)
  100
+		[dict addEntriesFromDictionary:[[NSDictionary alloc] initWithObjectsAndKeys:gitversion, @"Version", nil]];
  101
+
  102
+	#ifdef DEBUG_BUILD
  103
+		[dict addEntriesFromDictionary:[[NSDictionary alloc] initWithObjectsAndKeys:@"GitX (DEBUG)", @"ApplicationName", nil]];
  104
+	#endif
  105
+
  106
+	[NSApp orderFrontStandardAboutPanelWithOptions:dict];
  107
+}
  108
+
95 109
 - (IBAction)installCliTool:(id)sender;
96 110
 {
97 111
 	BOOL success               = NO;
6  English.lproj/MainMenu.xib
@@ -886,8 +886,8 @@
886 886
 				</object>
887 887
 				<object class="IBConnectionRecord">
888 888
 					<object class="IBActionConnection" key="connection">
889  
-						<string key="label">orderFrontStandardAboutPanel:</string>
890  
-						<reference key="source" ref="519751875"/>
  889
+						<string key="label">showAboutPanel:</string>
  890
+						<reference key="source" ref="859235683"/>
891 891
 						<reference key="destination" ref="1039244063"/>
892 892
 					</object>
893 893
 					<int key="connectionID">142</int>
@@ -2278,6 +2278,7 @@
2278 2278
 							<bool key="EncodedWithXMLCoder">YES</bool>
2279 2279
 							<string>installCliTool:</string>
2280 2280
 							<string>openPreferencesWindow:</string>
  2281
+							<string>showAboutPanel:</string>
2281 2282
 							<string>saveAction:</string>
2282 2283
 							<string>showHelp:</string>
2283 2284
 						</object>
@@ -2287,6 +2288,7 @@
2287 2288
 							<string>id</string>
2288 2289
 							<string>id</string>
2289 2290
 							<string>id</string>
  2291
+							<string>id</string>
2290 2292
 						</object>
2291 2293
 					</object>
2292 2294
 					<object class="NSMutableDictionary" key="outlets">
8  GitX.xcodeproj/project.pbxproj
@@ -767,7 +767,7 @@
767 767
 			);
768 768
 			runOnlyForDeploymentPostprocessing = 0;
769 769
 			shellPath = /bin/sh;
770  
-			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";
  770
+			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";
771 771
 		};
772 772
 		F5792DFB0EDB570C001B0C31 /* Compile libgit2 */ = {
773 773
 			isa = PBXShellScriptBuildPhase;
@@ -985,7 +985,7 @@
985 985
 				HEADER_SEARCH_PATHS = libgit2/src;
986 986
 				INFOPLIST_FILE = Info.plist;
987 987
 				INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
988  
-				INFOPLIST_PREFIX_HEADER = build/revision;
  988
+				INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision;
989 989
 				INFOPLIST_PREPROCESS = YES;
990 990
 				INSTALL_PATH = "$(HOME)/Applications";
991 991
 				LIBRARY_SEARCH_PATHS = libgit2;
@@ -1001,6 +1001,7 @@
1001 1001
 				GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = DEBUG_BUILD;
1002 1002
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
1003 1003
 				GCC_WARN_UNUSED_VARIABLE = YES;
  1004
+				INFOPLIST_PREPROCESS = YES;
1004 1005
 				PREBINDING = NO;
1005 1006
 				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
1006 1007
 			};
@@ -1016,6 +1017,8 @@
1016 1017
 				GCC_ENABLE_OBJC_GC = required;
1017 1018
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
1018 1019
 				GCC_WARN_UNUSED_VARIABLE = YES;
  1020
+				INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision;
  1021
+				INFOPLIST_PREPROCESS = YES;
1019 1022
 				PREBINDING = NO;
1020 1023
 				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
1021 1024
 			};
@@ -1084,6 +1087,7 @@
1084 1087
 				COPY_PHASE_STRIP = YES;
1085 1088
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1086 1089
 				GCC_ENABLE_FIX_AND_CONTINUE = NO;
  1090
+				INFOPLIST_PREPROCESS = YES;
1087 1091
 				PRODUCT_NAME = "Generate PList Prefix";
1088 1092
 				ZERO_LINK = NO;
1089 1093
 			};
2  Info.plist
@@ -50,6 +50,8 @@
50 50
 	<string>????</string>
51 51
 	<key>CFBundleVersion</key>
52 52
 	<string>LONG_VERSION</string>
  53
+	<key>CFBundleGitVersion</key>
  54
+	<string>GIT_VERSION</string>
53 55
 	<key>CFBundleShortVersionString</key>
54 56
 	<string>SHORT_VERSION</string>
55 57
 	<key>NSMainNibFile</key>

0 notes on commit 0b81911

Please sign in to comment.
Something went wrong with that request. Please try again.