def open_project(args): if os.path.isdir(args['<project>']): args['<project>'] += '/project.pbxproj' if not os.path.isfile(args['<project>']): raise Exception('Project file not found') return XcodeProject.load(args['<project>'])
def open_project(args): if os.path.isdir(args[u'<project>']): args[u'<project>'] += "/project.pbxproj" if not os.path.isfile(args[u'<project>']): raise Exception("Project file not found") return XcodeProject.load(args[u'<project>'])
def open_project(args): if os.path.isdir(args[u'<project>']): args[u'<project>'] += u"/project.pbxproj" if not os.path.isfile(args[u'<project>']): raise Exception(u'Project file not found') return XcodeProject.load(args[u'<project>'])
def buildWithDebug(self, isSimulator): if not self.backupFile(): return xcodeProj = XcodeProject(self.m_projectPath, self.m_projectName) xcodeProj.parse() pbxProject = xcodeProj.getPBXProject() buildSettings = pbxProject.getBuildSettings(self.m_target, "Release") isSuccess = buildSettings.replaceGCC_PREPROCESSOR_DEFINITIONS("NDEBUG", "COCOS2D_DEBUG=1") if not isSuccess: defaultBuildSettings = xcodeProj.getDefaultBuildSettings("Release") isSuccess = defaultBuildSettings.replaceGCC_PREPROCESSOR_DEFINITIONS("NDEBUG", "COCOS2D_DEBUG=1") if not isSuccess: print "Can not find GCC_PREPROCESSOR_DEFINITIONS NDEBUG" xcodeProj.writeToFile(self.fullProjectPath(""), "") oldFullPath = self.fullProjectPath("") newFullPath = self.fullProjectPath("Debug") os.rename(oldFullPath, newFullPath) if isSimulator: command = "xcodebuild -sdk iphonesimulator -project " + newFullPath + " -target " + self.targetFilter() + " -configuration Release " else: command = "xcodebuild -project " + newFullPath + " -target " + self.targetFilter() + " -configuration Release" Process.execute(command) os.rename(newFullPath, oldFullPath) self.resumeFile()
def testGetCommentForNonExistentRef(self): obj = { 'objects': { 'FDDF6A571C68E5B100D7A645': {'isa': 'PBXBuildFile'}, 'X': {'isa': 'phase', 'name': 'X', 'files': ['FDDF6A571C68E5B100D7A645']} } } dobj = XcodeProject().parse(obj) self.assertEqual(dobj.objects['FDDF6A571C68E5B100D7A645']._get_comment(), '(null) in X')
def testGetComment(self): obj = { 'objects': { '1': {'isa': 'PBXBuildFile', 'name': 'something', 'fileRef': 'FDDF6A571C68E5B100D7A645'}, 'FDDF6A571C68E5B100D7A645': {'isa': 'PBXFileReference', 'name': 'real name'}, 'X': {'isa': 'phase', 'name': 'X', 'files': ['1']} } } dobj = XcodeProject().parse(obj) self.assertEqual(dobj.objects['1']._get_comment(), 'real name in X')
def initForFramework(self, frameworkPath): self.m_frameworkPath = frameworkPath self.m_model = XCodeProjectBatchModifier.FrameworkModel for projectName, target in XCodeProjectBatchModifier.FrameworkProject.items(): fullPath = self.m_frameworkPath + "/" + projectName xcodeProject = XcodeProject("", "") xcodeProject.initWithFullPath(fullPath) xcodeProject.setTarget(target) if not xcodeProject.parse(): print "Parse " + fullPath + " failure" self.m_frameworkXcodeProj.append(xcodeProject)