当前位置: 首页>>代码示例>>Python>>正文


Python XcodeProject.add_file方法代码示例

本文整理汇总了Python中pbxproj.XcodeProject.add_file方法的典型用法代码示例。如果您正苦于以下问题:Python XcodeProject.add_file方法的具体用法?Python XcodeProject.add_file怎么用?Python XcodeProject.add_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pbxproj.XcodeProject的用法示例。


在下文中一共展示了XcodeProject.add_file方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testEmbedFrameworkInRightCopySection

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testEmbedFrameworkInRightCopySection(self):
        project = XcodeProject(self.obj)
        self.assertEqual(project.objects.get_objects_in_section(u'PBXCopyFilesBuildPhase').__len__(), 1)

        project.add_file('X.framework', file_options=FileOptions(embed_framework=True))

        self.assertEqual(project.objects.get_objects_in_section(u'PBXCopyFilesBuildPhase').__len__(), 3)
开发者ID:kronenthaler,项目名称:mod-pbxproj,代码行数:9,代码来源:TestProjectFiles.py

示例2: testAddFileLibraryWithAbsolutePath

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testAddFileLibraryWithAbsolutePath(self):
        project = XcodeProject(self.obj)
        project.add_file(os.path.abspath("samples/testLibrary.a"))

        expected_flags = "$(SRCROOT)/tests/samples"
        self.assertEqual(project.objects['5'].buildSettings.LIBRARY_SEARCH_PATHS, expected_flags)
        self.assertEqual(project.objects['6'].buildSettings.LIBRARY_SEARCH_PATHS, expected_flags)
        self.assertEqual(project.objects['7'].buildSettings.LIBRARY_SEARCH_PATHS, expected_flags)
        self.assertEqual(project.objects['8'].buildSettings.LIBRARY_SEARCH_PATHS, expected_flags)
开发者ID:kronenthaler,项目名称:mod-pbxproj,代码行数:11,代码来源:TestProjectFiles.py

示例3: testAddFileFrameworkWithAbsolutePath

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testAddFileFrameworkWithAbsolutePath(self):
        project = XcodeProject(self.obj)
        project.add_file(os.path.abspath("samples/test.framework"))

        expected_flags = ["$(SRCROOT)/tests/samples", "$(inherited)"]
        self.assertListEqual(project.objects['5'].buildSettings.FRAMEWORK_SEARCH_PATHS, expected_flags)
        self.assertListEqual(project.objects['6'].buildSettings.FRAMEWORK_SEARCH_PATHS, expected_flags)
        self.assertListEqual(project.objects['7'].buildSettings.FRAMEWORK_SEARCH_PATHS, expected_flags)
        self.assertListEqual(project.objects['8'].buildSettings.FRAMEWORK_SEARCH_PATHS, expected_flags)
开发者ID:kronenthaler,项目名称:mod-pbxproj,代码行数:11,代码来源:TestProjectFiles.py

示例4: testRemoveFilesByPath

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testRemoveFilesByPath(self):
        project = XcodeProject(self.obj)
        original = project.__str__()
        project.add_file("file.m")

        result = project.remove_files_by_path('file.m')

        self.assertTrue(result)
        self.assertEqual(project.__str__(), original)
开发者ID:kronenthaler,项目名称:mod-pbxproj,代码行数:11,代码来源:TestProjectFiles.py

示例5: testRemoveFileById

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testRemoveFileById(self):
        project = XcodeProject(self.obj)
        original = project.__str__()
        project.add_file("file.m")

        file = project.get_files_by_name('file.m')[0]
        result = project.remove_file_by_id(file.get_id())

        self.assertTrue(result)
        self.assertEqual(project.__str__(), original)
开发者ID:kronenthaler,项目名称:mod-pbxproj,代码行数:12,代码来源:TestProjectFiles.py

示例6: testAddFileIfExists

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testAddFileIfExists(self):
        project = XcodeProject(self.obj)
        build_file = project.add_file("file.m", force=False)

        # 2 source files are created 1 x target
        self.assertEqual(project.objects.get_objects_in_section(u'PBXSourcesBuildPhase').__len__(), 2)
        self.assertEqual(build_file.__len__(), 2)

        build_file = project.add_file("file.m", force=False)
        self.assertEqual(build_file, [])
开发者ID:,项目名称:,代码行数:12,代码来源:

示例7: testRemoveFileByIdFromTarget

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testRemoveFileByIdFromTarget(self):
        project = XcodeProject(self.obj)
        project.add_file("file.m")

        file_ref = project.get_files_by_name('file.m')[0]
        result = project.remove_file_by_id(file_ref.get_id(), target_name='report')

        self.assertTrue(result)
        self.assertIsNotNone(project.objects[file_ref.get_id()])
        self.assertEqual(project.objects.get_objects_in_section('PBXBuildFile').__len__(), 3)
        self.assertEqual(project.objects.get_objects_in_section('PBXSourcesBuildPhase').__len__(), 1)
开发者ID:kronenthaler,项目名称:mod-pbxproj,代码行数:13,代码来源:TestProjectFiles.py

示例8: testRemoveFileByIdKeepShellScriptBuildPhases

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testRemoveFileByIdKeepShellScriptBuildPhases(self):
        project = XcodeProject(self.obj)
        project.add_run_script('ls -la')

        original = project.__str__()
        project.add_file("file.m")

        file = project.get_files_by_name('file.m')[0]
        result = project.remove_file_by_id(file.get_id())

        self.assertTrue(result)
        self.assertEqual(project.__str__(), original)
开发者ID:kronenthaler,项目名称:mod-pbxproj,代码行数:14,代码来源:TestProjectFiles.py

示例9: testAddFileUnknownAllowed

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testAddFileUnknownAllowed(self):
        project = XcodeProject(self.obj)
        build_file = project.add_file("file.unknowntype", file_options=FileOptions(ignore_unknown_type=True))

        # unknown files are added as resources
        self.assertEqual(project.objects.get_objects_in_section(u'PBXResourcesBuildPhase').__len__(), 2)
        self.assertEqual(build_file.__len__(), 2)
开发者ID:,项目名称:,代码行数:9,代码来源:

示例10: testAddFileWithAbsolutePathOnUnknownTree

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testAddFileWithAbsolutePathOnUnknownTree(self):
        project = XcodeProject(self.obj)
        build_file = project.add_file(os.path.abspath("samples/test.framework"), tree='DEVELOPER_DIR')

        self.assertEqual(project.objects[build_file[0].fileRef].sourceTree, '<absolute>')
        self.assertEqual(project.objects[build_file[1].fileRef].sourceTree, '<absolute>')
        self.assertEqual(project.objects[build_file[2].fileRef].sourceTree, '<absolute>')
        self.assertEqual(project.objects[build_file[3].fileRef].sourceTree, '<absolute>')
开发者ID:,项目名称:,代码行数:10,代码来源:

示例11: testAddFileNoCreateBuildFiles

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testAddFileNoCreateBuildFiles(self):
        project = XcodeProject(self.obj)
        items = project.objects.__len__()
        build_file = project.add_file(".", file_options=FileOptions(create_build_files=False))

        # no create build file flag
        self.assertEqual(project.objects.__len__(), items)
        self.assertEqual(build_file, [])
开发者ID:,项目名称:,代码行数:10,代码来源:

示例12: testAddFileOfAllTypes

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testAddFileOfAllTypes(self):
        for ext in ProjectFiles._FILE_TYPES:
            project = XcodeProject(self.obj)
            options = FileOptions(embed_framework=False)
            build_file = project.add_file("file{0}".format(ext), file_options=options)

            _, phase = ProjectFiles._FILE_TYPES[ext]
            amount = 0
            if phase is not None:
                amount = 2

            self.assertEqual(project.objects.get_objects_in_section(phase).__len__(), amount)
            self.assertEqual(build_file.__len__(), amount)
开发者ID:kronenthaler,项目名称:mod-pbxproj,代码行数:15,代码来源:TestProjectFiles.py

示例13: testAddFileFrameworkEmbedded

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testAddFileFrameworkEmbedded(self):
        project = XcodeProject(self.obj)
        options = FileOptions(create_build_files=True, weak=True, embed_framework=True, code_sign_on_copy=True)
        build_file = project.add_file("file.framework", file_options=options)

        # 2 source files are created 1 x target
        self.assertEqual(project.objects.get_objects_in_section(u'PBXFrameworksBuildPhase').__len__(), 2)
        self.assertEqual(project.objects.get_objects_in_section(u'PBXCopyFilesBuildPhase').__len__(), 2)
        self.assertEqual(build_file.__len__(), 4)
        self.assertListEqual(build_file[0].settings.ATTRIBUTES, [u'Weak', u'CodeSignOnCopy', u'RemoveHeadersOnCopy'])
        self.assertListEqual(build_file[1].settings.ATTRIBUTES, [u'Weak', u'CodeSignOnCopy', u'RemoveHeadersOnCopy'])
        self.assertListEqual(build_file[2].settings.ATTRIBUTES, [u'Weak', u'CodeSignOnCopy', u'RemoveHeadersOnCopy'])
        self.assertListEqual(build_file[3].settings.ATTRIBUTES, [u'Weak', u'CodeSignOnCopy', u'RemoveHeadersOnCopy'])
开发者ID:,项目名称:,代码行数:15,代码来源:

示例14: testAddFileFrameworkFromSDKRootIgnoresEmbedAndCodeSign

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testAddFileFrameworkFromSDKRootIgnoresEmbedAndCodeSign(self):
        project = XcodeProject(self.obj)
        options = FileOptions(create_build_files=True, weak=True, embed_framework=True, code_sign_on_copy=True)
        build_file = project.add_file("file.framework", tree=TreeType.SDKROOT, file_options=options)

        # 2 source files are created 1 x target
        self.assertEqual(project.objects.get_objects_in_section(u'PBXFrameworksBuildPhase').__len__(), 2)
        self.assertEqual(project.objects.get_objects_in_section(u'PBXCopyFilesBuildPhase').__len__(), 3)
        self.assertEqual(build_file.__len__(), 4)
        self.assertListEqual(build_file[0].settings.ATTRIBUTES, [u'Weak'])
        self.assertIsNone(build_file[1]['settings'])
        self.assertListEqual(build_file[2].settings.ATTRIBUTES, [u'Weak'])
        self.assertIsNone(build_file[3]['settings'])
开发者ID:kronenthaler,项目名称:mod-pbxproj,代码行数:15,代码来源:TestProjectFiles.py

示例15: testAddHeaderFileProjectScope

# 需要导入模块: from pbxproj import XcodeProject [as 别名]
# 或者: from pbxproj.XcodeProject import add_file [as 别名]
    def testAddHeaderFileProjectScope(self):
        project = XcodeProject({
            'objects': {
                '2': {'isa': 'PBXAggregateTarget', 'name': 'report', 'buildConfigurationList': '4',
                      'buildPhases': []},
                '4': {'isa': 'XCConfigurationList', 'buildConfigurations': ['7', '8']},
                '7': {'isa': 'XCBuildConfiguration', 'name': 'Release', 'id': '7'},
                '8': {'isa': 'XCBuildConfiguration', 'name': 'Debug', 'id': '8'},
                'project': {'isa': 'PBXProject'}
            }
        })

        self.assertEqual(project.get_build_phases_by_name(u'PBXHeadersBuildPhase').__len__(), 0)

        references = project.add_file("header.h", file_options=FileOptions())

        self.assertGreater(project.get_build_phases_by_name(u'PBXHeadersBuildPhase').__len__(), 0)
        self.assertIsNone(references[0]['settings'], None)
开发者ID:kronenthaler,项目名称:mod-pbxproj,代码行数:20,代码来源:TestProjectFiles.py


注:本文中的pbxproj.XcodeProject.add_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。