Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testSaveOnDefaultPath(self):
XcodeProject({}, "results/default").save()
self.assertTrue(os.path.exists("results/default"))
def testSaveOnGivenPath(self):
XcodeProject().save("results/sample")
self.assertTrue(os.path.exists("results/sample"))
def testGetIds(self):
project = XcodeProject({'objects':{'1':{'isa':'a'}, '2':{'isa':'a'}}})
self.assertListEqual(project.get_ids(), ['1', '2'])
def testGetTargetByNameExisting(self):
project = XcodeProject(self.obj)
target = project.get_target_by_name('app')
self.assertEqual(target, project.objects['1'])
def testGetTargetByNameNonExisting(self):
project = XcodeProject(self.obj)
target = project.get_target_by_name('non-existing')
self.assertIsNone(target)
def testGetBuildPhasesByName(self):
project = XcodeProject(self.obj)
build_phases = project.get_build_phases_by_name('PBXGenericBuildPhase')
self.assertEqual(build_phases.__len__(), 2)
def testGetBuildFilesForFile(self):
project = XcodeProject(self.obj)
build_files = project.get_build_files_for_file('file1')
self.assertListEqual(build_files, [project.objects['build_file1']])
def testBackup(self):
project = XcodeProject({}, 'results/default')
project.save('results/default')
backup_name = project.backup()
self.assertRegexpMatches(backup_name, '_[0-9]{6}-[0-9]{6}\\.backup')
pbx_frameworks = list(set(pbx_frameworks))
pbx_libraries = list(set(pbx_libraries))
libraries = list(set(libraries))
logger.info("-" * 70)
logger.info("The project need to have:")
logger.info("iOS Frameworks: {}".format(pbx_frameworks))
logger.info("iOS Libraries: {}".format(pbx_libraries))
logger.info("iOS local Frameworks: {}".format(frameworks))
logger.info("Libraries: {}".format(libraries))
logger.info("Sources to link: {}".format(sources))
logger.info("-" * 70)
logger.info("Analysis of {}".format(filename))
project = XcodeProject.load(filename)
sysroot = sh.xcrun("--sdk", "iphonesimulator", "--show-sdk-path").strip()
group = project.get_or_create_group("Frameworks")
g_classes = project.get_or_create_group("Classes")
file_options = FileOptions(embed_framework=False, code_sign_on_copy=True)
for framework in pbx_frameworks:
framework_name = "{}.framework".format(framework)
if framework_name in frameworks:
logger.info("Ensure {} is in the project (pbx_frameworks, local)".format(framework))
f_path = join(ctx.dist_dir, "frameworks", framework_name)
else:
logger.info("Ensure {} is in the project (pbx_frameworks, system)".format(framework))
f_path = join(sysroot, "System", "Library", "Frameworks",
"{}.framework".format(framework))
project.add_file(f_path, parent=group, tree="DEVELOPER_DIR",
force=False, file_options=file_options)