def testAddFolderWithExclusions(self): project = XcodeProject(self.obj) project.add_folder('samples', excludes=['file.\\.m', 'test.*']) # should add test.framework and testLibrary.a and 2 groups, samples, dirA samples = project.get_groups_by_name('samples') dirA = project.get_groups_by_name('dirA') dirB = project.get_groups_by_name('dirB') self.assertNotEqual(samples, []) self.assertNotEqual(dirA, []) self.assertNotEqual(dirB, []) self.assertEqual(samples[0].children.__len__(), 1) # dirA, -test.framework, -testLibrary.a self.assertEqual(dirA[0].children.__len__(), 1) # dirB, -fileA.m self.assertEqual(dirB[0].children.__len__(), 0) # -fileB.m
def testAddFolderAsReference(self): project = XcodeProject(self.obj,path="tests/project.pbxproj") build_file = project.add_folder('samples', create_groups=False) self.assertListEqual(project.get_groups_by_name('samples'), []) self.assertEqual(project.objects.get_objects_in_section(u'PBXResourcesBuildPhase').__len__(), 2) self.assertEqual(build_file.__len__(), 2)
def testAddFolderRecursive(self): project = XcodeProject(self.obj) project.add_folder('samples') # should add test with spaces.framework and testLibrary.a and 2 groups, samples, dirA samples = project.get_groups_by_name('samples') dirA = project.get_groups_by_name('dirA') dirB = project.get_groups_by_name('dirB') self.assertNotEqual(samples, []) self.assertNotEqual(dirA, []) self.assertNotEqual(dirB, []) self.assertEqual(samples[0].children.__len__(), 3) # dirA, test with spaces.framework, testLibrary.a self.assertEqual(dirA[0].children.__len__(), 2) # dirB, fileA.m self.assertEqual(dirB[0].children.__len__(), 2) # fileB.m, fileB.h
def testAddFolderWithPathSameAsName(self): project = XcodeProject(self.obj, path="tests/project.pbxproj") parent_group = project.get_or_create_group('parent_group') # Copy the samples folder into a folder to be added to the project. shutil.copytree('samples', 'parent_group/samples') target_path = 'parent_group/samples' project.add_folder(parent=parent_group, path=target_path, file_options=FileOptions(add_groups_relative=False)) self.assertEqual( project.get_or_create_group('samples').path, os.path.abspath(target_path)) shutil.rmtree('parent_group')
def testAddFolderRecursive(self): project = XcodeProject(self.obj) result = project.add_folder('samples') # should add test.framework and testLibrary.a and 2 groups, samples, dirA samples = project.get_groups_by_name('samples') dirA = project.get_groups_by_name('dirA') dirB = project.get_groups_by_name('dirB') self.assertNotEqual(samples, []) self.assertNotEqual(dirA, []) self.assertNotEqual(dirB, []) self.assertEqual(samples[0].children.__len__(), 3) # dirA, test.framework, testLibrary.a self.assertEqual(dirA[0].children.__len__(), 2) # dirB, fileA.m self.assertEqual(dirB[0].children.__len__(), 1) # fileB.m
def testAddFolderNotAFolder(self): project = XcodeProject(self.obj) result = project.add_folder('samples/testLibrary.a') self.assertIsNone(result)
# adding preprocessor macros for murka project.add_flags('GCC_PREPROCESSOR_DEFINITIONS', 'MURKA_OF') project.add_flags('GCC_PREPROCESSOR_DEFINITIONS', 'MURKA_OFFSCREEN') # removing extra files project.remove_files_by_path("src/ofApp.cpp") project.remove_files_by_path("src/ofApp.h") project.remove_files_by_path("src/main.cpp") # adding files group = project.get_or_create_group('hotjuice_source') project.add_folder(hotjuice_path + "/src", parent=group) # add additional sources for filePath in include_files: project.add_file(filePath) # setting bundle id project.set_flags('PRODUCT_BUNDLE_IDENTIFIER', bundle_id) project.save() appsupport_path = "~/Library/Application\ Support/" + company_name + "/" + bundle_id print(appsupport_path) # creating symlink to final build folder
def testAddFolderNonRecursive(self): project = XcodeProject(self.obj) project.add_folder('samples/', recursive=False) # should add test.framework and testLibrary.a and 2 groups, samples, dirA samples = project.get_groups_by_name('samples') dirA = project.get_groups_by_name('dirA') dirB = project.get_groups_by_name('dirB') self.assertNotEqual(samples, []) self.assertNotEqual(dirA, []) self.assertEqual(dirB, []) self.assertEqual(samples[0].children.__len__(), 3) # dirA, test.framework, testLibrary.a self.assertEqual(dirA[0].children.__len__(), 0)