diff --git a/Tools/XcodeCapp/TNXCodeCapp.m b/Tools/XcodeCapp/TNXCodeCapp.m index 27a777518..d88a9700d 100644 --- a/Tools/XcodeCapp/TNXCodeCapp.m +++ b/Tools/XcodeCapp/TNXCodeCapp.m @@ -318,6 +318,7 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification DLog(@"Parsing modified file: %@", fullPath); NSArray *arguments = nil; + NSArray *PBXArguments = nil; NSString *successTitle = nil; NSString *successMsg = nil; NSString *response = nil; @@ -331,13 +332,29 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification if ([self isXIBFile:fullPath]) { - arguments = [NSArray arrayWithObjects: @"-c", [NSString stringWithFormat:@"(%@; nib2cib '%@';) 2>&1", profilePath, fullPath],@"",nil]; + arguments = [NSArray arrayWithObjects: @"-c", + [NSString stringWithFormat:@"(%@; nib2cib '%@';) 2>&1", profilePath, fullPath],@"",nil]; + successTitle = @"XIB converted"; successMsg = splitPath; } else if ([self isObjJFile:fullPath]) { - arguments = [NSArray arrayWithObjects: @"-c", [NSString stringWithFormat:@"(%@; objj '%@' '%@' '%@';) 2>&1", profilePath, parserPath, fullPath, shadowPath],@"",nil]; + arguments = [NSArray arrayWithObjects: @"-c", + [NSString stringWithFormat:@"(%@; objj '%@' '%@' '%@';) 2>&1", + profilePath, + parserPath, + fullPath, + shadowPath], + @"",nil]; + + PBXArguments = [NSArray arrayWithObjects: @"-c", + [NSString stringWithFormat:@"(%@; python %@ add '%@' '%@') 2>&1", + profilePath, + PBXModifierScriptPath, + XCodeSupportPBXPath, + shadowPath],nil]; + successTitle = @"Objective-J source processed"; successMsg = splitPath; } @@ -352,13 +369,22 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification // Run the task and get the response if needed if (arguments) { - DLog(@"Running task..."); + DLog(@"Running conversion task..."); NSArray *statusInfo = [self runTask:arguments]; status = [statusInfo objectAtIndex:0]; response = [statusInfo objectAtIndex:1]; - DLog(@"Task result/response: %@/%@", status, response); + DLog(@"Conversion task result/response: %@/%@", status, response); + } + + if (PBXArguments) + { + DLog(@"Running update PBX task..."); + NSArray *statusInfo = [self runTask:PBXArguments]; + status = [statusInfo objectAtIndex:0]; + response = [statusInfo objectAtIndex:1]; + DLog(@"Update PBX Task result/response: %@/%@", status, response); } if ([status intValue] == 0 && shouldNotify) @@ -393,8 +419,21 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification { NSString *shadowPath = [[self shadowURLForSourceURL:[NSURL URLWithString:[fullPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]] path]; - [fm removeItemAtPath:shadowPath error:nil]; + NSArray *PBXArguments = [NSArray arrayWithObjects: @"-c", + [NSString stringWithFormat:@"(%@; python %@ remove '%@' '%@') 2>&1", + profilePath, + PBXModifierScriptPath, + XCodeSupportPBXPath, + shadowPath],nil]; + DLog(@"Removing shadow file: %@", shadowPath); + [fm removeItemAtPath:shadowPath error:nil]; + + DLog(@"Removing PBX reference task..."); + NSArray *statusInfo = [self runTask:PBXArguments]; + NSNumber *status = [statusInfo objectAtIndex:0]; + NSString *response = [statusInfo objectAtIndex:1]; + DLog(@"PBX Reference removal status/response: %@/%@", status, response); } else if ([self isXCCIgnoreFile:fullPath]) { @@ -445,15 +484,17 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification { XCodeSupportProjectName = [NSString stringWithFormat:@"%@.xcodeproj/", currentProjectName]; XCodeTemplatePBXPath = [[NSBundle mainBundle] pathForResource:@"project.pbxproj" ofType:@"sample"]; - XCodeSupportFolder = [NSURL URLWithString:@".xCodeSupport/" relativeToURL:currentProjectURL]; + XCodeSupportFolder = currentProjectURL; XCodeSupportProject = [NSURL URLWithString:XCodeSupportProjectName relativeToURL:XCodeSupportFolder]; - XCodeSupportProjectSources = [NSURL URLWithString:@"Sources/" relativeToURL:XCodeSupportFolder]; + XCodeSupportProjectSources = [NSURL URLWithString:@"XcodeSupport/" relativeToURL:XCodeSupportFolder]; XCodeSupportPBXPath = [NSString stringWithFormat:@"%@/project.pbxproj", [XCodeSupportProject path]]; + PBXModifierScriptPath = [[NSBundle mainBundle] pathForResource:@"pbxprojModifier" ofType:@"py"]; + //[fm removeItemAtURL:XCodeSupportFolder error:nil]; // create the template project if it doesn't exist - if (![fm fileExistsAtPath:[XCodeSupportFolder path]]) + if (![fm fileExistsAtPath:[XCodeSupportProjectSources path]]) { NSLog(@"Xcode support folder created at: %@", [XCodeSupportProject path]); [fm createDirectoryAtPath:[XCodeSupportProject path] withIntermediateDirectories:YES attributes:nil error:nil]; @@ -463,14 +504,6 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification DLog(@"Reading the content of the project.pbxproj"); NSMutableString *PBXContent = [NSMutableString stringWithContentsOfFile:XCodeSupportPBXPath encoding:NSUTF8StringEncoding error:nil]; - [PBXContent replaceOccurrencesOfString:@"${CappuccinoProjectName}" - withString:currentProjectName - options:NSCaseInsensitiveSearch - range:NSMakeRange(0, [PBXContent length])]; - [PBXContent replaceOccurrencesOfString:@"${CappuccinoProjectRelativePath}" - withString:@".." - options:NSCaseInsensitiveSearch - range:NSMakeRange(0, [PBXContent length])]; [PBXContent writeToFile:XCodeSupportPBXPath atomically:YES encoding:NSUTF8StringEncoding error:nil]; DLog(@"PBX file adapted to the project"); @@ -614,6 +647,7 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification [ignoredFilePaths addObject:@"*/.xCodeSupport/*"]; [ignoredFilePaths addObject:@"*/Build/*"]; [ignoredFilePaths addObject:@"*/NS_*.j"]; + [ignoredFilePaths addObject:@"*main.j"]; NSLog(@"Ignoring file paths: %@", ignoredFilePaths); } @@ -710,6 +744,19 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification { DLog(@"cleaning shadow file: %@", subpath); [fm removeItemAtPath:shadowFullPath error:nil]; + + NSArray *PBXArguments = [NSArray arrayWithObjects: @"-c", + [NSString stringWithFormat:@"(%@; python %@ remove '%@' '%@') 2>&1", + profilePath, + PBXModifierScriptPath, + XCodeSupportPBXPath, + shadowFullPath],nil]; + + DLog(@"Cleaning PBX reference task..."); + NSArray *statusInfo = [self runTask:PBXArguments]; + NSNumber *status = [statusInfo objectAtIndex:0]; + NSString *response = [statusInfo objectAtIndex:1]; + DLog(@"PBX Reference cleaning status/response: %@/%@", status, response); if (![self supportFileLevelAPI] && [self respondsToSelector:@selector(updateLastModificationDate:forPath:)]) [self performSelector:@selector(updateLastModificationDate:forPath:) withObject:nil withObject:unshadowed]; diff --git a/Tools/XcodeCapp/project.pbxproj.sample.OLD b/Tools/XcodeCapp/project.pbxproj.sample.OLD new file mode 100644 index 000000000..9b41eca5b --- /dev/null +++ b/Tools/XcodeCapp/project.pbxproj.sample.OLD @@ -0,0 +1,354 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 9EEC4498135749D200615446 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EEC4497135749D200615446 /* Cocoa.framework */; }; + 9EEC44B5135749D300615446 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EEC4497135749D200615446 /* Cocoa.framework */; }; + 9EEC44CC13574A0B00615446 /* ${CappuccinoProjectName} in Sources */ = {isa = PBXBuildFile; fileRef = 9EEC44CB13574A0B00615446 /* ${CappuccinoProjectName} */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 9EEC44B6135749D300615446 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9EEC448A135749D200615446 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 9EEC4492135749D200615446; + remoteInfo = Another; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 9EEC4493135749D200615446 /* Another.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Another.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 9EEC4497135749D200615446 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 9EEC449A135749D300615446 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 9EEC449B135749D300615446 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; + 9EEC449C135749D300615446 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 9EEC44B4135749D300615446 /* AnotherTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AnotherTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; + 9EEC44CB13574A0B00615446 /* ${CappuccinoProjectName} */ = {isa = PBXFileReference; lastKnownFileType = folder; name = ${CappuccinoProjectName}; path = ${CappuccinoProjectRelativePath}; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9EEC4490135749D200615446 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9EEC4498135749D200615446 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9EEC44B0135749D300615446 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9EEC44B5135749D300615446 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9EEC4488135749D200615446 = { + isa = PBXGroup; + children = ( + 9EEC44CB13574A0B00615446 /* ${CappuccinoProjectName} */, + 9EEC4496135749D200615446 /* Frameworks */, + 9EEC4494135749D200615446 /* Products */, + ); + sourceTree = ""; + }; + 9EEC4494135749D200615446 /* Products */ = { + isa = PBXGroup; + children = ( + 9EEC4493135749D200615446 /* Another.app */, + 9EEC44B4135749D300615446 /* AnotherTests.octest */, + ); + name = Products; + sourceTree = ""; + }; + 9EEC4496135749D200615446 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 9EEC4497135749D200615446 /* Cocoa.framework */, + 9EEC4499135749D300615446 /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 9EEC4499135749D300615446 /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 9EEC449A135749D300615446 /* AppKit.framework */, + 9EEC449B135749D300615446 /* CoreData.framework */, + 9EEC449C135749D300615446 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 9EEC4492135749D200615446 /* Another */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9EEC44C5135749D300615446 /* Build configuration list for PBXNativeTarget "Another" */; + buildPhases = ( + 9EEC448F135749D200615446 /* Sources */, + 9EEC4490135749D200615446 /* Frameworks */, + 9EEC4491135749D200615446 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Another; + productName = Another; + productReference = 9EEC4493135749D200615446 /* Another.app */; + productType = "com.apple.product-type.application"; + }; + 9EEC44B3135749D300615446 /* AnotherTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9EEC44C8135749D300615446 /* Build configuration list for PBXNativeTarget "AnotherTests" */; + buildPhases = ( + 9EEC44AF135749D300615446 /* Sources */, + 9EEC44B0135749D300615446 /* Frameworks */, + 9EEC44B1135749D300615446 /* Resources */, + 9EEC44B2135749D300615446 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 9EEC44B7135749D300615446 /* PBXTargetDependency */, + ); + name = AnotherTests; + productName = AnotherTests; + productReference = 9EEC44B4135749D300615446 /* AnotherTests.octest */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9EEC448A135749D200615446 /* Project object */ = { + isa = PBXProject; + attributes = { + ORGANIZATIONNAME = "280 North, Inc."; + }; + buildConfigurationList = 9EEC448D135749D200615446 /* Build configuration list for PBXProject "Another" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 9EEC4488135749D200615446; + productRefGroup = 9EEC4494135749D200615446 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 9EEC4492135749D200615446 /* Another */, + 9EEC44B3135749D300615446 /* AnotherTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 9EEC4491135749D200615446 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9EEC44CC13574A0B00615446 /* ${CappuccinoProjectName} in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9EEC44B1135749D300615446 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 9EEC44B2135749D300615446 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 9EEC448F135749D200615446 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9EEC44AF135749D300615446 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 9EEC44B7135749D300615446 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 9EEC4492135749D200615446 /* Another */; + targetProxy = 9EEC44B6135749D300615446 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 9EEC44C3135749D300615446 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 9EEC44C4135749D300615446 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; + SDKROOT = macosx; + }; + name = Release; + }; + 9EEC44C6135749D300615446 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Another/Another-Prefix.pch"; + INFOPLIST_FILE = "Another/Another-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 9EEC44C7135749D300615446 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Another/Another-Prefix.pch"; + INFOPLIST_FILE = "Another/Another-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + 9EEC44C9135749D300615446 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Another.app/Contents/MacOS/Another"; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "AnotherTests/AnotherTests-Prefix.pch"; + INFOPLIST_FILE = "AnotherTests/AnotherTests-Info.plist"; + OTHER_LDFLAGS = ( + "-framework", + SenTestingKit, + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = octest; + }; + name = Debug; + }; + 9EEC44CA135749D300615446 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Another.app/Contents/MacOS/Another"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "AnotherTests/AnotherTests-Prefix.pch"; + INFOPLIST_FILE = "AnotherTests/AnotherTests-Info.plist"; + OTHER_LDFLAGS = ( + "-framework", + SenTestingKit, + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = octest; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 9EEC448D135749D200615446 /* Build configuration list for PBXProject "Another" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9EEC44C3135749D300615446 /* Debug */, + 9EEC44C4135749D300615446 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9EEC44C5135749D300615446 /* Build configuration list for PBXNativeTarget "Another" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9EEC44C6135749D300615446 /* Debug */, + 9EEC44C7135749D300615446 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 9EEC44C8135749D300615446 /* Build configuration list for PBXNativeTarget "AnotherTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9EEC44C9135749D300615446 /* Debug */, + 9EEC44CA135749D300615446 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9EEC448A135749D200615446 /* Project object */; +} \ No newline at end of file