Skip to content

Instantly share code, notes, and snippets.

@ddb
Created February 13, 2011 07:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddb/824517 to your computer and use it in GitHub Desktop.
Save ddb/824517 to your computer and use it in GitHub Desktop.
a declaration of the types used in an Xcode project file.
//
// XCObject.h
// XcodeProj
//
// Created by David Brown on 2/13/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface XCObject : NSObject {
@private
}
- (void)inflateFromDictionary:(NSDictionary*)dict;
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store;
+ (XCObject*)XCObjectFromDictionary:(NSDictionary*)dict;
@end
@class XPPBXAggregateTarget;
@class XPPBXAppleScriptBuildPhase;
@class XPPBXApplicationReference;
@class XPPBXApplicationTarget;
@class XPPBXBuildFile;
@class XPPBXBuildRule;
@class XPPBXBuildStyle;
@class XPPBXContainerItemProxy;
@class XPPBXCopyFilesBuildPhase;
@class XPPBXFileReference;
@class XPPBXFrameworkReference;
@class XPPBXFrameworksBuildPhase;
@class XPPBXGroup;
@class XPPBXHeadersBuildPhase;
@class XPPBXLegacyTarget;
@class XPPBXNativeTarget;
@class XPPBXProject;
@class XPPBXReferenceProxy;
@class XPPBXResourcesBuildPhase;
@class XPPBXRezBuildPhase;
@class XPPBXShellScriptBuildPhase;
@class XPPBXSourcesBuildPhase;
@class XPPBXTargetDependency;
@class XPPBXVariantGroup;
@class XPXCBuildConfiguration;
@class XPXCConfigurationList;
@class XPXCVersionGroup;
@interface XPPBXAggregateTarget : XCObject {}
@property (nonatomic, retain) XPXCConfigurationList* buildConfigurationList;
// types in buildPhases: PBXCopyFilesBuildPhase, PBXShellScriptBuildPhase
@property (nonatomic, retain) NSArray* buildPhases;
// types in dependencies: PBXTargetDependency
@property (nonatomic, retain) NSArray* dependencies;
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* productName;
@end
@interface XPPBXAppleScriptBuildPhase : XCObject {}
@property (nonatomic, retain) NSString* buildActionMask;
@property (nonatomic, retain) NSString* contextName;
// types in files: PBXBuildFile
@property (nonatomic, retain) NSArray* files;
@property (nonatomic, retain) NSString* isSharedContext;
@property (nonatomic, retain) NSString* runOnlyForDeploymentPostprocessing;
@end
@interface XPPBXApplicationReference : XCObject {}
@property (nonatomic, retain) NSString* path;
@property (nonatomic, retain) NSString* refType;
@end
@interface XPPBXApplicationTarget : XCObject {}
@property (nonatomic, retain) XPXCConfigurationList* buildConfigurationList;
// types in buildPhases: PBXResourcesBuildPhase, PBXFrameworksBuildPhase, PBXSourcesBuildPhase, PBXHeadersBuildPhase
@property (nonatomic, retain) NSArray* buildPhases;
@property (nonatomic, retain) NSDictionary* buildSettings;
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* productInstallPath;
@property (nonatomic, retain) NSString* productName;
@property (nonatomic, retain) XPPBXFileReference* productReference;
@property (nonatomic, retain) NSString* productSettingsXML;
@end
@interface XPPBXBuildFile : XCObject {}
@property (nonatomic, retain) XPPBXFileReference* fileRef;
@property (nonatomic, retain) NSDictionary* settings;
@end
@interface XPPBXBuildRule : XCObject {}
@property (nonatomic, retain) NSString* compilerSpec;
@property (nonatomic, retain) NSString* filePatterns;
@property (nonatomic, retain) NSString* fileType;
@property (nonatomic, retain) NSString* isEditable;
// types in outputFiles: NSString
@property (nonatomic, retain) NSArray* outputFiles;
@property (nonatomic, retain) NSString* script;
@end
@interface XPPBXBuildStyle : XCObject {}
@property (nonatomic, retain) NSDictionary* buildSettings;
@property (nonatomic, retain) NSString* name;
@end
@interface XPPBXContainerItemProxy : XCObject {}
@property (nonatomic, retain) XPPBXProject* containerPortal;
@property (nonatomic, retain) NSString* proxyType;
@property (nonatomic, retain) XPPBXNativeTarget* remoteGlobalIDString;
@property (nonatomic, retain) NSString* remoteInfo;
@end
@interface XPPBXCopyFilesBuildPhase : XCObject {}
@property (nonatomic, retain) NSString* buildActionMask;
@property (nonatomic, retain) NSString* dstPath;
@property (nonatomic, retain) NSString* dstSubfolderSpec;
// types in files: PBXBuildFile
@property (nonatomic, retain) NSArray* files;
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* runOnlyForDeploymentPostprocessing;
@end
@interface XPPBXFileReference : XCObject {}
@property (nonatomic, retain) NSString* explicitFileType;
@property (nonatomic, retain) NSString* fileEncoding;
@property (nonatomic, retain) NSString* includeInIndex;
@property (nonatomic, retain) NSString* indentWidth;
@property (nonatomic, retain) NSString* languageSpecificationIdentifier;
@property (nonatomic, retain) NSString* lastKnownFileType;
@property (nonatomic, retain) NSString* lineEnding;
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* path;
@property (nonatomic, retain) NSString* plistStructureDefinitionIdentifier;
@property (nonatomic, retain) NSString* refType;
@property (nonatomic, retain) NSString* sourceTree;
@property (nonatomic, retain) NSString* tabWidth;
@property (nonatomic, retain) NSString* usesTabs;
@property (nonatomic, retain) NSString* wrapsLines;
@property (nonatomic, retain) NSString* xcLanguageSpecificationIdentifier;
@end
@interface XPPBXFrameworkReference : XCObject {}
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* path;
@property (nonatomic, retain) NSString* refType;
@end
@interface XPPBXFrameworksBuildPhase : XCObject {}
@property (nonatomic, retain) NSString* buildActionMask;
// types in files: PBXBuildFile
@property (nonatomic, retain) NSArray* files;
@property (nonatomic, retain) NSString* runOnlyForDeploymentPostprocessing;
@end
@interface XPPBXGroup : XCObject {}
// types in children: PBXReferenceProxy, PBXApplicationReference, PBXFileReference, PBXFrameworkReference, PBXGroup, PBXVariantGroup, XCVersionGroup
@property (nonatomic, retain) NSArray* children;
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* path;
@property (nonatomic, retain) NSString* refType;
@property (nonatomic, retain) NSString* sourceTree;
@end
@interface XPPBXHeadersBuildPhase : XCObject {}
@property (nonatomic, retain) NSString* buildActionMask;
// types in files: PBXBuildFile
@property (nonatomic, retain) NSArray* files;
@property (nonatomic, retain) NSString* runOnlyForDeploymentPostprocessing;
@end
@interface XPPBXLegacyTarget : XCObject {}
@property (nonatomic, retain) NSString* buildArgumentsString;
@property (nonatomic, retain) XPXCConfigurationList* buildConfigurationList;
@property (nonatomic, retain) NSString* buildToolPath;
@property (nonatomic, retain) NSString* buildWorkingDirectory;
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* passBuildSettingsInEnvironment;
@property (nonatomic, retain) NSString* productName;
@end
@interface XPPBXNativeTarget : XCObject {}
@property (nonatomic, retain) XPXCConfigurationList* buildConfigurationList;
// types in buildPhases: PBXAppleScriptBuildPhase, PBXResourcesBuildPhase, PBXCopyFilesBuildPhase, PBXFrameworksBuildPhase, PBXShellScriptBuildPhase, PBXHeadersBuildPhase, PBXSourcesBuildPhase, PBXRezBuildPhase
@property (nonatomic, retain) NSArray* buildPhases;
// types in buildRules: PBXBuildRule
@property (nonatomic, retain) NSArray* buildRules;
@property (nonatomic, retain) NSDictionary* buildSettings;
// types in dependencies: PBXTargetDependency
@property (nonatomic, retain) NSArray* dependencies;
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* productInstallPath;
@property (nonatomic, retain) NSString* productName;
@property (nonatomic, retain) XPPBXFileReference* productReference;
@property (nonatomic, retain) NSString* productType;
@end
@interface XPPBXProject : XCObject {}
@property (nonatomic, retain) NSDictionary* attributes;
@property (nonatomic, retain) XPXCConfigurationList* buildConfigurationList;
@property (nonatomic, retain) NSDictionary* buildSettings;
// types in buildStyles: PBXBuildStyle
@property (nonatomic, retain) NSArray* buildStyles;
@property (nonatomic, retain) NSString* compatibilityVersion;
@property (nonatomic, retain) NSString* developmentRegion;
@property (nonatomic, retain) NSString* hasScannedForEncodings;
// types in knownRegions: NSString
@property (nonatomic, retain) NSArray* knownRegions;
@property (nonatomic, retain) XPPBXGroup* mainGroup;
@property (nonatomic, retain) XPPBXGroup* productRefGroup;
@property (nonatomic, retain) NSString* projectDirPath;
// types in projectReferences: NSDictionary
@property (nonatomic, retain) NSArray* projectReferences;
@property (nonatomic, retain) NSString* projectRoot;
@property (nonatomic, retain) NSString* shouldCheckCompatibility;
// types in targets: PBXNativeTarget, PBXAggregateTarget, PBXLegacyTarget, PBXApplicationTarget
@property (nonatomic, retain) NSArray* targets;
@end
@interface XPPBXReferenceProxy : XCObject {}
@property (nonatomic, retain) NSString* fileType;
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* path;
@property (nonatomic, retain) XPPBXContainerItemProxy* remoteRef;
@property (nonatomic, retain) NSString* sourceTree;
@end
@interface XPPBXResourcesBuildPhase : XCObject {}
@property (nonatomic, retain) NSString* buildActionMask;
// types in files: PBXBuildFile
@property (nonatomic, retain) NSArray* files;
@property (nonatomic, retain) NSString* runOnlyForDeploymentPostprocessing;
@end
@interface XPPBXRezBuildPhase : XCObject {}
@property (nonatomic, retain) NSString* buildActionMask;
// types in files: PBXBuildFile
@property (nonatomic, retain) NSArray* files;
@property (nonatomic, retain) NSString* runOnlyForDeploymentPostprocessing;
@end
@interface XPPBXShellScriptBuildPhase : XCObject {}
@property (nonatomic, retain) NSString* buildActionMask;
// types in inputPaths: NSString
@property (nonatomic, retain) NSArray* inputPaths;
@property (nonatomic, retain) NSString* name;
// types in outputPaths: NSString
@property (nonatomic, retain) NSArray* outputPaths;
@property (nonatomic, retain) NSString* runOnlyForDeploymentPostprocessing;
@property (nonatomic, retain) NSString* shellPath;
@property (nonatomic, retain) NSString* shellScript;
@property (nonatomic, retain) NSString* showEnvVarsInLog;
@end
@interface XPPBXSourcesBuildPhase : XCObject {}
@property (nonatomic, retain) NSString* buildActionMask;
// types in files: PBXBuildFile
@property (nonatomic, retain) NSArray* files;
@property (nonatomic, retain) NSString* runOnlyForDeploymentPostprocessing;
@end
@interface XPPBXTargetDependency : XCObject {}
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) XPPBXNativeTarget* target;
@property (nonatomic, retain) XPPBXContainerItemProxy* targetProxy;
@end
@interface XPPBXVariantGroup : XCObject {}
// types in children: PBXVariantGroup, PBXFileReference
@property (nonatomic, retain) NSArray* children;
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* path;
@property (nonatomic, retain) NSString* refType;
@property (nonatomic, retain) NSString* sourceTree;
@end
@interface XPXCBuildConfiguration : XCObject {}
@property (nonatomic, retain) XPPBXFileReference* baseConfigurationReference;
@property (nonatomic, retain) NSDictionary* buildSettings;
@property (nonatomic, retain) NSString* name;
@end
@interface XPXCConfigurationList : XCObject {}
// types in buildConfigurations: XCBuildConfiguration
@property (nonatomic, retain) NSArray* buildConfigurations;
@property (nonatomic, retain) NSString* defaultConfigurationIsVisible;
@property (nonatomic, retain) NSString* defaultConfigurationName;
@end
@interface XPXCVersionGroup : XCObject {}
// types in children: PBXFileReference
@property (nonatomic, retain) NSArray* children;
@property (nonatomic, retain) XPPBXFileReference* currentVersion;
@property (nonatomic, retain) NSString* path;
@property (nonatomic, retain) NSString* sourceTree;
@property (nonatomic, retain) NSString* versionGroupType;
@end
//
// XCObject.m
// XcodeProj
//
// Created by David Brown on 2/13/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "XCObject.h"
@implementation XCObject
- (id)init
{
self = [super init];
if (self) {
// Initialization code here.
}
return self;
}
- (void)dealloc
{
[super dealloc];
}
- (void)inflateFromDictionary:(NSDictionary*)dict {
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
}
+ (XCObject*)XCObjectFromDictionary:(NSDictionary*)dict {
NSString* objIsa = [dict objectForKey:@"isa"];
XCObject* xcobj = [[[NSClassFromString([NSString stringWithFormat:@"XP%@", objIsa]) alloc] init] autorelease];
[xcobj inflateFromDictionary:dict];
return xcobj;
}
@end
@implementation XPPBXAggregateTarget
@synthesize buildConfigurationList;
@synthesize buildPhases;
@synthesize dependencies;
@synthesize name;
@synthesize productName;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.name = [dict objectForKey:@"name"];
self.productName = [dict objectForKey:@"productName"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
self.buildConfigurationList = [store objectForKey:[dict objectForKey:@"buildConfigurationList"]];
NSMutableArray* buildPhasesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"buildPhases"]) {
[buildPhasesArray addObject:[store objectForKey:objectName]];
}
self.buildPhases = buildPhasesArray;
NSMutableArray* dependenciesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"dependencies"]) {
[dependenciesArray addObject:[store objectForKey:objectName]];
}
self.dependencies = dependenciesArray;
}
- (void)dealloc {
[buildConfigurationList release], buildConfigurationList = nil;
[buildPhases release], buildPhases = nil;
[dependencies release], dependencies = nil;
[name release], name = nil;
[productName release], productName = nil;
[super dealloc];
}
@end
@implementation XPPBXAppleScriptBuildPhase
@synthesize buildActionMask;
@synthesize contextName;
@synthesize files;
@synthesize isSharedContext;
@synthesize runOnlyForDeploymentPostprocessing;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildActionMask = [dict objectForKey:@"buildActionMask"];
self.contextName = [dict objectForKey:@"contextName"];
self.isSharedContext = [dict objectForKey:@"isSharedContext"];
self.runOnlyForDeploymentPostprocessing = [dict objectForKey:@"runOnlyForDeploymentPostprocessing"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* filesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"files"]) {
[filesArray addObject:[store objectForKey:objectName]];
}
self.files = filesArray;
}
- (void)dealloc {
[buildActionMask release], buildActionMask = nil;
[contextName release], contextName = nil;
[files release], files = nil;
[isSharedContext release], isSharedContext = nil;
[runOnlyForDeploymentPostprocessing release], runOnlyForDeploymentPostprocessing = nil;
[super dealloc];
}
@end
@implementation XPPBXApplicationReference
@synthesize path;
@synthesize refType;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.path = [dict objectForKey:@"path"];
self.refType = [dict objectForKey:@"refType"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
}
- (void)dealloc {
[path release], path = nil;
[refType release], refType = nil;
[super dealloc];
}
@end
@implementation XPPBXApplicationTarget
@synthesize buildConfigurationList;
@synthesize buildPhases;
@synthesize buildSettings;
@synthesize name;
@synthesize productInstallPath;
@synthesize productName;
@synthesize productReference;
@synthesize productSettingsXML;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildSettings = [dict objectForKey:@"buildSettings"];
self.name = [dict objectForKey:@"name"];
self.productInstallPath = [dict objectForKey:@"productInstallPath"];
self.productName = [dict objectForKey:@"productName"];
self.productSettingsXML = [dict objectForKey:@"productSettingsXML"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
self.buildConfigurationList = [store objectForKey:[dict objectForKey:@"buildConfigurationList"]];
NSMutableArray* buildPhasesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"buildPhases"]) {
[buildPhasesArray addObject:[store objectForKey:objectName]];
}
self.buildPhases = buildPhasesArray;
self.productReference = [store objectForKey:[dict objectForKey:@"productReference"]];
}
- (void)dealloc {
[buildConfigurationList release], buildConfigurationList = nil;
[buildPhases release], buildPhases = nil;
[buildSettings release], buildSettings = nil;
[name release], name = nil;
[productInstallPath release], productInstallPath = nil;
[productName release], productName = nil;
[productReference release], productReference = nil;
[productSettingsXML release], productSettingsXML = nil;
[super dealloc];
}
@end
@implementation XPPBXBuildFile
@synthesize fileRef;
@synthesize settings;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.settings = [dict objectForKey:@"settings"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
self.fileRef = [store objectForKey:[dict objectForKey:@"fileRef"]];
}
- (void)dealloc {
[fileRef release], fileRef = nil;
[settings release], settings = nil;
[super dealloc];
}
@end
@implementation XPPBXBuildRule
@synthesize compilerSpec;
@synthesize filePatterns;
@synthesize fileType;
@synthesize isEditable;
@synthesize outputFiles;
@synthesize script;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.compilerSpec = [dict objectForKey:@"compilerSpec"];
self.filePatterns = [dict objectForKey:@"filePatterns"];
self.fileType = [dict objectForKey:@"fileType"];
self.isEditable = [dict objectForKey:@"isEditable"];
self.script = [dict objectForKey:@"script"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* outputFilesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"outputFiles"]) {
[outputFilesArray addObject:objectName];
}
self.outputFiles = outputFilesArray;
}
- (void)dealloc {
[compilerSpec release], compilerSpec = nil;
[filePatterns release], filePatterns = nil;
[fileType release], fileType = nil;
[isEditable release], isEditable = nil;
[outputFiles release], outputFiles = nil;
[script release], script = nil;
[super dealloc];
}
@end
@implementation XPPBXBuildStyle
@synthesize buildSettings;
@synthesize name;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildSettings = [dict objectForKey:@"buildSettings"];
self.name = [dict objectForKey:@"name"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
}
- (void)dealloc {
[buildSettings release], buildSettings = nil;
[name release], name = nil;
[super dealloc];
}
@end
@implementation XPPBXContainerItemProxy
@synthesize containerPortal;
@synthesize proxyType;
@synthesize remoteGlobalIDString;
@synthesize remoteInfo;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.proxyType = [dict objectForKey:@"proxyType"];
self.remoteInfo = [dict objectForKey:@"remoteInfo"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
self.containerPortal = [store objectForKey:[dict objectForKey:@"containerPortal"]];
self.remoteGlobalIDString = [store objectForKey:[dict objectForKey:@"remoteGlobalIDString"]];
}
- (void)dealloc {
[containerPortal release], containerPortal = nil;
[proxyType release], proxyType = nil;
[remoteGlobalIDString release], remoteGlobalIDString = nil;
[remoteInfo release], remoteInfo = nil;
[super dealloc];
}
@end
@implementation XPPBXCopyFilesBuildPhase
@synthesize buildActionMask;
@synthesize dstPath;
@synthesize dstSubfolderSpec;
@synthesize files;
@synthesize name;
@synthesize runOnlyForDeploymentPostprocessing;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildActionMask = [dict objectForKey:@"buildActionMask"];
self.dstPath = [dict objectForKey:@"dstPath"];
self.dstSubfolderSpec = [dict objectForKey:@"dstSubfolderSpec"];
self.name = [dict objectForKey:@"name"];
self.runOnlyForDeploymentPostprocessing = [dict objectForKey:@"runOnlyForDeploymentPostprocessing"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* filesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"files"]) {
[filesArray addObject:[store objectForKey:objectName]];
}
self.files = filesArray;
}
- (void)dealloc {
[buildActionMask release], buildActionMask = nil;
[dstPath release], dstPath = nil;
[dstSubfolderSpec release], dstSubfolderSpec = nil;
[files release], files = nil;
[name release], name = nil;
[runOnlyForDeploymentPostprocessing release], runOnlyForDeploymentPostprocessing = nil;
[super dealloc];
}
@end
@implementation XPPBXFileReference
@synthesize explicitFileType;
@synthesize fileEncoding;
@synthesize includeInIndex;
@synthesize indentWidth;
@synthesize languageSpecificationIdentifier;
@synthesize lastKnownFileType;
@synthesize lineEnding;
@synthesize name;
@synthesize path;
@synthesize plistStructureDefinitionIdentifier;
@synthesize refType;
@synthesize sourceTree;
@synthesize tabWidth;
@synthesize usesTabs;
@synthesize wrapsLines;
@synthesize xcLanguageSpecificationIdentifier;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.explicitFileType = [dict objectForKey:@"explicitFileType"];
self.fileEncoding = [dict objectForKey:@"fileEncoding"];
self.includeInIndex = [dict objectForKey:@"includeInIndex"];
self.indentWidth = [dict objectForKey:@"indentWidth"];
self.languageSpecificationIdentifier = [dict objectForKey:@"languageSpecificationIdentifier"];
self.lastKnownFileType = [dict objectForKey:@"lastKnownFileType"];
self.lineEnding = [dict objectForKey:@"lineEnding"];
self.name = [dict objectForKey:@"name"];
self.path = [dict objectForKey:@"path"];
self.plistStructureDefinitionIdentifier = [dict objectForKey:@"plistStructureDefinitionIdentifier"];
self.refType = [dict objectForKey:@"refType"];
self.sourceTree = [dict objectForKey:@"sourceTree"];
self.tabWidth = [dict objectForKey:@"tabWidth"];
self.usesTabs = [dict objectForKey:@"usesTabs"];
self.wrapsLines = [dict objectForKey:@"wrapsLines"];
self.xcLanguageSpecificationIdentifier = [dict objectForKey:@"xcLanguageSpecificationIdentifier"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
}
- (void)dealloc {
[explicitFileType release], explicitFileType = nil;
[fileEncoding release], fileEncoding = nil;
[includeInIndex release], includeInIndex = nil;
[indentWidth release], indentWidth = nil;
[languageSpecificationIdentifier release], languageSpecificationIdentifier = nil;
[lastKnownFileType release], lastKnownFileType = nil;
[lineEnding release], lineEnding = nil;
[name release], name = nil;
[path release], path = nil;
[plistStructureDefinitionIdentifier release], plistStructureDefinitionIdentifier = nil;
[refType release], refType = nil;
[sourceTree release], sourceTree = nil;
[tabWidth release], tabWidth = nil;
[usesTabs release], usesTabs = nil;
[wrapsLines release], wrapsLines = nil;
[xcLanguageSpecificationIdentifier release], xcLanguageSpecificationIdentifier = nil;
[super dealloc];
}
@end
@implementation XPPBXFrameworkReference
@synthesize name;
@synthesize path;
@synthesize refType;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.name = [dict objectForKey:@"name"];
self.path = [dict objectForKey:@"path"];
self.refType = [dict objectForKey:@"refType"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
}
- (void)dealloc {
[name release], name = nil;
[path release], path = nil;
[refType release], refType = nil;
[super dealloc];
}
@end
@implementation XPPBXFrameworksBuildPhase
@synthesize buildActionMask;
@synthesize files;
@synthesize runOnlyForDeploymentPostprocessing;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildActionMask = [dict objectForKey:@"buildActionMask"];
self.runOnlyForDeploymentPostprocessing = [dict objectForKey:@"runOnlyForDeploymentPostprocessing"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* filesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"files"]) {
[filesArray addObject:[store objectForKey:objectName]];
}
self.files = filesArray;
}
- (void)dealloc {
[buildActionMask release], buildActionMask = nil;
[files release], files = nil;
[runOnlyForDeploymentPostprocessing release], runOnlyForDeploymentPostprocessing = nil;
[super dealloc];
}
@end
@implementation XPPBXGroup
@synthesize children;
@synthesize name;
@synthesize path;
@synthesize refType;
@synthesize sourceTree;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.name = [dict objectForKey:@"name"];
self.path = [dict objectForKey:@"path"];
self.refType = [dict objectForKey:@"refType"];
self.sourceTree = [dict objectForKey:@"sourceTree"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* childrenArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"children"]) {
[childrenArray addObject:[store objectForKey:objectName]];
}
self.children = childrenArray;
}
- (void)dealloc {
[children release], children = nil;
[name release], name = nil;
[path release], path = nil;
[refType release], refType = nil;
[sourceTree release], sourceTree = nil;
[super dealloc];
}
@end
@implementation XPPBXHeadersBuildPhase
@synthesize buildActionMask;
@synthesize files;
@synthesize runOnlyForDeploymentPostprocessing;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildActionMask = [dict objectForKey:@"buildActionMask"];
self.runOnlyForDeploymentPostprocessing = [dict objectForKey:@"runOnlyForDeploymentPostprocessing"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* filesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"files"]) {
[filesArray addObject:[store objectForKey:objectName]];
}
self.files = filesArray;
}
- (void)dealloc {
[buildActionMask release], buildActionMask = nil;
[files release], files = nil;
[runOnlyForDeploymentPostprocessing release], runOnlyForDeploymentPostprocessing = nil;
[super dealloc];
}
@end
@implementation XPPBXLegacyTarget
@synthesize buildArgumentsString;
@synthesize buildConfigurationList;
@synthesize buildToolPath;
@synthesize buildWorkingDirectory;
@synthesize name;
@synthesize passBuildSettingsInEnvironment;
@synthesize productName;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildArgumentsString = [dict objectForKey:@"buildArgumentsString"];
self.buildToolPath = [dict objectForKey:@"buildToolPath"];
self.buildWorkingDirectory = [dict objectForKey:@"buildWorkingDirectory"];
self.name = [dict objectForKey:@"name"];
self.passBuildSettingsInEnvironment = [dict objectForKey:@"passBuildSettingsInEnvironment"];
self.productName = [dict objectForKey:@"productName"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
self.buildConfigurationList = [store objectForKey:[dict objectForKey:@"buildConfigurationList"]];
}
- (void)dealloc {
[buildArgumentsString release], buildArgumentsString = nil;
[buildConfigurationList release], buildConfigurationList = nil;
[buildToolPath release], buildToolPath = nil;
[buildWorkingDirectory release], buildWorkingDirectory = nil;
[name release], name = nil;
[passBuildSettingsInEnvironment release], passBuildSettingsInEnvironment = nil;
[productName release], productName = nil;
[super dealloc];
}
@end
@implementation XPPBXNativeTarget
@synthesize buildConfigurationList;
@synthesize buildPhases;
@synthesize buildRules;
@synthesize buildSettings;
@synthesize dependencies;
@synthesize name;
@synthesize productInstallPath;
@synthesize productName;
@synthesize productReference;
@synthesize productType;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildSettings = [dict objectForKey:@"buildSettings"];
self.name = [dict objectForKey:@"name"];
self.productInstallPath = [dict objectForKey:@"productInstallPath"];
self.productName = [dict objectForKey:@"productName"];
self.productType = [dict objectForKey:@"productType"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
self.buildConfigurationList = [store objectForKey:[dict objectForKey:@"buildConfigurationList"]];
NSMutableArray* buildPhasesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"buildPhases"]) {
[buildPhasesArray addObject:[store objectForKey:objectName]];
}
self.buildPhases = buildPhasesArray;
NSMutableArray* buildRulesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"buildRules"]) {
[buildRulesArray addObject:[store objectForKey:objectName]];
}
self.buildRules = buildRulesArray;
NSMutableArray* dependenciesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"dependencies"]) {
[dependenciesArray addObject:[store objectForKey:objectName]];
}
self.dependencies = dependenciesArray;
self.productReference = [store objectForKey:[dict objectForKey:@"productReference"]];
}
- (void)dealloc {
[buildConfigurationList release], buildConfigurationList = nil;
[buildPhases release], buildPhases = nil;
[buildRules release], buildRules = nil;
[buildSettings release], buildSettings = nil;
[dependencies release], dependencies = nil;
[name release], name = nil;
[productInstallPath release], productInstallPath = nil;
[productName release], productName = nil;
[productReference release], productReference = nil;
[productType release], productType = nil;
[super dealloc];
}
@end
@implementation XPPBXProject
@synthesize attributes;
@synthesize buildConfigurationList;
@synthesize buildSettings;
@synthesize buildStyles;
@synthesize compatibilityVersion;
@synthesize developmentRegion;
@synthesize hasScannedForEncodings;
@synthesize knownRegions;
@synthesize mainGroup;
@synthesize productRefGroup;
@synthesize projectDirPath;
@synthesize projectReferences;
@synthesize projectRoot;
@synthesize shouldCheckCompatibility;
@synthesize targets;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.attributes = [dict objectForKey:@"attributes"];
self.buildSettings = [dict objectForKey:@"buildSettings"];
self.compatibilityVersion = [dict objectForKey:@"compatibilityVersion"];
self.developmentRegion = [dict objectForKey:@"developmentRegion"];
self.hasScannedForEncodings = [dict objectForKey:@"hasScannedForEncodings"];
self.projectDirPath = [dict objectForKey:@"projectDirPath"];
self.projectRoot = [dict objectForKey:@"projectRoot"];
self.shouldCheckCompatibility = [dict objectForKey:@"shouldCheckCompatibility"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
self.buildConfigurationList = [store objectForKey:[dict objectForKey:@"buildConfigurationList"]];
NSMutableArray* buildStylesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"buildStyles"]) {
[buildStylesArray addObject:[store objectForKey:objectName]];
}
self.buildStyles = buildStylesArray;
NSMutableArray* knownRegionsArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"knownRegions"]) {
[knownRegionsArray addObject:objectName];
}
self.knownRegions = knownRegionsArray;
self.mainGroup = [store objectForKey:[dict objectForKey:@"mainGroup"]];
self.productRefGroup = [store objectForKey:[dict objectForKey:@"productRefGroup"]];
NSMutableArray* projectReferencesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"projectReferences"]) {
[projectReferencesArray addObject:objectName];
}
self.projectReferences = projectReferencesArray;
NSMutableArray* targetsArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"targets"]) {
[targetsArray addObject:[store objectForKey:objectName]];
}
self.targets = targetsArray;
}
- (void)dealloc {
[attributes release], attributes = nil;
[buildConfigurationList release], buildConfigurationList = nil;
[buildSettings release], buildSettings = nil;
[buildStyles release], buildStyles = nil;
[compatibilityVersion release], compatibilityVersion = nil;
[developmentRegion release], developmentRegion = nil;
[hasScannedForEncodings release], hasScannedForEncodings = nil;
[knownRegions release], knownRegions = nil;
[mainGroup release], mainGroup = nil;
[productRefGroup release], productRefGroup = nil;
[projectDirPath release], projectDirPath = nil;
[projectReferences release], projectReferences = nil;
[projectRoot release], projectRoot = nil;
[shouldCheckCompatibility release], shouldCheckCompatibility = nil;
[targets release], targets = nil;
[super dealloc];
}
@end
@implementation XPPBXReferenceProxy
@synthesize fileType;
@synthesize name;
@synthesize path;
@synthesize remoteRef;
@synthesize sourceTree;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.fileType = [dict objectForKey:@"fileType"];
self.name = [dict objectForKey:@"name"];
self.path = [dict objectForKey:@"path"];
self.sourceTree = [dict objectForKey:@"sourceTree"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
self.remoteRef = [store objectForKey:[dict objectForKey:@"remoteRef"]];
}
- (void)dealloc {
[fileType release], fileType = nil;
[name release], name = nil;
[path release], path = nil;
[remoteRef release], remoteRef = nil;
[sourceTree release], sourceTree = nil;
[super dealloc];
}
@end
@implementation XPPBXResourcesBuildPhase
@synthesize buildActionMask;
@synthesize files;
@synthesize runOnlyForDeploymentPostprocessing;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildActionMask = [dict objectForKey:@"buildActionMask"];
self.runOnlyForDeploymentPostprocessing = [dict objectForKey:@"runOnlyForDeploymentPostprocessing"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* filesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"files"]) {
[filesArray addObject:[store objectForKey:objectName]];
}
self.files = filesArray;
}
- (void)dealloc {
[buildActionMask release], buildActionMask = nil;
[files release], files = nil;
[runOnlyForDeploymentPostprocessing release], runOnlyForDeploymentPostprocessing = nil;
[super dealloc];
}
@end
@implementation XPPBXRezBuildPhase
@synthesize buildActionMask;
@synthesize files;
@synthesize runOnlyForDeploymentPostprocessing;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildActionMask = [dict objectForKey:@"buildActionMask"];
self.runOnlyForDeploymentPostprocessing = [dict objectForKey:@"runOnlyForDeploymentPostprocessing"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* filesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"files"]) {
[filesArray addObject:[store objectForKey:objectName]];
}
self.files = filesArray;
}
- (void)dealloc {
[buildActionMask release], buildActionMask = nil;
[files release], files = nil;
[runOnlyForDeploymentPostprocessing release], runOnlyForDeploymentPostprocessing = nil;
[super dealloc];
}
@end
@implementation XPPBXShellScriptBuildPhase
@synthesize buildActionMask;
@synthesize inputPaths;
@synthesize name;
@synthesize outputPaths;
@synthesize runOnlyForDeploymentPostprocessing;
@synthesize shellPath;
@synthesize shellScript;
@synthesize showEnvVarsInLog;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildActionMask = [dict objectForKey:@"buildActionMask"];
self.name = [dict objectForKey:@"name"];
self.runOnlyForDeploymentPostprocessing = [dict objectForKey:@"runOnlyForDeploymentPostprocessing"];
self.shellPath = [dict objectForKey:@"shellPath"];
self.shellScript = [dict objectForKey:@"shellScript"];
self.showEnvVarsInLog = [dict objectForKey:@"showEnvVarsInLog"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* inputPathsArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"inputPaths"]) {
[inputPathsArray addObject:objectName];
}
self.inputPaths = inputPathsArray;
NSMutableArray* outputPathsArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"outputPaths"]) {
[outputPathsArray addObject:objectName];
}
self.outputPaths = outputPathsArray;
}
- (void)dealloc {
[buildActionMask release], buildActionMask = nil;
[inputPaths release], inputPaths = nil;
[name release], name = nil;
[outputPaths release], outputPaths = nil;
[runOnlyForDeploymentPostprocessing release], runOnlyForDeploymentPostprocessing = nil;
[shellPath release], shellPath = nil;
[shellScript release], shellScript = nil;
[showEnvVarsInLog release], showEnvVarsInLog = nil;
[super dealloc];
}
@end
@implementation XPPBXSourcesBuildPhase
@synthesize buildActionMask;
@synthesize files;
@synthesize runOnlyForDeploymentPostprocessing;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildActionMask = [dict objectForKey:@"buildActionMask"];
self.runOnlyForDeploymentPostprocessing = [dict objectForKey:@"runOnlyForDeploymentPostprocessing"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* filesArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"files"]) {
[filesArray addObject:[store objectForKey:objectName]];
}
self.files = filesArray;
}
- (void)dealloc {
[buildActionMask release], buildActionMask = nil;
[files release], files = nil;
[runOnlyForDeploymentPostprocessing release], runOnlyForDeploymentPostprocessing = nil;
[super dealloc];
}
@end
@implementation XPPBXTargetDependency
@synthesize name;
@synthesize target;
@synthesize targetProxy;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.name = [dict objectForKey:@"name"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
self.target = [store objectForKey:[dict objectForKey:@"target"]];
self.targetProxy = [store objectForKey:[dict objectForKey:@"targetProxy"]];
}
- (void)dealloc {
[name release], name = nil;
[target release], target = nil;
[targetProxy release], targetProxy = nil;
[super dealloc];
}
@end
@implementation XPPBXVariantGroup
@synthesize children;
@synthesize name;
@synthesize path;
@synthesize refType;
@synthesize sourceTree;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.name = [dict objectForKey:@"name"];
self.path = [dict objectForKey:@"path"];
self.refType = [dict objectForKey:@"refType"];
self.sourceTree = [dict objectForKey:@"sourceTree"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* childrenArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"children"]) {
[childrenArray addObject:[store objectForKey:objectName]];
}
self.children = childrenArray;
}
- (void)dealloc {
[children release], children = nil;
[name release], name = nil;
[path release], path = nil;
[refType release], refType = nil;
[sourceTree release], sourceTree = nil;
[super dealloc];
}
@end
@implementation XPXCBuildConfiguration
@synthesize baseConfigurationReference;
@synthesize buildSettings;
@synthesize name;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.buildSettings = [dict objectForKey:@"buildSettings"];
self.name = [dict objectForKey:@"name"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
self.baseConfigurationReference = [store objectForKey:[dict objectForKey:@"baseConfigurationReference"]];
}
- (void)dealloc {
[baseConfigurationReference release], baseConfigurationReference = nil;
[buildSettings release], buildSettings = nil;
[name release], name = nil;
[super dealloc];
}
@end
@implementation XPXCConfigurationList
@synthesize buildConfigurations;
@synthesize defaultConfigurationIsVisible;
@synthesize defaultConfigurationName;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.defaultConfigurationIsVisible = [dict objectForKey:@"defaultConfigurationIsVisible"];
self.defaultConfigurationName = [dict objectForKey:@"defaultConfigurationName"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* buildConfigurationsArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"buildConfigurations"]) {
[buildConfigurationsArray addObject:[store objectForKey:objectName]];
}
self.buildConfigurations = buildConfigurationsArray;
}
- (void)dealloc {
[buildConfigurations release], buildConfigurations = nil;
[defaultConfigurationIsVisible release], defaultConfigurationIsVisible = nil;
[defaultConfigurationName release], defaultConfigurationName = nil;
[super dealloc];
}
@end
@implementation XPXCVersionGroup
@synthesize children;
@synthesize currentVersion;
@synthesize path;
@synthesize sourceTree;
@synthesize versionGroupType;
- (void)inflateFromDictionary:(NSDictionary*)dict {
self.path = [dict objectForKey:@"path"];
self.sourceTree = [dict objectForKey:@"sourceTree"];
self.versionGroupType = [dict objectForKey:@"versionGroupType"];
}
- (void)connectFromDictionary:(NSDictionary*)dict usingObjectStore:(NSDictionary*)store {
NSMutableArray* childrenArray = [NSMutableArray array];
for (id objectName in [dict objectForKey:@"children"]) {
[childrenArray addObject:[store objectForKey:objectName]];
}
self.children = childrenArray;
self.currentVersion = [store objectForKey:[dict objectForKey:@"currentVersion"]];
}
- (void)dealloc {
[children release], children = nil;
[currentVersion release], currentVersion = nil;
[path release], path = nil;
[sourceTree release], sourceTree = nil;
[versionGroupType release], versionGroupType = nil;
[super dealloc];
}
@end
//
// XcodeProject.h
// XcodeProj
//
// Created by David Brown on 2/12/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "XCObject.h"
@interface XcodeProject : NSObject {}
@property (retain) NSDictionary* objects;
@property (retain) XPPBXProject* rootObject;
- (id)initFromURL:(NSURL*)projectURL;
@end
//
// XcodeProject.m
// XcodeProj
//
// Created by David Brown on 2/12/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "XcodeProject.h"
#import <objc/runtime.h>
@implementation XcodeProject
@synthesize objects;
@synthesize rootObject;
- (void)loadProjectWithRootName:(NSString*)rootName {
NSMutableDictionary* store = [NSMutableDictionary dictionary];
for (NSString* objectName in [self.objects allKeys]) {
[store setObject:[XCObject XCObjectFromDictionary:[self.objects objectForKey:objectName]]
forKey:objectName];
}
for (NSString* objectName in [self.objects allKeys]) {
[[store objectForKey:objectName] connectFromDictionary:[self.objects objectForKey:objectName]
usingObjectStore:store];
}
self.rootObject = [store objectForKey:rootName];
}
- (id)initWithProject:(NSDictionary*)project {
self = [super init];
if (self) {
// Initialization code here.
self.objects = [project objectForKey:@"objects"];
[self loadProjectWithRootName:[project objectForKey:@"rootObject"]];
}
return self;
}
- (id)initFromURL:(NSURL*)projectURL {
NSError* err;
NSFileWrapper* project = [[[NSFileWrapper alloc] initWithURL:projectURL options:0 error:&err] autorelease];
NSDictionary* files = [project fileWrappers];
NSData* projFile = [[files objectForKey:@"project.pbxproj"] regularFileContents];
NSPropertyListFormat theFormat = NSPropertyListOpenStepFormat;
id contents = [NSPropertyListSerialization propertyListFromData:projFile
mutabilityOption:NSPropertyListImmutable
format:&theFormat
errorDescription:nil];
return [self initWithProject:contents];
}
- (void)dealloc
{
[super dealloc];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment