Permalink
Browse files

Support for iOS project files

  • Loading branch information...
1 parent ea6feff commit b16c8d9fc3b62b6037641b2e1062c3f417b5812c @0xced committed Mar 7, 2012
@@ -6,3 +6,4 @@
#import <DevToolsCore/PBXReference.h>
#import <DevToolsCore/PBXTarget.h>
#import <DevToolsCore/XCBuildConfiguration.h>
+#import <DevToolsCore/XCConfigurationList.h>
@@ -1,4 +1,5 @@
#import "PBXTarget.h"
+#import "XCConfigurationList.h"
@protocol PBXProject <PBXContainer, NSObject>
@@ -11,9 +12,9 @@
- (NSString *) name;
-- (NSArray *) buildConfigurations; // XCBuildConfiguration
+- (id<XCConfigurationList>) buildConfigurationList;
-- (NSString *) expandedValueForString:(NSString *)string;
+- (NSString *) expandedValueForString:(NSString *)string forBuildParameters:(id)buildParameters;
- (BOOL) writeToFileSystemProjectFile:(BOOL)projectWrite userFile:(BOOL)userWrite checkNeedsRevert:(BOOL)checkNeedsRevert;
@@ -1,12 +1,13 @@
#import "PBXBuildPhase.h"
+#import "XCConfigurationList.h"
@protocol PBXTarget <NSObject>
- (NSString *) name;
-- (NSArray *) buildConfigurations; // XCBuildConfiguration
+- (id<XCConfigurationList>) buildConfigurationList;
-- (NSString *) expandedValueForString:(NSString *)string;
+- (NSString *) expandedValueForString:(NSString *)string forBuildParameters:(id)buildParameters;
- (id<PBXBuildPhase>) buildPhaseOfClass:(Class)buildPhaseClass;
- (void) addBuildPhase:(id<PBXBuildPhase>)buildPhase;
@@ -0,0 +1,7 @@
+#import "PBXFileReference.h"
+
+@protocol XCConfigurationList <NSObject>
+
+- (NSArray *) buildConfigurations; // XCBuildConfiguration
+
+@end
Binary file not shown.
View
@@ -73,9 +73,9 @@
<string>PBXProject</string>
<key>-activeTarget</key>
<string>PBXTarget</string>
- <key>-buildConfigurations</key>
- <string>NSArray.XCBuildConfiguration</string>
- <key>-expandedValueForString:</key>
+ <key>-buildConfigurationList</key>
+ <string>XCConfigurationList</string>
+ <key>-expandedValueForString:forBuildParameters:</key>
<string>NSString</string>
<key>-name</key>
<string>NSString</string>
@@ -97,8 +97,8 @@
<dict>
<key>-addBuildPhase:</key>
<string>void</string>
- <key>-buildConfigurations</key>
- <string>NSArray.XCBuildConfiguration</string>
+ <key>-buildConfigurationList</key>
+ <string>XCConfigurationList</string>
<key>-buildPhaseOfClass:</key>
<string>PBXBuildPhase</string>
<key>-defaultFrameworksBuildPhase</key>
@@ -111,7 +111,7 @@
<string>PBXBuildPhase</string>
<key>-defaultSourceCodeBuildPhase</key>
<string>PBXBuildPhase</string>
- <key>-expandedValueForString:</key>
+ <key>-expandedValueForString:forBuildParameters:</key>
<string>NSString</string>
<key>-name</key>
<string>NSString</string>
@@ -125,6 +125,11 @@
<key>-setBaseConfigurationReference:</key>
<string>void</string>
</dict>
+ <key>XCConfigurationList</key>
+ <dict>
+ <key>-buildConfigurations</key>
+ <string>NSArray.XCBuildConfiguration</string>
+ </dict>
</dict>
</dict>
</dict>
View
@@ -13,4 +13,5 @@ void protocols()
(void)@protocol(PBXReference);
(void)@protocol(PBXTarget);
(void)@protocol(XCBuildConfiguration);
+ (void)@protocol(XCConfigurationList);
}
View
@@ -50,12 +50,12 @@ + (void) initialize
}
// Xcode < 4.3
- NSString *devToolsCorePath = [developerDir stringByAppendingPathComponent:@"Library/PrivateFrameworks/DevToolsCore.framework"];
+ NSString *devToolsCorePath = [developerDir stringByAppendingPathComponent:@"Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework"];
NSBundle *devToolsCoreBundle = [NSBundle bundleWithPath:devToolsCorePath];
if (!devToolsCoreBundle)
{
// Xcode >= 4.3
- devToolsCorePath = [developerDir stringByAppendingPathComponent:@"../OtherFrameworks/DevToolsCore.framework"];
+ devToolsCorePath = [developerDir stringByAppendingPathComponent:@"../PlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework"];
devToolsCoreBundle = [NSBundle bundleWithPath:devToolsCorePath];
}
NSError *loadError = nil;
@@ -65,13 +65,26 @@ + (void) initialize
exit(EX_SOFTWARE);
}
+ for (NSBundle *framework in [NSBundle allFrameworks])
+ {
+ if ([[[framework executableURL] lastPathComponent] isEqualToString:@"IDEFoundation"])
+ {
+ void *IDEFoundation = dlopen([[framework executablePath] fileSystemRepresentation], RTLD_LAZY);
+ void(*IDEInitialize)(void) = dlsym(IDEFoundation, "IDEInitialize");
+ if (IDEInitialize)
+ IDEInitialize();
+ dlclose(IDEFoundation);
+ break;
+ }
+ }
+
// XCInitializeCoreIfNeeded is called with NSClassFromString(@"NSApplication") != nil as argument in +[PBXProject projectWithFile:errorHandler:readOnly:]
// At that point, the AppKit framework is loaded, _includeUIPlugins is set to YES and all plugins are loaded, even those with XCPluginHasUI == NO
- void *devToolsCore = dlopen([[devToolsCoreBundle executablePath] fileSystemRepresentation], RTLD_LAZY);
- void(*XCInitializeCoreIfNeeded)(BOOL hasGUI) = dlsym(devToolsCore, "XCInitializeCoreIfNeeded");
+ void *DevToolsCore = dlopen([[devToolsCoreBundle executablePath] fileSystemRepresentation], RTLD_LAZY);
+ void(*XCInitializeCoreIfNeeded)(BOOL hasGUI) = dlsym(DevToolsCore, "XCInitializeCoreIfNeeded");
if (XCInitializeCoreIfNeeded)
XCInitializeCoreIfNeeded(NO);
- dlclose(devToolsCore);
+ dlclose(DevToolsCore);
BOOL isSafe = YES;
NSDictionary *classInfo = [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"XCDUndocumentedChecker"] objectForKey:@"Classes"];
@@ -190,7 +203,7 @@ - (int) readBuildSetting:(NSArray *)arguments
NSString *buildSetting = [arguments objectAtIndex:0];
NSString *settingString = [NSString stringWithFormat:@"$(%@)", buildSetting];
- NSString *expandedString = [targetName ? (id)target : (id)project expandedValueForString:settingString];
+ NSString *expandedString = [target expandedValueForString:settingString forBuildParameters:nil];
if ([expandedString length] > 0)
ddprintf(@"%@\n", expandedString);
@@ -224,7 +237,9 @@ - (int) addXcconfig:(NSArray *)arguments
if (![XCBuildConfiguration fileReference:xcconfig isValidBaseConfigurationFile:&error])
@throw [DDCliParseException parseExceptionWithReason:[NSString stringWithFormat:@"The configuration file %@ is not valid. %@", xcconfigPath, [error localizedDescription]] exitCode:EX_USAGE];
- for (id<XCBuildConfiguration> configuration in [targetName ? (id)target : (id)project buildConfigurations])
+ id<XCConfigurationList> buildConfigurationList = [project buildConfigurationList];
+ NSArray *buildConfigurations = [buildConfigurationList buildConfigurations];
+ for (id<XCBuildConfiguration> configuration in buildConfigurations)
[configuration setBaseConfigurationReference:xcconfig];
[self addGroupNamed:@"Configurations" beforeGroupNamed:@"Frameworks"];
@@ -59,6 +59,7 @@
DA8C9FFE1302AF93008B3560 /* PBXTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBXTarget.h; sourceTree = "<group>"; };
DA8CA0041302B0D9008B3560 /* DevToolsCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DevToolsCore.h; sourceTree = "<group>"; };
DA8CA0301302B27C008B3560 /* PBXBuildFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBXBuildFile.h; sourceTree = "<group>"; };
+ DAF6DA9515076749002AFA90 /* XCConfigurationList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCConfigurationList.h; sourceTree = "<group>"; };
DAFF25CA1303ECB100584E0E /* XCDUndocumentedChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = XCDUndocumentedChecker.h; path = Sources/XCDUndocumentedChecker.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
DAFF25CB1303ECB100584E0E /* XCDUndocumentedChecker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = XCDUndocumentedChecker.m; path = Sources/XCDUndocumentedChecker.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
DAFF2AD913055EF500584E0E /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -133,6 +134,7 @@
DA7A0218134F06FF00F89E9B /* PBXReference.h */,
DA8C9FFE1302AF93008B3560 /* PBXTarget.h */,
DA7A0D4F135304F000F89E9B /* XCBuildConfiguration.h */,
+ DAF6DA9515076749002AFA90 /* XCConfigurationList.h */,
);
path = DevToolsCore;
sourceTree = "<group>";
@@ -294,6 +296,7 @@
DEPLOYMENT_LOCATION = YES;
DSTROOT = "$(DEVELOPER_DIR)";
GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_ENABLE_OBJC_GC = required;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -302,7 +305,7 @@
"\"$(SRCROOT)\"",
);
INSTALL_PATH = /usr/bin;
- LD_RUNPATH_SEARCH_PATHS = "@loader_path/../../Library/PrivateFrameworks/";
+ LD_RUNPATH_SEARCH_PATHS = "@loader_path/../../Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks @loader_path/../../Library/PrivateFrameworks/";
LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/Externals/ddcli/lib\"";
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
@@ -317,14 +320,15 @@
DEPLOYMENT_LOCATION = YES;
DSTROOT = "$(DEVELOPER_DIR)";
GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_ENABLE_OBJC_GC = required;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/Externals/ddcli/include\"",
"\"$(SRCROOT)\"",
);
INSTALL_PATH = /usr/bin;
- LD_RUNPATH_SEARCH_PATHS = "@loader_path/../../Library/PrivateFrameworks/";
+ LD_RUNPATH_SEARCH_PATHS = "@loader_path/../../Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks @loader_path/../../Library/PrivateFrameworks/";
LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/Externals/ddcli/lib\"";
SDKROOT = macosx;
};

0 comments on commit b16c8d9

Please sign in to comment.