Пример #1
0
    def testAddRunScriptWithInstallBuild(self):
        project = XcodeProject(self.obj)
        project.add_run_script(u'ls -la', run_install_build=1)

        self.assertEqual(
            project.objects[project.objects['1'].buildPhases[1]].
            runOnlyForDeploymentPostprocessing, 1)
Пример #2
0
    def testAddRunScriptWithInputFiles(self):
        project = XcodeProject(self.obj)
        script = u'ls -la ${SCRIPT_INPUT_FILE_0} ${SCRIPT_INPUT_FILE_1} > ${SCRIPT_OUTPUT_FILE_0}'
        project.add_run_script(script,
                               input_files=['a.txt', '/tmp/b.txt'],
                               output_files=['../output.log'])

        self.assertEqual(
            project.objects[project.objects['1'].buildPhases[1]].shellScript,
            script)
        self.assertEqual(
            project.objects[project.objects['1'].buildPhases[1]].inputPaths,
            ['a.txt', '/tmp/b.txt'])
        self.assertEqual(
            project.objects[project.objects['1'].buildPhases[1]].outputPaths,
            ['../output.log'])
        self.assertEqual(
            project.objects[project.objects['2'].buildPhases[1]].shellScript,
            script)
        self.assertEqual(
            project.objects[project.objects['2'].buildPhases[1]].inputPaths,
            ['a.txt', '/tmp/b.txt'])
        self.assertEqual(
            project.objects[project.objects['2'].buildPhases[1]].outputPaths,
            ['../output.log'])
Пример #3
0
    def testAddRunScriptAfterCompile(self):
        project = XcodeProject(self.obj)
        project.add_run_script(u'ls -la')

        self.assertEqual(
            project.objects[project.objects['1'].buildPhases[1]].shellScript,
            u'ls -la')
        self.assertEqual(
            project.objects[project.objects['2'].buildPhases[1]].shellScript,
            u'ls -la')
Пример #4
0
    def testAddRunScriptBeforeCompile(self):
        project = XcodeProject(self.obj)
        project.add_run_script(u'ls -la', insert_before_compile=True)

        self.assertEqual(
            project.objects[project.objects['1'].buildPhases[0]].shellScript,
            u'ls -la')
        self.assertEqual(
            project.objects[project.objects['2'].buildPhases[0]].shellScript,
            u'ls -la')
Пример #5
0
    def testRemoveRunScriptNotFound(self):
        project = XcodeProject(self.obj)
        project.add_run_script(u'ls -la', insert_before_compile=True)

        self.assertEqual(project.objects[project.objects['1'].buildPhases[0]].shellScript, u'ls -la')
        self.assertEqual(project.objects[project.objects['2'].buildPhases[0]].shellScript, u'ls -la')

        project.remove_run_script(u'ls')
        self.assertEqual(project.objects[project.objects['1'].buildPhases[0]].shellScript, u'ls -la')
        self.assertEqual(project.objects[project.objects['2'].buildPhases[0]].shellScript, u'ls -la')
Пример #6
0
    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)
Пример #7
0
    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)
Пример #8
0
    def testAddRunScriptAfterCompile(self):
        project = XcodeProject(self.obj)
        project.add_run_script(u'ls -la')

        self.assertEqual(project.objects[project.objects['1'].buildPhases[1]].shellScript, u'ls -la')
        self.assertEqual(project.objects[project.objects['2'].buildPhases[1]].shellScript, u'ls -la')
Пример #9
0
    def testAddRunScriptBeforeCompile(self):
        project = XcodeProject(self.obj)
        project.add_run_script(u'ls -la', insert_before_compile=True)

        self.assertEqual(project.objects[project.objects['1'].buildPhases[0]].shellScript, u'ls -la')
        self.assertEqual(project.objects[project.objects['2'].buildPhases[0]].shellScript, u'ls -la')
            print(thisscript.strip()[:10], " does not begin with ",
                  'COMPANY'.strip())
            if thisscript.strip().startswith("mkdir -p "):
                project.remove_run_script(build_phase.shellScript)
                print("Removed extra oF app resources script.")
        # if (build_phase.shellScript.startswith("COMPANY_NAME")) or (build_phase.shellScript.startswith('mkdir -p "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/"')):
        #     print("found the script!")
        #     print(build_phase.shellScript)
        #     build_phase.shellScript = finalscript
        #     foundScript = True
        # else:
        #     print("this script doesn't start with companyname:", build_phase.shellScript)
        id += 1

if not foundScript:
    project.add_run_script(script=finalscript)

# 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')