Exemplo n.º 1
0
def runSpecial(sdk, srcDir, destDir, sdkConfigFile, XcodeProject):
    print "[runSpecial] sdk is [%s]" % sdk
    print "[srcDir] is = ", srcDir
    print "[destDir] is = ", destDir
    print "[sdkConfigFile] is = ", sdkConfigFile

    phases = XcodeProject.get_build_phases_by_name('XCBuildConfiguration')
    base = 'buildSettings'
    key = "INFOPLIST_FILE"
    for build_phase in phases:
        if base in build_phase and key in build_phase[base]:
            infoPlist = build_phase[base][key]
    if infoPlist is not None:
        infoPlist = os.path.join(destDir, infoPlist)
        plist = biplist.readPlist(infoPlist)
    specialScript = os.path.join(srcDir, "special.py")
    if os.path.exists(specialScript):
        sysPath = copy.deepcopy(sys.path)
        sys.path.append(os.path.abspath(srcDir))
        import special
        ret = special.run(sdk, sdkConfigFile, os.path.abspath(destDir), plist,
                          XcodeProject)

        if ret:
            print "[ %s ] Error! run special script" % sdk
            return 1
        del sys.modules["special"]
        if infoPlist is not None:
            biplist.writePlist(plist, infoPlist, False)
        sys.path = sysPath
    return 0
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    def testGetBuildPhasesByName(self):
        project = XcodeProject(self.obj)

        build_phases = project.get_build_phases_by_name('PBXGenericBuildPhase')
        self.assertEqual(build_phases.__len__(), 2)
Exemplo n.º 4
0
    def testGetBuildPhasesByName(self):
        project = XcodeProject(self.obj)

        build_phases = project.get_build_phases_by_name('PBXGenericBuildPhase')
        self.assertEqual(build_phases.__len__(), 2)