def add_flags(self, flag_name, flags):
        if u'buildSettings' not in self:
            self[u'buildSettings'] = PBXGenericObject()

        current_flags = self.buildSettings[flag_name]
        if current_flags is None:
            self.set_flags(flag_name, flags)
            return

        if not isinstance(current_flags, list):
            current_flags = [current_flags]

        if not isinstance(flags, list):
            flags = [flags]

        self.set_flags(flag_name, current_flags + flags)
예제 #2
0
    def testResolveComment(self):
        obj = {
            "a": {
                "name": "A"
            },
            "b": {
                "path": "B"
            },
            "c": {
                "c1": "FDDF6A571C68E5B100D7A645"
            }
        }
        dobj = PBXGenericObject().parse(obj)

        self.assertEqual(dobj._resolve_comment('a'), 'A')
        self.assertEqual(dobj._resolve_comment('b'), 'B')
        self.assertEqual(dobj._resolve_comment('c'), None)
예제 #3
0
    def add_flags(self, flag_name, flags):
        if u'buildSettings' not in self:
            self[u'buildSettings'] = PBXGenericObject()

        current_flags = self.buildSettings[flag_name]
        if current_flags is None:
            self.set_flags(flag_name, flags)
            return

        if not isinstance(current_flags, list):
            current_flags = [current_flags]

        if not isinstance(flags, list):
            flags = [flags]

        used = set()
        uniq_flags = [
            x for x in current_flags + flags
            if x not in used and (used.add(x) or True)
        ]
        self.set_flags(flag_name, uniq_flags)
예제 #4
0
    def testAddFolderSuccessWithPublicHeaders(self):
        args = {
            '<project>': 'samplescli/test.pbxproj',
            '<path>': 'samples',
            '--target': None,
            '--tree': 'SOURCE_ROOT',
            '--delete': False,
            '--recursive': True,
            '--exclude': None,
            '--no-create-groups': False,
            '--weak': False,
            '--no-embed': False,
            '--sign-on-copy': False,
            '--ignore-unknown-types': False,
            '--no-create-build-files': False,
            '--header-scope': 'public'
        }
        project = open_project(args)

        self.assertListEqual(
            project.get_files_by_path(args['<path>'] +
                                      '/path with spaces/testLibrary.a',
                                      tree=TreeType.GROUP), [])
        result = pbxproj_folder.execute(project, args)

        self.assertGreater(
            project.get_files_by_path(args['<path>'] +
                                      '/path with spaces/testLibrary.a',
                                      tree=TreeType.GROUP).__len__(), 0)
        self.assertEqual(
            result,
            'Folder added to the project.\n18 PBXBuildFile sections created.')
        file = project.get_files_by_name('fileB.h')
        build_file = project.get_build_files_for_file(file[0].get_id())
        self.assertEqual(
            build_file[0].settings.__repr__(),
            PBXGenericObject().parse({
                "ATTRIBUTES": ['Public']
            }).__repr__())
예제 #5
0
                             tree='<absolute>', file_options=file_options)
        else:
            new_parent = project.add_group(child, child, parent)
            my_add_folder(full_path, new_parent, excludes)

modules_group = project.add_group("modules")
for module in config_data["modules"]:
    moduleName = "global"
    if "name" in module:
        moduleName = module["name"]
    group = project.add_group(moduleName, parent=modules_group)
    apply_module_settings(module, group)

project.add_header_search_paths(header_search_paths)

if caps:
    sys_caps = PBXGenericObject()
    for cap in caps:
        sys_caps[cap] = PBXGenericObject()
        sys_caps[cap]["enabled"] = 1

    project.objects[project.rootObject].attributes.TargetAttributes[project_target.get_id()][
        'SystemCapabilities'] = sys_caps

#project.add_other_ldflags("$(inherited)")
#project.add_library_search_paths("$(inherited)")

project.add_other_cflags(compileDefines)

project.save()
예제 #6
0
    def set_flags(self, flag_name, flags):
        if u'buildSettings' not in self:
            self[u'buildSettings'] = PBXGenericObject()

        self.buildSettings[flag_name] = flags
예제 #7
0
 def testParseCreateAttributes(self):
     obj = {"a": "varA", "b": [1, 2, 3], "c": {"c1": "varC1"}}
     dobj = PBXGenericObject().parse(obj)
     self.assertEqual(dobj.a, "varA")
     self.assertEqual(dobj.b, [1, 2, 3])
     self.assertIsNotNone(dobj.c)
예제 #8
0
    def testParseKey(self):
        obj = "FDDF6A571C68E5B100D7A645"
        dobj = PBXGenericObject().parse(obj)

        self.assertIsInstance(dobj, PBXKey)
예제 #9
0
    def testParseCreateObjectOfRightTypes(self):
        obj = {"objects": {"id": {"isa": "type"}}}
        dobj = PBXGenericObject().parse(obj)

        self.assertIsInstance(dobj.objects, objects)
예제 #10
0
    def testGetItem(self):
        obj = {"a": "varA", "b": [1, 2, 3], "c": {"c1": "FDDF6A571C68E5B100D7A645"}}
        dobj = PBXGenericObject().parse(obj)

        self.assertIsInstance(dobj["c"]["c1"], PBXKey)
        self.assertIsNone(dobj['X'])