Ejemplo n.º 1
0
    def _post_process(self, platform, products):

        ########################################################################################################

        logger.debug("<sub>Post processing</sub>...")

        # By convention sdk[0] is always the device sdk (e.g. 'iphoneos' and not 'iphonesimulator')
        device_sdk = platform.device_sdk
        device_product = products[device_sdk]

        ########################################################################################################

        output_product = copy(device_product)
        output_product.target_build_dir = self.config.build_path / platform.output_directory_name

        ########################################################################################################

        logger.debug('<sub>Copying binary</sub>...')
        if output_product.product_path.exists():
            shutil.rmtree(output_product.product_path)
        shutil.copytree(device_product.product_path, output_product.product_path)

        ########################################################################################################

        if len(products) > 1:
            logger.debug('<sub>Lipo-ing</sub>...')
            executable_paths = [product.executable_path for product in products.values()]
            command = ['/usr/bin/xcrun', 'lipo', '-create'] + executable_paths + ['-output', output_product.executable_path]
            runner.check_run(command)
            mtime = executable_paths[0].stat().st_mtime
            os.utime(str(output_product.executable_path), (mtime, mtime))

        ########################################################################################################

        logger.debug('<sub>Copying swiftmodule files</sub>...')
        for product in products.values():
            for path in product.module_paths:
                relative_path = path.relative_to(product.product_path)
                shutil.copyfile(path, output_product.product_path / relative_path)

        ########################################################################################################

        logger.debug('<sub>Copying bcsymbolmap files</sub>...')
        for product in products.values():
            for path in product.bcsymbolmap_paths:
                shutil.copy(path, output_product.target_build_dir)

        ########################################################################################################

        logger.debug('<sub>Producing dSYM files</sub>...')
        command = ['/usr/bin/xcrun', 'dsymutil', str(output_product.executable_path), '-o', str(output_product.target_build_dir / (output_product.executable_name + '.dSYM'))]
        runner.check_run(command)

        ########################################################################################################
Ejemplo n.º 2
0
    def _post_process(self, platform, products):

        ########################################################################################################

        logger.debug("<sub>Post processing</sub>")

        # By convention sdk[0] is always the device sdk (e.g. 'iphoneos' and not 'iphonesimulator')
        device_sdk = platform.device_sdk
        device_product = products[device_sdk]

        ########################################################################################################

        output_product = copy(device_product)
        output_product.target_build_dir = self.config.build_path / platform.output_directory_name

        ########################################################################################################

        logger.debug('<sub>Copying binary</sub>')
        if output_product.product_path.exists():
            shutil.rmtree(output_product.product_path)
        shutil.copytree(device_product.product_path, output_product.product_path)

        ########################################################################################################

        if len(products) > 1:
            logger.debug('<sub>Lipo-ing</sub>')
            executable_paths = [product.executable_path for product in products.values()]
            command = ['/usr/bin/xcrun', 'lipo', '-create'] + executable_paths + ['-output',
                output_product.executable_path]
            runner.check_run(command)
            mtime = executable_paths[0].stat().st_mtime
            os.utime(str(output_product.executable_path), (mtime, mtime))

        ########################################################################################################

        logger.debug('<sub>Copying swiftmodule files</sub>')
        for product in products.values():
            for path in product.module_paths:
                relative_path = path.relative_to(product.product_path)
                shutil.copyfile(path, output_product.product_path / relative_path)

        ########################################################################################################

        logger.debug('<sub>Copying bcsymbolmap files</sub>')
        for product in products.values():
            for path in product.bcsymbolmap_paths:
                shutil.copy(path, output_product.target_build_dir)

        ########################################################################################################

        logger.debug('<sub>Producing dSYM files</sub>')
        command = ['/usr/bin/xcrun', 'dsymutil', str(output_product.executable_path), '-o',
            str(output_product.target_build_dir / (output_product.executable_name + '.dSYM'))]
        runner.check_run(command)
Ejemplo n.º 3
0
    def _post_process(self, platform, products):
        # type: (punic.platform.Platform, List)

        ########################################################################################################

        logging.debug("<sub>Post processing</sub>...")

        # TODO: QUESTION: Is it possible that this could mix targets with different SDKs?
        products_by_name_then_sdk = defaultdict(dict)
        for product in products:
            products_by_name_then_sdk[product.full_product_name][
                product.sdk] = product

        for products_by_sdk in products_by_name_then_sdk.values():

            products = products_by_sdk.values()

            # TODO: By convention sdk[0] is always the device sdk (e.g. 'iphoneos' and not 'iphonesimulator')
            primary_sdk = platform.sdks[0]

            device_product = products_by_sdk[primary_sdk]

            ########################################################################################################

            output_product = copy(device_product)
            output_product.target_build_dir = self.config.build_path / platform.output_directory_name

            ########################################################################################################

            logging.debug('<sub>Copying binary</sub>...')
            if output_product.product_path.exists():
                shutil.rmtree(output_product.product_path)

            if not device_product.product_path.exists():
                raise Exception("No product at: {}".format(
                    device_product.product_path))

            shutil.copytree(device_product.product_path,
                            output_product.product_path,
                            symlinks=True)

            ########################################################################################################

            if len(products) > 1:
                logging.debug('<sub>Lipo-ing</sub>...')
                executable_paths = [
                    product.executable_path for product in products
                ]
                command = ['/usr/bin/xcrun', 'lipo', '-create'
                           ] + executable_paths + [
                               '-output', output_product.executable_path
                           ]
                runner.check_run(command)
                mtime = executable_paths[0].stat().st_mtime
                os.utime(str(output_product.executable_path), (mtime, mtime))

            ########################################################################################################

            logging.debug('<sub>Copying swiftmodule files</sub>...')
            for product in products:
                for path in product.module_paths:
                    relative_path = path.relative_to(product.product_path)
                    shutil.copyfile(
                        path, output_product.product_path / relative_path)

            ########################################################################################################

            logging.debug('<sub>Copying bcsymbolmap files</sub>...')
            for product in products:
                for path in product.bcsymbolmap_paths:
                    shutil.copy(path, output_product.target_build_dir)

            ########################################################################################################

            logging.debug('<sub>Producing dSYM files</sub>...')
            command = [
                '/usr/bin/xcrun', 'dsymutil',
                str(output_product.executable_path), '-o',
                str(output_product.target_build_dir /
                    (output_product.executable_name + '.dSYM'))
            ]
            runner.check_run(command)
Ejemplo n.º 4
0
    def _post_process(self, platform, products):
        # type: (punic.platform.Platform, List)

        ########################################################################################################

        logging.debug("<sub>Post processing</sub>...")

        # TODO: QUESTION: Is it possible that this could mix targets with different SDKs?
        products_by_name_then_sdk = defaultdict(dict)
        for product in products:
            products_by_name_then_sdk[product.full_product_name][product.sdk] = product


        for products_by_sdk in products_by_name_then_sdk.values():

            products = products_by_sdk.values()

            # TODO: By convention sdk[0] is always the device sdk (e.g. 'iphoneos' and not 'iphonesimulator')
            primary_sdk = platform.sdks[0]

            device_product = products_by_sdk[primary_sdk]

            ########################################################################################################

            output_product = copy(device_product)
            output_product.target_build_dir = self.config.build_path / platform.output_directory_name

            ########################################################################################################

            logging.debug('<sub>Copying binary</sub>...')
            if output_product.product_path.exists():
                shutil.rmtree(output_product.product_path)

            if not device_product.product_path.exists():
                raise Exception("No product at: {}".format(device_product.product_path))

            shutil.copytree(device_product.product_path, output_product.product_path, symlinks=True)

            ########################################################################################################

            if len(products) > 1:
                logging.debug('<sub>Lipo-ing</sub>...')
                executable_paths = [product.executable_path for product in products]
                command = ['/usr/bin/xcrun', 'lipo', '-create'] + executable_paths + ['-output', output_product.executable_path]
                runner.check_run(command)
                mtime = executable_paths[0].stat().st_mtime
                os.utime(str(output_product.executable_path), (mtime, mtime))

            ########################################################################################################

            logging.debug('<sub>Copying swiftmodule files</sub>...')
            for product in products:
                for path in product.module_paths:
                    relative_path = path.relative_to(product.product_path)
                    shutil.copyfile(path, output_product.product_path / relative_path)

            ########################################################################################################

            logging.debug('<sub>Copying bcsymbolmap files</sub>...')
            for product in products:
                for path in product.bcsymbolmap_paths:
                    shutil.copy(path, output_product.target_build_dir)

            ########################################################################################################

            logging.debug('<sub>Producing dSYM files</sub>...')
            command = ['/usr/bin/xcrun', 'dsymutil', str(output_product.executable_path), '-o', str(output_product.target_build_dir / (output_product.executable_name + '.dSYM'))]
            runner.check_run(command)

            ########################################################################################################