Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
@heipei heipei authored committed
View
1  ApplicationController.h
@@ -28,6 +28,7 @@
- (NSManagedObjectContext *)managedObjectContext;
- (IBAction)openPreferencesWindow:(id)sender;
+- (IBAction)showAboutPanel:(id)sender;
- (IBAction)installCliTool:(id)sender;
View
14 ApplicationController.m
@@ -92,6 +92,20 @@ - (IBAction)openPreferencesWindow:(id)sender
[[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;
{
BOOL success = NO;
View
6 English.lproj/MainMenu.xib
@@ -886,8 +886,8 @@
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
- <string key="label">orderFrontStandardAboutPanel:</string>
- <reference key="source" ref="519751875"/>
+ <string key="label">showAboutPanel:</string>
+ <reference key="source" ref="859235683"/>
<reference key="destination" ref="1039244063"/>
</object>
<int key="connectionID">142</int>
@@ -2278,6 +2278,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>installCliTool:</string>
<string>openPreferencesWindow:</string>
+ <string>showAboutPanel:</string>
<string>saveAction:</string>
<string>showHelp:</string>
</object>
@@ -2287,6 +2288,7 @@
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
View
8 GitX.xcodeproj/project.pbxproj
@@ -767,7 +767,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
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 */ = {
isa = PBXShellScriptBuildPhase;
@@ -985,7 +985,7 @@
HEADER_SEARCH_PATHS = libgit2/src;
INFOPLIST_FILE = Info.plist;
INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
- INFOPLIST_PREFIX_HEADER = build/revision;
+ INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision;
INFOPLIST_PREPROCESS = YES;
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = libgit2;
@@ -1001,6 +1001,7 @@
GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = DEBUG_BUILD;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ INFOPLIST_PREPROCESS = YES;
PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
};
@@ -1016,6 +1017,8 @@
GCC_ENABLE_OBJC_GC = required;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision;
+ INFOPLIST_PREPROCESS = YES;
PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
};
@@ -1084,6 +1087,7 @@
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ INFOPLIST_PREPROCESS = YES;
PRODUCT_NAME = "Generate PList Prefix";
ZERO_LINK = NO;
};
View
2  Info.plist
@@ -50,6 +50,8 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>LONG_VERSION</string>
+ <key>CFBundleGitVersion</key>
+ <string>GIT_VERSION</string>
<key>CFBundleShortVersionString</key>
<string>SHORT_VERSION</string>
<key>NSMainNibFile</key>
Please sign in to comment.
Something went wrong with that request. Please try again.