diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-01-20 04:30:48 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2010-01-20 04:30:48 +0000 |
commit | 43ba5c5b26da8eb682bf75c98215242934923df3 (patch) | |
tree | f0856e00a634e96139ae2349d0bea3595f8bb540 /XcodePlugin | |
parent | 05daf66d30d19b3833e0c13a576cea5a25229d9a (diff) |
[Author: dmaclach]
Fixed up issue http://code.google.com/p/google-toolbox-for-mac/issues/detail?id=44
Where we weren't dealing with absolute paths correctly in the Xcode plugin.
Updated copyright on plugin, and version number.
R=thomasvl
DELTA=55 (35 added, 1 deleted, 19 changed)
Diffstat (limited to 'XcodePlugin')
-rw-r--r-- | XcodePlugin/GTMXcodeGCovItem.m | 39 | ||||
-rw-r--r-- | XcodePlugin/GTMXcodeMenuItem.h | 8 | ||||
-rw-r--r-- | XcodePlugin/GTMXcodeMenuItem.m | 21 | ||||
-rw-r--r-- | XcodePlugin/GTMXcodePlugin.xcodeproj/project.pbxproj | 8 |
4 files changed, 55 insertions, 21 deletions
diff --git a/XcodePlugin/GTMXcodeGCovItem.m b/XcodePlugin/GTMXcodeGCovItem.m index 5869283..7a69971 100644 --- a/XcodePlugin/GTMXcodeGCovItem.m +++ b/XcodePlugin/GTMXcodeGCovItem.m @@ -49,11 +49,10 @@ typedef enum { // Some paths that we resolve NSString *const kObjectsDirPath - = @"$(SRCROOT)/$(OBJECT_FILE_DIR)-$(BUILD_VARIANTS)/$(NATIVE_ARCH_32_BIT)"; + = @"$(OBJECT_FILE_DIR)-$(BUILD_VARIANTS)/$(NATIVE_ARCH_32_BIT)"; NSString *const kObjectsDirNoArchPath - = @"$(SRCROOT)/$(OBJECT_FILE_DIR)-$(BUILD_VARIANTS)"; -NSString *const kDerivedDirPath = @"$(SRCROOT)/$(DERIVED_FILE_DIR)"; -NSString *const kBuildRootDirPath = @"$(SRCROOT)/$(BUILD_ROOT)"; + = @"$(OBJECT_FILE_DIR)-$(BUILD_VARIANTS)"; +NSString *const kBuildRootDirPath = @"$(BUILD_ROOT)"; // the title for our menu items w/ submenus NSString *kShowCodeCoverageForMenuTitle = @"Show Code Coverage For"; @@ -237,21 +236,24 @@ GTM_METHOD_CHECK(NSTask, gtm_runScript:withArguments:); NSString *subStr = [srcFileName substringToIndex:(fileLength - extensionLength)]; NSString *gcdaFileName = [NSString stringWithFormat:@"%@gcda", subStr]; - NSString *objectsDir = [target stringByExpandingString:kObjectsDirPath - forBuildConfigurationNamed:buildConfig]; + NSString *objectsDir = [self pathByExpandingString:kObjectsDirPath + forBuildConfiguration:buildConfig + ofTarget:target]; NSString *gcdaPath = [objectsDir stringByAppendingPathComponent:gcdaFileName]; pathToOpen = gcdaPath; } } } else if (mode_ == kGTMXcodeGCovOpenTarget) { - NSString *objectsDirNoArch - = [target stringByExpandingString:kObjectsDirNoArchPath - forBuildConfigurationNamed:buildConfig]; + NSString *objectsDirNoArch + = [self pathByExpandingString:kObjectsDirNoArchPath + forBuildConfiguration:buildConfig + ofTarget:target]; pathToOpen = objectsDirNoArch; } else if (mode_ == kGTMXcodeGCovOpenBuildFolder) { - NSString *buildRootDir = [target stringByExpandingString:kBuildRootDirPath - forBuildConfigurationNamed:buildConfig]; + NSString *buildRootDir = [self pathByExpandingString:kBuildRootDirPath + forBuildConfiguration:buildConfig + ofTarget:target]; pathToOpen = buildRootDir; } if (pathToOpen) { @@ -390,12 +392,14 @@ GTM_METHOD_CHECK(NSTask, gtm_runScript:withArguments:); NSString *buildConfig = [project activeBuildConfigurationName]; if (mode_ == kGTMXcodeGCovCleanDataTarget) { NSString *objectsDirNoArch - = [target stringByExpandingString:kObjectsDirNoArchPath - forBuildConfigurationNamed:buildConfig]; + = [self pathByExpandingString:kObjectsDirNoArchPath + forBuildConfiguration:buildConfig + ofTarget:target]; pathToClean = objectsDirNoArch; } else if (mode_ == kGTMXcodeGCovCleanDataBuildFolder) { - NSString *buildRootDir = [target stringByExpandingString:kBuildRootDirPath - forBuildConfigurationNamed:buildConfig]; + NSString *buildRootDir = [self pathByExpandingString:kBuildRootDirPath + forBuildConfiguration:buildConfig + ofTarget:target]; pathToClean = buildRootDir; } if (pathToClean) { @@ -455,8 +459,9 @@ GTM_METHOD_CHECK(NSTask, gtm_runScript:withArguments:); PBXProject *project = [NSApp currentProject]; PBXTarget *target = [project activeTarget]; NSString *buildConfig = [project activeBuildConfigurationName]; - NSString *buildRootDir = [target stringByExpandingString:kBuildRootDirPath - forBuildConfigurationNamed:buildConfig]; + NSString *buildRootDir = [self pathByExpandingString:kBuildRootDirPath + forBuildConfiguration:buildConfig + ofTarget:target]; pathToClean = buildRootDir; if (pathToClean) { [NSTask gtm_runScript:@"CleanCovAndBuild" withArguments:pathToClean, nil]; diff --git a/XcodePlugin/GTMXcodeMenuItem.h b/XcodePlugin/GTMXcodeMenuItem.h index 01cec07..dd7ce65 100644 --- a/XcodePlugin/GTMXcodeMenuItem.h +++ b/XcodePlugin/GTMXcodeMenuItem.h @@ -18,6 +18,8 @@ #import <Cocoa/Cocoa.h> +@class PBXTarget; + @protocol GTMXcodeMenuItemProtocol // name of the menu item - (NSString*)title; @@ -54,4 +56,10 @@ // returns the array of currently "selected files" in Xcode. This can be // the front most text document, or a selection out of the browser window. - (NSArray*)selectedPaths; + +// Expand |path| based on |target| and |configuration|. +// If newPath is not absolute, expand kSrcRootPath and prepend it to newPath. +- (NSString *)pathByExpandingString:(NSString *)path + forBuildConfiguration:(NSString *)configuration + ofTarget:(PBXTarget *)target; @end diff --git a/XcodePlugin/GTMXcodeMenuItem.m b/XcodePlugin/GTMXcodeMenuItem.m index b94ed98..701a00a 100644 --- a/XcodePlugin/GTMXcodeMenuItem.m +++ b/XcodePlugin/GTMXcodeMenuItem.m @@ -19,9 +19,13 @@ #import "GTMXcodeMenuItem.h" #import "GTMNSEnumerator+Filter.h" #import "PBXAppDelegate.h" +#import "PBXProject.h" +#import "PBXTarget.h" #import "GTMMethodCheck.h" #import "GTMDefines.h" +static NSString *const kGTMSrcRootPath = @"$(SRCROOT)/"; + @interface GTMXcodeMenuItem (GTMXcodeMenuItemPrivate) // Used to figure out what order to install menu items - (NSComparisonResult)compareDepth:(id<GTMXcodeMenuItemProtocol>)item; @@ -117,4 +121,21 @@ GTM_METHOD_CHECK(NSEnumerator, gtm_enumeratorByMakingEachObjectPerformSelector:w return YES; } +// Expand |path| based on |target| and |configuration|. +// If newPath is not absolute, expand kSrcRootPath and prepend it to newPath. +- (NSString *)pathByExpandingString:(NSString *)path + forBuildConfiguration:(NSString *)configuration + ofTarget:(PBXTarget *)target { + NSString *newPath = [target stringByExpandingString:path + forBuildConfigurationNamed:configuration]; + if (![newPath hasPrefix:@"/"]) { + NSString *srcRoot = [target stringByExpandingString:kGTMSrcRootPath + forBuildConfigurationNamed:configuration]; + if (srcRoot) { + newPath = [srcRoot stringByAppendingString:newPath]; + } + } + return newPath; +} + @end diff --git a/XcodePlugin/GTMXcodePlugin.xcodeproj/project.pbxproj b/XcodePlugin/GTMXcodePlugin.xcodeproj/project.pbxproj index fca9e3e..2223c77 100644 --- a/XcodePlugin/GTMXcodePlugin.xcodeproj/project.pbxproj +++ b/XcodePlugin/GTMXcodePlugin.xcodeproj/project.pbxproj @@ -375,8 +375,8 @@ GTM_VERSIONINFO_LONG = "$(GTM_VERSIONINFO_SHORT).$(GTM_VERSION_BUILDNUMBER)"; GTM_VERSIONINFO_SHORT = "$(GTM_VERSION_MAJOR).$(GTM_VERSION_MINOR).$(GTM_VERSION_FIXLEVEL)"; GTM_VERSION_BUILDNUMBER = 0; - GTM_VERSION_COPYRIGHT = "2005-2009"; - GTM_VERSION_FIXLEVEL = 1; + GTM_VERSION_COPYRIGHT = "2005-2010"; + GTM_VERSION_FIXLEVEL = 2; GTM_VERSION_MAJOR = 10; GTM_VERSION_MINOR = 0; INFOPLIST_FILE = Resources/Info.plist; @@ -403,8 +403,8 @@ GTM_VERSIONINFO_LONG = "$(GTM_VERSIONINFO_SHORT).$(GTM_VERSION_BUILDNUMBER)"; GTM_VERSIONINFO_SHORT = "$(GTM_VERSION_MAJOR).$(GTM_VERSION_MINOR).$(GTM_VERSION_FIXLEVEL)"; GTM_VERSION_BUILDNUMBER = 0; - GTM_VERSION_COPYRIGHT = "2005-2009"; - GTM_VERSION_FIXLEVEL = 1; + GTM_VERSION_COPYRIGHT = "2005-2010"; + GTM_VERSION_FIXLEVEL = 2; GTM_VERSION_MAJOR = 10; GTM_VERSION_MINOR = 0; INFOPLIST_FILE = Resources/Info.plist; |